cancel
Showing results for 
Search instead for 
Did you mean: 

why need so many timeout

David.Cheng
Associate II
void sEE_ReadBuffer(uint8_t* pBuffer, uint16_t ReadAddr, uint16_t* NumByteToRead)
{
  //__IO uint32_t timeout = 0xFFFF;
  __IO uint32_t timeout = 0xFF;
  /*!< Wait the end of last communication */
  for (;timeout > 0; timeout--);
 
  /* Set the pointer to the Number of data to be read. This pointer will be used
      by the DMA Transfer Complete interrupt Handler in order to reset the 
      variable to 0. User should check on this variable in order to know if the 
      DMA transfer has been completed or not. */
  sEEDataReadPointer = NumByteToRead;
 
  /*!< While the bus is busy */
  while (I2C_GetFlagStatus(sEE_I2C, I2C_FLAG_BUSY))

this is std library example code from st office

1 REPLY 1

I guess it's because I2C slaves may sometimes fail to answer/acknowledge, so that the routine won't hang indefinitely?

JW