Question
I2C problem, not getting the ACK bit
Posted on January 06, 2015 at 17:35
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 11101 This can be seen in the datasheet on the page In my case the value of CSB is zero.
http://www.meas-spec.com/downloads/MS5611-01BApdf
But the O-scope shows me different a picture:http://s1photobucket.com/user/esovo/media/Newfile1_zps0461710c.jpeg.html
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
#i2c-stm32-ms5611