Skip to content

Hardware I2C doesn't work on ESP32-C5 #18668

@sfe-SparkFro

Description

@sfe-SparkFro

Port, board and/or hardware

esp32 port, ESP32-C5-DevKitC-1 v1.2

MicroPython version

MicroPython v1.27.0 on 2025-12-09; ESP32C5 module with ESP32C5

Reproduction

import machine
i2c0 = machine.I2C(id=0)
i2c1 = machine.I2C(id=1)
i2c0.scan()
i2c1.scan()

Expected behaviour

i2c0 and i2c1 should be created with no errors, and both should be able to scan and perform read/write operations.

Observed behaviour

Attempting to create i2c0 causes a reboot:

MicroPython v1.27.0 on 2025-12-09; ESP32C5 module with ESP32C5
Type "help()" for more information.
>>> import machine
>>> i2c0 = machine.I2C(id=0)
ESP-ROM:esp32c5-eco2-20250121
Build:Jan 21 2025
rst:0x1a (CPU_LOCKUP),boot:0x5b (SPI_FAST_FLASH_BOOT)
Core0 Saved PC:0x4200757e
SPI mode:DIO, clock div:1
load:0x408556b0,len:0xdfc
load:0x4084bba0,len:0xc4c
load:0x4084e5a0,len:0x2ee8
entry 0x4084bba0
MicroPython v1.27.0 on 2025-12-09; ESP32C5 module with ESP32C5
Type "help()" for more information.
>>> 

Attempting to create i2c1 results in error messages. The I2C scan (and read/write methods) complains that the driver is not installed:

MicroPython v1.27.0 on 2025-12-09; ESP32C5 module with ESP32C5
Type "help()" for more information.
>>> import machine
>>> i2c1 = machine.I2C(id=1)
E (22747) i2c: i2c_driver_install(305): LP_I2C is not supported via i2c_driver_intall()
>>> i2c1 = machine.I2C(id=1)
E (24887) i2c: i2c_driver_delete(484): i2c driver install error
E (24887) i2c: i2c_driver_install(305): LP_I2C is not supported via i2c_driver_intall()
>>> i2c1.scan()
E (29467) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
E (29467) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
E (29467) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
...
E (30107) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
E (30107) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
E (30117) i2c: i2c_master_cmd_begin(1552): i2c driver not installed
[]
>>>

Additional Information

I also noticed i2c1 (which is presumably the LP I2C peripheral) uses scl=9, sda=8:

>>> i2c1
I2C(1, scl=9, sda=8, freq=400000, timeout=50000)

However LP I2C on the ESP32-C5 can only be used on pins 2 and 3 (see the ESP32-C5 datasheet, section 4.2.1.3, "Pin Assignment").

FWIW SoftI2C() seems to work fine.

Code of Conduct

Yes, I agree

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions