← index #8440Issue #4574
Off-topic · high · value 1.000
QUERY · ISSUE

Unable to use pin 20 as SCL for I2C on ESP32.

openby kattniopened 2022-03-23updated 2022-08-07
port-esp32

I submitted the fix to #8393 to expose pin 20 on ESP32. On the Adafruit Feather ESP32 V2, SCL is pin 20. I loaded the latest nightly build onto my board. I am running into the following issues.

When trying to initalise I2C, it is not accepting pin 20 as a viable option for SCL.

>>> from machine import Pin, I2C
>>> i2c = I2C(0, scl=Pin(20), sda=Pin(22))
E (2540280) i2c: /home/micropython/esp-idf-v4.2/components/driver/i2c.c:767 (i2c_set_pin):scl gpio number error

I2C set up works with pin 14 as SCL.

If I try to simply init pin 20 as an output, it also fails.

>>> from machine import Pin
>>> p20 = Pin(20, Pin.OUT)
E (19500) gpio: gpio_set_direction(263): GPIO number error

@jepler suggested that perhaps the issue is resolved in the ESP IDF v4.4, but an attempt to build MicroPython with that version resulted in a failure to fit in flash. So, I have not tested this possibility.

CANDIDATE · ISSUE

NRF port - I2C

closedby noblerabbitopened 2019-03-04updated 2019-03-14

Hi,

Did anyone test I2C on the NRF port?

I am using NRF52 DK. I connect the SDA and SCL to 26 and 27 pin on the board.

When I run i2c.scan(), I get [] - an empty list. If I connect the same sensor to esp32 (also running micropython), i2c works as it is supposed to, and I can communicate with the sensor.

Is there anything else I should set on NRF52 DK, besides just connecting the SDA, SCL, and GND and VDD from the sensor to the board; and assigning sda and scl pins through machine.i2c?

>>> import machine
>>> i2c = machine.I2C(scl=machine.Pin(27), sda=machine.Pin(26))
>>> i2c.scan()
[]
>>>

I am running MicroPython v1.10-150-gf8f272429 on 2019-03-03; PCA10056 with NRF52840.

Thanks!

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied