cancel
Showing results for 
Search instead for 
Did you mean: 

Is this a HAL IIC bug?

Junde
Senior III

Hi there,

I drove 4 SHT4x by STM32G473VE and used the HAL_I2C_Master_Transmit() and HAL_I2C_Master_Receive() to write and read the sensors.

Normally, everything is well.

However, if I

  1. unplug the sensor;
  2. replug the sensor again;(Not the sensor maybe can NOT work normally)
  3. reset the MCU;

the program will probably run into  the following dead loop:

Junde_0-1736739151853.png

I don't know why this happened, and how I can recover from this error state.

Thank you!

 

2 REPLIES 2
Saket_Om
ST Employee

Hello @Junde 

 

Have you tried checking the device with the HAL_I2C_IsDeviceReady() API after unplugging and replugging it?

Could you provide the data transmission trace using the logic analyzer?

 

If your question is answered, please close this topic by clicking "Accept as Solution".

Thanks
Omar