Skip to main content
Graduate II
January 13, 2025
Question

Is this a HAL IIC bug?

  • January 13, 2025
  • 2 replies
  • 693 views

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!

 

    This topic has been closed for replies.

    2 replies

    Technical Moderator
    January 13, 2025

    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?

     

    Super User
    January 13, 2025