AnsweredAssumed Answered

I2C problem, not getting the ACK bit

Question asked by t.a on Jan 6, 2015
Latest reply on Jan 31, 2015 by t.a
Hello,

I am trying to communicate with the Barometric sensor MS5611, using the I2C protocol. My micro is STM32f3discovery. The address of the sensor is send, but not the command. The code is stucked in the while loop waiting for TXIE bit to be set. The reason why TXIE is not "one", is because the acknowledge bit from the MS5611 is not showing up. Also the I2C status register is setting the NACK (not acknowledge), STOPF (stop flag) bit.

The address of the MS5611 sensor is 11101100. This can be seen in the datasheet on the page 12. In my case the value of CSB is zero.

Datasheet MS5611

But the O-scope shows me different a picture:

Newfile1.jpeg

here is the code for reseting the sensor:

#define ADDR_W              0xEC      // device address + write mode
 
void Alti_reset( uint8_t ComandAddr)
{
  /* Test on BUSY Flag */
  while(I2C_GetFlagStatus(I2C1, I2C_ISR_BUSY) != RESET);
   
  /* Configure slave address, nbytes, reload, end mode and start or stop generation */ 
    I2C_TransferHandling(I2C1, ADDR_W, 1, I2C_AutoEnd_Mode, I2C_CR2_START); // I2C_Reload_Mode
     
  /* Wait until TXIS flag is set */
  while(I2C_GetFlagStatus(I2C1, I2C_ISR_TXIS) == RESET); //  I2C_ISR_TXE)
   
  /* Send Register address */
  I2C_SendData(I2C1, (uint8_t) ComandAddr);
   
       
  /* Wait until STOPF flag is set */
  while(I2C_GetFlagStatus(LSM303DLHC_I2C, I2C_ISR_STOPF) == RESET);
   
  /* Clear STOPF flag */
  I2C_ClearFlag(I2C1, I2C_ICR_STOPCF);
}


So, What I am missing? ... TNX

Outcomes