cancel
Showing results for 
Search instead for 
Did you mean: 

SMBus blocked and how to recover it

LsnLeeJW
Associate II

Hi ST tesam,

When I use the HAL of STM32C031, I have some trouble about SMBus.

Q1:When I use the SMBus of STM32C031 series. If I do not got the feedback from the slave, sometimes the SDA will pull down(similar to the yellow line show as below) and system was blocked. How can I do to end this communication and recover SMBus.

LsnLeeJW_0-1719216894031.png

    HAL_SMBUS_Master_Transmit_IT( &hsmbus1, BATTERY_ADD, &ucCalTemp[ 1 ], 1, 
                                  SMBUS_FIRST_FRAME );
        while (hsmbus1.State == HAL_SMBUS_STATE_MASTER_BUSY_TX)
        {
            uOverT--;
            if(uOverT == 0)
            {
                //HERE I want to recover the SMBus              
                }
                return HAL_ERROR;
            }
       }

 

Q2: If I got a NACK signal , How can I do to send a ‘STOP’ signal. Is there any function I can use if I do not re-initial the pin to GPIO_OUT mode. And how can I do to detect the NACK. (could I use the function HAL_SMBUS_EV_IRQHandler to detect it.)

 

Thanks for your help.

 

 

0 REPLIES 0