I have 5x i2c rotary encoders wired, each on a diffenet i2c address:
I poll them every 250ms.
But it is not stable. From time to time, maybe after hours, i catch the following error:
"InternalError: InternalError: Timeout on I2C Write Transmit Mode 2"
It's repeating endless until i force to reset/restart the espruino using my own E.enableWatchdog(); function. Memory usage is stable.
I was not able to isolate the code. Here is a snip where i catch it.
d = I2C1.readFrom(...., 8);
log(x); // InternalError: InternalError: Timeout on I2C Write Transmit Mode 2
After a soft restart of the espruino using my own watchdog reset, everything is fine again. The encoders are not reseted or restarted. No powercycle was made for the encoders.
Is there a way to recover this i2c issue without a restart of the espruino ?
Is your firmware up to date? (1v99) Looking at the error, the I2C peripheral appears to be having trouble getting a result after sending the device's address - which doesn't feel like it's an issue with the internal I2C interface.
You could try just calling I2c1.setup again, or maybe digitalWrite(...,1) for SDA and SCL pins and then setup again and see if that helps?
Could you try using software I2C and see if that helps?
var i2c = new I2C();
// ... then ...
I used 1V99. Thanks as allways for your fast answer. I will test it with software I2C and let you know.
Last time it took 12 hours until the error happens.
I would like to let you know that the following seems to work.
When i catch the first Error: "InternalError: Timeout on I2C Write Transmit Mode 2"
i call another I2c1.setup. Everything is working again.
A test of 36 hours was successfull.
Don't worry about formatting, just type in the text and we'll take care of making sense of it. We will auto-convert links, and if you put asterisks around words we will make them bold.
For a full reference visit the Markdown syntax.
© Espruino, powered by microcosm.
Report a problem