8000 ESP32 I2C: Repeated start handling incorrect · Issue #7134 · micropython/micropython · GitHub
[go: up one dir, main page]

Skip to content
ESP32 I2C: Repeated start handling incorrect #7134
Closed
@jetpax

Description

@jetpax

The I2C 'repeated start' handling code for ESP32 fails to drive the ESP-IDF correctly, which leads to very inefficient blocking use of the bus when when register/memory reads are performed (of course, this is only of concern if high I2C performance on a busy bus is required).

For example, see the large dead time between register setup and eventual read in the trace below.

image

This is caused by an elegant, but in the end insufficient, read_mem function in extmod/machine_i2c.c.

By modifying read_mem to use an updated machine_hw_i2c_transfer in ports/esp32/machine_i2c.c, the problem is resolved:

image

This also makes read_mem consistent with write_mem.

This has been tested with 1MHz bus operation using a wide variety of sensors and addressing modes; happy to raise a PR if there is interest (ie if it is ever likely to be merged)

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      0