Hi Sivaraj,
The customer has come back with the following that they were able to get the system working. However there is some issues with the RRDY flag. Please help/advise:
"
All is working okay except I cannot clear the RRDY flag once it is set.
I am invoking multiple calls to the driver and the first call is fine, it polls on (RRDY == 1), but when I try to clear RRDY for future transactions, it won't clear.
My understanding of how RRDY works is as follows:
- RRDY flag is set when the contents of RX FIFO buffer >= FIFO THRSH
- RRDY flag is cleared by writing a 1 to the RRDY bit in I2C_IRQSTATUS_RAW
- RRDY flag will be re-asserted if the contents of RX FIFO buffer >= FIFO THRSH
So, RRDY *should* be cleared with the following sequence:
- RX THRSH = 2 (I2C_BUF |= (1 << 8))
- Read both bytes
- Just in case, I clear Tx and Rx FIFOs (I2C_BUF) |= 0x4040)
- Clear flag (I2C_IRQSTATUS_RAW &= I2C_IRQSTATUS_RAW_RRDY)
- Note that I2C_BUFSTAT = 0x8002, so the RX FIFO is empty, therefore RRDY should not be re-asserted (unless I am mistaken)
So, what am I doing wrong, here? Why can I not clear the RRDY flag?
"