Hello,
This problem has been previously mentioned, but not totoally answered my confusion.
In this demo, the varible "temp" is combined as
And further, the "temp" is sent out by the following operation:
for(i=I2C_Params->NumOfAddrBytes-1;i>=0;i--)
{
I2C_putData(base, (temp >> (i*8U)) & 0xFF);
}
However, in this demo, the I2C_Params->NumOfAddrBytes is 2.
Hence, there are totally twice cycle operations:
first time the "temp" is right shifed with 8 bits, and the "High 8bits" are sent out.
Second time, "temp" is right shifted with 0 bit, and the "low 8bits" are sent out.
As for the “NumOfDataBytes”, there is totally no operation on it.
I don't know where is wrong.
Another concern is that the datas are sent out and further the transmit FIFO Interrupt is triggered.
But the FIFO level for transmit and receive are 0 and 2.
I2C_setFIFOInterruptLevel(I2CA_BASE, I2C_FIFO_TXEMPTY, I2C_FIFO_RX2);
How to understand the 0 transmit FIFO level? In handbook, it is said that "The transmit FIFO can be configured to generate an interrupt after
transmitting a defined number of bytes". Here the defined unmber of bytes is 0?