AnsweredAssumed Answered

Code stuck on HAL_I2C_Mem_Write

Question asked by robber on Nov 16, 2016
Hello everyone, 
I'm using a STm32F407 that communicates with an eeprom throught I2C. Although most of the time it's working fine when i'm running the code with the debugger(i have the ST link/V2 ISO) often the code gets stuck in this function
while (HAL_I2C_Mem_Write(&hi2c1, uchEEPromAddress, Mem, I2C_MEMADD_SIZE_8BIT, (uint8_t*)(buff + t), TX_I2CBUFFERSIZE, 1000)!= HAL_OK)
  {
  GetError();  // gets stuck sometimes
  }
This function does not return HAL_OK and it does not Timeout either
I saw that the code gets stuck in the function 
/* Wait until BUSY flag is reset */
if(I2C_WaitOnFlagUntilTimeout(hi2c, I2C_FLAG_BUSY, SET, I2C_TIMEOUT_BUSY_FLAG) != HAL_OK)
{
  return HAL_BUSY;
}
Which is nested in the main HAL_I2C_Mem_Write function.

Any ideas ?

 

Outcomes