Graceful Reset of I2C on RPI Pico after Timeout #12547
Replies: 2 comments 3 replies
-
How are you getting the traceback message? rshell, mpremote, an IDE? |
Beta Was this translation helpful? Give feedback.
-
I found this application note. While the master controls the SCL line, a slave may continue pulling the sda line down, as it is open drain, thus making the i2c communication impossible. The recommended solution is.
You would have to reinit Pins 8 and 9 as digital pins. like For the STOP condition e.g. here:
For T_SU:STO you have to look up the datasheet of the SSD1306, but I suppose there a sufficiently long time of e.g. above 12 ordinary scl clock cycles would suffice. Afterwards I would start with the reinit of the i2c object and try with an i2c scan first whether the disply is there. |
Beta Was this translation helpful? Give feedback.
Uh oh!
There was an error while loading. Please reload this page.
-
I am developing a continuously running temperature monitor with a RPI Pico W, a DS18B20 temperature sensor (OneWire interface) and an SSD1306-based OLED Display (on an I2C bus). The display shows the current time and temperature, and updates every 15 seconds. After a random longer period of time between 10 minutes and several hours, the I2C responds with a timeout, and the RPI needs to be rebooted to continue. Currently, a watchdog timer is used to reboot the device with such kind of an error, but I am looking for a cleaner implementation.
The error message with the call hierarchy:
with the failing function
I wonder a decent error handling and a graceful reset of the I2C bus could be implemented.
The Timeout error itself can be handled with
However, the reset of the I2C bus was not possible so far, the program could not be resumed and the display stayed black.
In the error handler, I tried to initialise the I2C again with the same settings:
i2c = I2C(0, scl=Pin(9), sda=Pin(8), freq=400000) # Init I2C using pins GP8 & GP9 (default I2C0 pins)
The
I2C.deinit()
function is not supported on RPI, this also does not work. Could anybody explain how to properly reset the I2C bus?Further hints on getting the I2C more stable and prevent the error are also highly appreciated.
Further information on board and software :
RPI Pico W with micropyton release
RPI_PICO_W-20230426-v1.20.0.uf2
.Beta Was this translation helpful? Give feedback.
All reactions