Skip to content

ESP32-S2 I2C: lengthy gaps (about 10 ms) between transactions. (IDFGH-7169) #8770

@dhalbert

Description

@dhalbert
  • Development Kit: none (Adafruit boards)
  • Module or chip used: ESP32-S2-WRONGER
  • IDF version
    v4.4-351-g121ddb87e5
  • Build System: [Make|CMake|idf.py]
  • Compiler version
    xtensa-esp32-elf-gcc (crosstool-NG esp-2021r2-patch3) 8.4.0
  • Operating System: Linux
  • Using an IDE?: No
  • Power Supply: USB

Problem Description

Using I2C at 100_000 Hz (standard clock rate) cause ~10ms delays between I2C transactions. Raising to 125_000 causes the delays to go away. In between, only some I2C speeds work; others produce glitches that cause the I2C device to fail. Testing on a PCA9685. A colleague tried another device and was able to get it to work at 110_000.

Expected Behavior

There should not be excessive delays at 100kHz. I was suspicious that 10ms is close to the FreeRTOS tick interval, but the gaps vary sometimes between 9.something and occasionally as low as 7.something, so that may be a red herring.

Steps to reproduce

Tested in CircuitPython, which currently uses the ESP-IDF version shown above.

Code to reproduce this issue

See adafruit/circuitpython#6263. These forum posts report what sounds like the same issue:

https://www.esp32.com/viewtopic.php?p=95404
https://www.esp32.com/viewtopic.php?p=95405

I have Saleae traces if that is of interest.

I spent quite a bit of time inside the IDF I2C code, adjusting timeouts (ticks_to_wait), printing things, and trying various tweaks, and I cannot locate the source of this issue. I am wondering if it is hardware or hardware-setup related.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions