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.
Hi Champ,
May I consult how to recognize the received bytes in repeated START when coding in I2C ?
My thought is to determine the AAS bit in I2CSTR Register is cleared to 0 in 7-bit addressing mode every time when receiving a repeated START.
When checking the AAS bit turns 0 to 1, I could tell this is a address byte. May I correct ?
Is there another way to recognize the received bytes is an address byte or a data byte when coding ?
Second question is if the way works, what about 10-bit addressing mode ?
The datasheet doesn't show the AAS bit cleared to 0 when receiving a repeated START. Or is the datasheet missing writing this?
Thanks
BR, Johnny
Johnny,
Irrespective of whether you are in 7-bit addressing / 10-bit addressing mode, I2C acknowledge if it sees its address called in the I2C bus and sets "Addressed as Slave" bit. According to I2C protocol, 1st byte received is the address and it doesn't get stored in I2CDRR register (or) I2CFFRX register as I2C automatically recognizes it was address and not data.
In the 7-bit addressing mode, the AAS bit is cleared when receiving a NACK, a STOP condition, or a repeated START condition.
In the 10-bit addressing mode, the AAS bit is cleared when receiving a NACK, a STOP condition, or by a slave address different from the I2C peripheral's own slave address
Regards,
Manoj
Hi Manoj,
Thanks for your explanation of the way I2C could recognize the received byte automatically.
So in 10-bit addressing mode, the way I proposed couldn't tell the received bytes when receiving a repeated START because the AAS bit won't be cleaned to 0, and keep the bit to 1 from the beginning to end, may I correct ?
Thanks !
BR, Johnny
Johnny,
If the repeated START gets generated same slave address as before, then AAS will be set from START to fnish
If the repeated START gets generated for different slave address, then AAS bit get cleared.
Regards,
Manoj