-
Notifications
You must be signed in to change notification settings - Fork 7.6k
ESP32-S2 I2C does not honor repeated-start (no stop) in API? #4729
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
Comments
@ladyada sorry for the delay. I2C for S2 uses ESP-IDF's I2C driver. I did not find a way to ensure no-stop there and remember that in order for that to work, write and read need to happen in one bus transaction (not really Arduino-friendly and with possible multitasking issues). Unfortunately we have not heard from @stickbreaker in a loong time (he was maintaining the driver) but we are looking into getting some help internally to be able to handle that in near future. |
hihi thanks for replying - there's quite a few chips that require write-then-read in one no-stop transaction. we haven't heard of this problem before for ESP32 (just S2) so it could be a regression in v4.2 or for S2 either way its OK if there's a separate call just for write-then-read added, we have abstracted away the API for all our sensors so we could easily add that exception - just let me know :) |
Is there a surround workaround for this? Perhaps @ladyada you know of one?
|
there is no work-around, it must be fixed here/IDF :) |
we are aware of the issue, it will be fixed before 2.0.0 is released :) |
awesome thank you @me-no-dev :) |
This issue will be solved internally in ESP-IDF IDF-3460 |
ahah Just came up here after scratching my head for 2 hours trying to have battery monitoring on Metro ESP32 S2. Glad to see it's not on our side. Just let us know if there is a fixed branch to test before official release of 2.0.0 |
@SuGlider LC709 works right now, so it seems to have solved at least that issue! |
I can confirm #5683 fixes the repeated start problem. Below is original bad recorded on ESP32-S2 w/ MLX90640: Now with #5683 changes: Sensor is happily reporting. Thanks @me-no-dev! |
hey @me-no-dev i verified someone trying an ESP32-S2 with an lc709203f and i am pretty sure that the issue is that when we ask for no-stop in
uint8_t TwoWire::endTransmission(bool sendStop)
its sending a stop anyways.This is the correct I2C transaction to read the ID code (on avr chipset)

we write 0x11 register command to i2c device 0xB, don't stop, then read 3 bytes of data
if we run the same code on ESP32-S2 I get:

(there's a delay due to serial printf)
with wrong data 0xFF
if we go back to avr and turn ON stop (which is incorrect), we get the same resulting trace:

same wrong data
this could be the root cause for
#4589
#4561
#4375
#4403
those are also repeated-start devices. not all i2c devices require repeated start
The text was updated successfully, but these errors were encountered: