recover I2c stuck
Posted: Fri Sep 24, 2021 8:50 am
Hello,
My project controls, through an STM32F103C8, a relay module. Attached to the board there are also an LCD module and an SHT31 sensor, both connected to the I2c (both on the first i2C. the second one isn't used). I use the Arduino IDE with the wire library and the LiquidCrystal_I2c. I have issues due to interferences from the relays module. I'm working on the hardware part but I'd like to implement some checks and recover on the software side. I've already activated the watchdog but the more frequent issue is that the LCD display is stuck while the MCU keeps working and so no reset is triggered. I have programmed the sketch so that it triggers a relay when a read from the SHT31 sensor is below a given level and so when the LCD is stuck, I'm not even sure that function is working properly. The other relay is activated on a frequency base so I know that the MCU isn't stuck. I've also implemented some checks for a soft reset of the sensor if the reads are wrong. As said, I'd like to implement some check and reset of the I2c bus or, in general, to recover the proper functioning of the LCD. Even an MCU reset would be eventually fine but I don't know how to check the LCD or i2c status.
Please note that I just started out and I have no background whatsoever so if you are so kind to reply, please keep this in mind.
My project controls, through an STM32F103C8, a relay module. Attached to the board there are also an LCD module and an SHT31 sensor, both connected to the I2c (both on the first i2C. the second one isn't used). I use the Arduino IDE with the wire library and the LiquidCrystal_I2c. I have issues due to interferences from the relays module. I'm working on the hardware part but I'd like to implement some checks and recover on the software side. I've already activated the watchdog but the more frequent issue is that the LCD display is stuck while the MCU keeps working and so no reset is triggered. I have programmed the sketch so that it triggers a relay when a read from the SHT31 sensor is below a given level and so when the LCD is stuck, I'm not even sure that function is working properly. The other relay is activated on a frequency base so I know that the MCU isn't stuck. I've also implemented some checks for a soft reset of the sensor if the reads are wrong. As said, I'd like to implement some check and reset of the I2c bus or, in general, to recover the proper functioning of the LCD. Even an MCU reset would be eventually fine but I don't know how to check the LCD or i2c status.
Please note that I just started out and I have no background whatsoever so if you are so kind to reply, please keep this in mind.