Closed MiloMindbender closed 6 years ago
It appears this is a problem in the ESP32 i2c arduino software. The board works with the 1.0.0-rc3 release but everything newer fails.
Over on the ESP32 github here https://github.com/espressif/arduino-esp32/issues/1761
They suggested a fix which I tried, but most samples still only work intermittently. They often work from a cold start but pressing the reset button they will only sometimes start. After 3 or so presses they generally fail to come up until cold started again.
Some samples still seem to fail 100% of the time.
Could this be a timing issue of some kind because the ESP32 is a faster chip? Maybe the 9250 is not getting enough time to reset and get itself started?
Some more info, take a look at https://github.com/espressif/arduino-esp32/issues/1761 for more details.
It appears the 9250 is getting into a state where it pulls sda low and leaves scl high. Resetting the ESP doesn't clear this. As long as the 9250 has power it stays stuck this way, only cycling power fixes it.
Is there any way to do a hardware reset of the 9250? When it gets into this state you can't communicate with it so a software reset isn't possible.
It appears the problem has to do with resetting the CPU when the 9250 is in a particular state. The transaction doesn't complete and leaves the 9250 holding the bus with SDA low and SCL high.
Some new code has been added to the ESP32 repository to cause the I2C bus to recover if it comes up in a bad state after a boot. This code will be in the next release or you can get it now by updating to the latest ESP32 arduino code.
Seems to fix the problem so I'm closing this.
I have the https://www.sparkfun.com/products/13762 9250 i2c breakout board. When I got this it seemed to be running fine but with the latest release of ESP32 arduino support this doesn't seem to work any more.
All the samples such as MPU9250 basic appear to startup and are trying to read the 9250 but no data is ever returned. Checking this on a Saleae logic analyzer shows that all the writes to the 9250 are ACKed but all the reads are NAKed.
I have tried adding 3.3k pullups to the setup, but this does not make any difference. I have tried using 100,000 and 400,000 speeds on Wire, no difference.
I have also double-checked the wires, only 4 (2 power and SDA/SCL, and they are correct.
On one of my computers at home these samples DO seem to work, but I think that machine might have an older release of the ESP32 arduino libraries, I will check that and report back soon.
If it would be helpful, I can post a dump of the I2C traffic from my logic analyzer (software to view it is free). If anyone wants it, let me know, I need to re-capture the data to shrink it's size a bit.