Tool/software:
Background:
1. In the current project, I used the I2C module, and we simultaneously used the I2C master and I2C slave.
2. Two I2C modules (both with master-slave functionality) were used in the project
3. For the convenience of testing, two I2C modules are docked, one as the master and other as the slave for testing
4. There is no problem with normal communication, and there is no problem with continuously lowering CLK or SDA.
Exception:
1. Artificially creating anomalies, constantly touching SDA with GND, and attempting around 10-30 time, it is highly likely that the I2C slave will be set as abnormal, and SDA will remain low at this time. The MCS status of the slave is generally 0X60
Current processing:
1. Check the datasheet and say that you want to send a STOP
2. Attempted to send STOP, multiple attempts failed to resolve the exception
3. Turn off the slave AF GPIO mapping (level goes high), attempt to send a STOP, and then turn on and turn off the slave AF GPIO mapping. After multiple transmissions, it can be contacted and restored to normal
2. Artificially creating anomalies, constantly touching SCK with GND, attempting around 20-50, is likely to cause I2C slave or host to enter an anomaly,
a) The Slaver MCS status of the slave is 0X60 (SDA remains low at this time). Follow the above steps to handle the exception, but it cannot be eliminated. Only restarting the MCU can eliminate it
b)The Master MCS status is 0X60/0x70 (SDA remains low at this time), and following the above exception handling can eliminate the exception and restore normal operation
c)The Master MCS status is 0X41 (at this time, the SDA SCK level is high), and data cannot be sent again. According to the above processing, the exception cannot be eliminated, and only restarting the MCU can eliminate it
Regarding the a)&b) issue, according to the description in the datasheet, it states that the I2C module can be reset. However, if I simply turn off and then turn on the I2C peripheral, it will not work. Re initialization also has no effect.
Please help to identify the problem, handle it, and how to correctly reset a single I2C peripheral