Other Parts Discussed in Thread: C2000WARE
In the I2C EEPROM example for F2808 provided, I am confused regarding the timing of code vs. what is actually happening and I am just looking for clarification.
The code in question is the following:
// Setup data to send
I2caRegs.I2CDXR = msg->MemoryHighAddr;
I2caRegs.I2CDXR = msg->MemoryLowAddr;
for (i=0; i<msg->NumOfBytes; i++)
{
I2caRegs.I2CDXR = *(msg->MsgBuffer+i);
}
/*
* Bit Field Value Description
* 14 FREE 1 action taken by the I2C module when a debugger breakpoint
* 13 STT 1 START condition bit
* 11 STP 1 STOP condition bit
* 10 MST 1 Master mode bit
* 9 TRX 1 Transmitter mode bit
* 5 IRS 1 I2C module reset bit
* 0110 1110 0010 0000
*/
// Send start as master transmitter
I2caRegs.I2CMDR.all = 0x6E20;
return I2C_SUCCESS;
Based on the documentation, when data is written to the I2CDXR register, it is then copied to the I2CXSR register and then bit shifted out on the SDA line. However, the Start, Stop and TRX bit are set after all the data has been bit shifted out the SDA line based on the 'for loop'. What mechanism stops/delays the bit shifting until the I2CMDR register is written to? Is there depth to the I2CDXR?