I discovered a situation where the I2C bus locks up on my Argon OS v4.0.0. I am taking steps to eliminate the cause of the bus lockup, but once it occurs a power cycle is the only way to recover. Trying to be considerate of the edge case where this could happen again, I want a way to recover from this state without a power cycle (these are devices are installed in remote locations)
One solution is to place all my devices on a switched power bus. Unfortunately, adding that bus to the current board design would be very difficult.
Is there another strategy to resolve a locked-up I2C bus through software? I was hoping a Wire.reset() would break whatever loop the library was stuck in, but it does not.
The more I look at this, if the issue is due to a device that uses clock stretching I am not sure it’s possible for the master to recover. That device could lock up the bus by holding the clock low. Only a power reset (or pin reset if it has one) of the errant device would do it…I think.
I am using an SHT30 temperature sensor and I can create a situation where the slave device gets stuck holding the clock low and only a power reset can resolve it.
Agreed, if the master can fix it Wire.reset() should work. However, I am now finding that I can get the SHT30 in a state where it keeps the SCL low with no way to recover from the master.