AnsweredAssumed Answered

M24SR I2C driver firmware

Question asked by conte.angelo on Jan 30, 2015
Hi,
I'm trying to port the provided I2C driver (file drv_I2C_M24SR.c) to another platform different from the stm32fx. I have take a careful look on that file and at function M24SR_ReciveI2Cresponse, at file line 334, the M24SR_I2C acknowledgment is disabled even if the in the data sheet there is no mention of such a request and the previous comment line states the opposite.
You can find it in last two lines of following code snippet

int8_t M24SR_ReceiveI2Cresponse ( uint8_t NbByte , uint8_t *pBuffer )
{
uint32_t M24SR_Timeout = M24SR_I2C_TIMEOUT/2;
uint8_t i=0,
                NthByte;
 
  /*!< Clear the M24SR_I2C AF flag */
  I2C_ClearFlag(M24SR_I2C, I2C_FLAG_AF);
 
  /*---------------------------- Transmission Phase ---------------------------*/
 
    /* &&&& MUST NOT BE INTERRUPTED TIMING IS CRITICAL INSIDE THIS SECTION &&&&& */
     
  /*!< Send M24SR_I2C START condition */
  I2C_GenerateSTART(M24SR_I2C, ENABLE);
     
      /*!< Enable M24SR_I2C acknowledgement if it is already disabled by other function */
  I2C_AcknowledgeConfig(M24SR_I2C, DISABLE);

The acknowledge is then enabled few line above after sending the slave address for write.
Is that acknowledge disable mandatory and why? Is it only a wrong comment?

I've found other probabily wrong comments on the code. Check line 313, 379, 412, 470.

Thank you
Angelo

Outcomes