AnsweredAssumed Answered

HAL_I2C_IsDeviceReady problem and others

Question asked by marco on May 3, 2016
Latest reply on May 10, 2016 by marco
It's normal that you send the timeout to this function and inside call I2C_WaitOnFlagUntilTimeout with I2C_TIMEOUT_BUSY_FLAG, ( 10 seconds ) ?

If not ready, this function block all for about 10 seconds indipendently from timeout setted

HAL_StatusTypeDef HAL_I2C_IsDeviceReady(I2C_HandleTypeDef *hi2c, uint16_t DevAddress, uint32_t Trials, uint32_t Timeout)
  uint32_t tickstart = 0, tmp1 = 0, tmp2 = 0, tmp3 = 0, I2C_Trials = 1;
  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) != HAL_OK)

Another problem is during HAL_I2C_MspInit(I2C_HandleTypeDef* hi2c), after the line 

/* Peripheral clock enable */

you can found setted (in random way) the bit BUSY of register I2C_SR2. 

Sorry for my english