cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Mem_Read, no NAK send out

Ganesh-K-Grg
Associate II

Hi There,

While reading the data from I2C, I see that the master is missing to send NACK.

Some fixed was done in https://github.com/STMicroelectronics/STM32CubeF4/issues/139 but those fixes are there in the code. But still sometime i see that NACK not being send out and slave pull the SDA line to low.

 

Screenshot 2024-05-30 140540.png

 

Is there any fix on this one?

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Imen.D ,

I think i already have STM32CubeF4 V1.28.0 version.

 

GaneshKGrg_0-1717141952564.png

 

View solution in original post

3 REPLIES 3
Imen.D
ST Employee

Hello @Ganesh-K-Grg and welcome to the Community,

Th issue has been fixed and released on STM32CubeF4 V1.28.0

So, please make sure to update the I2C HAL driver and use the fix and improvement within the STM32CubeF4 V1.28.0.

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

Hi @Imen.D ,

I think i already have STM32CubeF4 V1.28.0 version.

 

GaneshKGrg_0-1717141952564.png

 

Hi @Imen.D ,

 

After a long run test, what i found was not the HAL_BUSY. It is about the HAL_ERROR. Seems like BTF flag was not set.I put the break point in below code. What could be the reason of BTF not been set? Is it noise on the signal or something else. But when i see in oscilloscope, there are some spike on ACK. See in above image.

 

 

 /* 3 Last bytes */
        else
        {
          /* Wait until BTF flag is set */
          if (I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_BTF, RESET, Timeout, tickstart) != HAL_OK)
          {
            return HAL_ERROR;
          }

          /* Disable Acknowledge */
          CLEAR_BIT(hi2c->Instance->CR1, I2C_CR1_ACK);