Skip to content

Commit b3ec5f9

Browse files
committed
esp32/machine_i2c.c: Fix default I2C pins for new ESP32 models.
his addresses issue micropython#17103. The new default I2C init does not require setting SCL or SDA but the default pins for C3 (and S3?) conflict with the espressif GPIO usage. For the C3, pins 18/19 are for USB/JTAG. If used for I2C() they will cause the REPL to hang on initialization of the I2C. For the S3 pin 19 is allocated for USB/JTAG also but the defaults do not seem to affect the REPL. This pull request updates pin settings for the non base ESP32 models (C3,C6,S2,S3,...). See PR micropython#16956 See Issue micropython#17103 Signed-off-by: Rick Sorensen <[email protected]>
1 parent 9ee2ef5 commit b3ec5f9

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

ports/esp32/machine_i2c.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,13 @@
3535
#if MICROPY_PY_MACHINE_I2C || MICROPY_PY_MACHINE_SOFTI2C
3636

3737
#ifndef MICROPY_HW_I2C0_SCL
38+
#if CONFIG_IDF_TARGET_ESP32
3839
#define MICROPY_HW_I2C0_SCL (GPIO_NUM_18)
3940
#define MICROPY_HW_I2C0_SDA (GPIO_NUM_19)
41+
#else
42+
#define MICROPY_HW_I2C0_SCL (GPIO_NUM_9)
43+
#define MICROPY_HW_I2C0_SDA (GPIO_NUM_8)
44+
#endif
4045
#endif
4146

4247
#ifndef MICROPY_HW_I2C1_SCL

0 commit comments

Comments
 (0)