Page 1 of 1

I2C Read returns incorrect data while Physical Bus has correct Data.

Posted: Tue Feb 06, 2024 9:35 pm
by Ravenholem
I am experiencing a situation very similar to
https://esp32.com/viewtopic.php?t=35508
https://esp32.com/viewtopic.php?t=30427

I am reading data from a DPS310 sensor. I read from it every 1 second.
On average the device runs for 2+ to 3+ hours and then I get an Assert thrown because the value read from the DPS310 does not match what it should be.
I have probed the I2C bus with a MSO scope and I can see the I2C data decoded and it is exactly what I expect, yet the value returned from the I2C read function is wrong.
Physically everything looks good.
I'm running at 100khz using 4k7 resistors.
The I2C SDA/SCL pulses have pretty good edges.
The two issue I have linked to had the same solution in opposite directions. Both changed the clock speed but one from 10k to 100k and the other from 100k to 10k.

I wanted to see if there has been anymore light shed on this issue and what is causing it. Because Physically I can't understand why the I2C peripheral would be clocking wrong data in while everything physically looks perfect on the bus.

Re: I2C Read returns incorrect data while Physical Bus has correct Data.

Posted: Wed Feb 07, 2024 2:12 pm
by Ravenholem
I have tried lowering the i2c clock to 50khz and 25khz and still getting incorrect values returned from the i2c. On the physical Bus the data is correct.

Re: I2C Read returns incorrect data while Physical Bus has correct Data.

Posted: Fri Feb 09, 2024 12:37 pm
by MicroController
On the physical Bus the data is correct.
Then the problem is likely in your code...

Re: I2C Read returns incorrect data while Physical Bus has correct Data.

Posted: Sat Feb 10, 2024 2:39 pm
by mbratch
I think some details would help.

What ESP32 processor are you using?
What version of ESP-IDF are you using?
What are your I2C port assignments?
Can you show your code that configures the I2C?
Can you show your code that reads the I2C?