Page 1 of 1

i2c error recovery

Posted: Mon Jul 08, 2019 7:32 am
by shaoziyang
I using a i2c sensor in pyboard, and occasionally hardware i2c will timeout. When this happens, i2c will not read sensor anymore, and it can't recover automatic unless reset. If I using software i2c, it will recovery.

Does anyone konw how to recovery hardware i2c when it occur errors?

Re: i2c error recovery

Posted: Tue Jul 09, 2019 12:56 am
by jimmo
Out of curiosity, what happens if you re-initialise the I2C? (e.g. by calling .init())

I notice that in the STM32 port that doing this will explicitly reset the I2C peripheral.

Re: i2c error recovery

Posted: Tue Jul 09, 2019 2:31 am
by shaoziyang
re-init I2C has no effect,

Re: i2c error recovery

Posted: Wed Sep 25, 2019 8:25 am
by Jonwalter
My general startup/recovery procedure is to set the I2C as I/O lines and send out clock pulses while checking the data line. I wait for ten consecutive ones with no intervening zeroes before I switch (back) to the MSSP.