cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_I2C_Master_Transmit(..) Wrong return value?

MWebe.12
Associate

I have a question concerning the stm32f4xx_hal_i2c.c. In the function HAL_StatusTypeDef HAL_I2C_Master_Transmit(..) there is the following code sequence.

uint32_t tickstart = 0x00U;

 /* Init tickstart for timeout management*/

 tickstart = HAL_GetTick();

 if(hi2c->State == HAL_I2C_STATE_READY)

 {

  /* Wait until BUSY flag is reset */

  if(I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG, tickstart) != HAL_OK)

  {

   return HAL_BUSY; -> return HAL_TIMEOUT

  }

In my opinion instead of return HAL_BUSY it should return HAL_TIMEOUT because the function I2C_WaitOnFlagUntilTimeout checks for the timout to occur.

Can you please verify that and response to my question.

Thanks!

0 REPLIES 0