-
Problem: The application crashes when a wire is disconnected from the I2C bus.
-
Root Cause: The I2C driver has known bugs (as reported by the community), and likely lacks robust error handling for physical disconnection or bus faults.
-
Impact:
-
No graceful recovery or error reporting.
-
The system hangs or crashes due to unhandled exceptions or timeouts during I2C communication.
-
Currently, we are using a watchdog_irq_handler() to generate a error but the application cannot run afterwards.
-
Do you mind sharing the logs when the application crashes? Did you encounter a hard fault?
We do have a watchdog feature in the latest prerelease SDK 4.1.0-build20251027 to do a reset when the application crashes. You can try to see if it works for you.
It’s a hard fault condition. By using a WDT, we can reset the MCU and generate I2C bus error using some fault LEDs, but there are multiple I2C sensors connected to the bus, and we cannot differentiate which sensor triggered the WDT.
Thank you for your update.
I will try to reproduce the issue on my end. Do you mind sharing which I2C sensors are currently connected to the bus? If possible, you may also include a photo of your setup for reference.
Thank you.
secondary MCU (Stm32l4) that is handling multiple sensors are connected to the I2C bus. There is no sensor directly connected. What we want to achieve is that if the MCU gets disconnected from the Primary MCU (amb82) in real-time, the other secondary MCUs don’t gets affected.
Sorry for the late reply, and thank you for your sharing.
Let me test at my side and get back to you at the soonest.
In the meantime, you may try adding pull-up resistors (4.7 kΩ – 10 kΩ) to help maintain stable I²C signal levels. The pull-ups can be placed on the shared I²C bus lines (SCL and SDA).
Do let us know if adding a pull up resistor helps to fix the crash issue.
Thank you.