-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I2C legacy driver works, new one does not (IDFGH-13576) #14464
Comments
Above fix is available in master tree now, 8aee667 , you can verify it after updating your ESP-IDF. |
right see 8aee667 |
Thanks guys, a quick test with that commit included is looking good! |
I got same problem on ESP32 Lyrat 4.3 board. All the ADF examples will trigger these error messages. I'm starting to wonder if it's a hardware issue. |
Did you update the idf version? |
Yep, I also post this issue at espressif/esp-adf#1281. Now I suspect it's a hardware problem. |
Answers checklist.
IDF version.
master-c9df77ef (headrev as of 28th August 2024)
Espressif SoC revision.
ESP32 v1.0
Operating System used.
Windows
How did you build your project?
Command line with idf.py
If you are using Windows, please specify command line type.
CMD
Development Kit.
All, but in this case ESP32-WROOM-32
Power Supply used.
USB
What is the expected behavior?
We supply a library (ubxlib) which allows customers to talk to our (u-blox) GNSS devices. The I2C part of that code has worked with the old ESP-IDF I2C API for many years now and is tested constantly in a regression test system.
We are now trying to move to the new ESP-IDF I2C API but have not yet been successful: we see pretty much constant "I2C hardware timeout detected" being reported. The issue might be related to #14129 (also connected with talking to a u-blox GNSS chip, all of which may perform clock stretching) but that issue seems to have been marked as "done" with resolution "NA", hence raising this separately.
Using one of our simpler regression test cases, I have Saleae logs of a success case with the old ESP-IDF I2C API and a fail case with the new ESP-IDF I2C API; both are, unfortunately, too large to upload here (greater than 25 Mbtyes), hence posting screen-shots of the relevant bits.
We ask the GNSS chip (address
0x42
) how much data it has to send by writing to register0xFD
with no stop bit and then reading back two bytes, like this (in the case below the GNSS chip has0x012e
bytes to send):...then we read those [in this case
0x012e
, so 302] bytes from the GNSS device:This is with the old I2C API, all is good.
Here is the same case with the new ESP-IDF I2C API; on this occasion when we ask it the GNSS chip happens to have nothing to send, which is not a problem, all is still good:
However, when we ask it the next time something goes wrong, the write to register
0xFD
never completes:We retry, of course, and eventually it might work, but things are just terribly flaky, nothing works well enough for a retry to fix. The output on a terminal shows:
Our I2C code can be found here; compiled with the flag
ESP_IDF_I2C_NEW_API_DISABLE
it works, leave that flag off to use the new ESP-IDF I2C API and it fails as above. Sometimes it does work, an I2C transaction succeeds, but more often than not it fails.As you can see we have set
scl_wait_us
to 10000 (so 10 ms), clock is 400 kHz (the same in both pass and fail cases), clock source is of course APB (the only I2C clock source for the ESP32 chip),intr_priority
is 0,glitch_ignore_cnt
is 7 as recommended,enable_internal_pullup
istrue
(and the pull-ups must be sufficient as they work for the old-API case). We always set the transaction timeout to -1 so that it can have no effect.What might we be doing wrong?
What is the actual behavior?
See above.
Steps to reproduce.
Connect a u-blox GNSS chip to an ESP32 and use the code here to run test
gnssCfgBasic()
.Debug Logs.
More Information.
No response
The text was updated successfully, but these errors were encountered: