This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

I2C master ACK

Dear All,

I will connect MS4525DO pressure sensor via I2c. this sensor respond with four bytes .

the protocol is working as follow :

1- start condition : device salve address [6:0] - Read/Write bit (read=1)

2- wait for slave ACK

3-read  the first byte : 2 status bits - 6 pressure bits [13:8] 

4-master ACK

5-when the slave receive the master ACK, then it  will send the second byte ; read the second byte : 8 pressure bits[7:0]

6-master ACK

7-read the third byte ; 8 temprature bits [10:3]

8- master ACK

9- read the forth byte ;3 temperature bits [2:0] and the others bits are don't care

10- master NACK

so here is the code for reading 4 bytes :

ROM_I2CMasterSlaveAddrSet(I2C1_BASE, slave_addr, true); // read operation

I2CMasterControl (I2C1_BASE, I2C_MASTER_CMD_BURST_RECEIVE_START); //

// ROM_SysCtlDelay((ui32SysClkFreq / 3) * (1 / 1000.0f));//time_in_ms  // just for polling as the tm4c129 is 120mhz and fast

while (I2CMasterBusy(I2C1_BASE)); //Wait till end of transaction


L1 = (uint8_t)(I2CMasterDataGet (I2C1_BASE)); //Read from FIFO (1st byte)



I2CMasterControl (I2C1_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); 

//ROM_SysCtlDelay((ui32SysClkFreq / 3) * (5 / 1000.0f));//time_in_ms

while (I2CMasterBusy(I2C1_BASE)); //Wait till end of transaction
L2 = (uint8_t)(I2CMasterDataGet (I2C1_BASE)); //Read from FIFO' ( read the second byte)

I2CMasterControl (I2C1_BASE, I2C_MASTER_CMD_BURST_RECEIVE_CONT); 

//ROM_SysCtlDelay((ui32SysClkFreq / 3) * (5 / 1000.0f));//time_in_ms

while (I2CMasterBusy(I2C1_BASE)); //Wait till end of transaction
L3 = (uint8_t)(I2CMasterDataGet (I2C1_BASE)); //Read from FIFO (Read the 3rd Byte)

I2CMasterControl (I2C1_BASE, I2C_MASTER_CMD_BURST_RECEIVE_FINISH); //Read the 2nd Byte

//ROM_SysCtlDelay((ui32SysClkFreq / 3) * (5 / 1000.0f));//time_in_ms

while (I2CMasterBusy(I2C1_BASE)); //Wait till end of transaction

//Wait till end of transaction

L4 = (uint8_t)(I2CMasterDataGet (I2C1_BASE)); //Read from FIFO (Read the 4th Byte)



now my problem is with "Master ACK"

does the "I2C_MASTER_CMD_BURST_RECEIVE_CONT" send the ack to the slave to send the next byte , and the I2C_MASTER_CMD_BURST_RECEIVE_FINISH send NACK or not?

or how can I send Master ACK ? 

is the code characterized the protocol ?