Hello,
The module 12 of the following resource is for I2C communication.
The example codes for I2C communication just poll ARDY and never check if the receiver had actually acknowledged it, Why is that so?
This is what is done:
I2caRegs.I2CCNT = 1; // 1 byte message
I2caRegs.I2CDXR = POINTER_TEMPERATURE;
I2caRegs.I2CMDR.all = 0x6620; // master-receiver, START, STOP
while(I2caRegs.I2CSTR.bit.ARDY == 0); // poll ARDY- wait for STOP condition
After this, the next transmission starts.
So, without checking (or polling) for ACK bit, the next transmission is started. Why is that?
Everywhere, it has been told that if the slave device does not acknowledge the transfer, then the next data/ transfer can not be initiated. But the example code doesn't do that. So, isn't that supposed to be wrong since we will never know if the receiver had actually received it?