Other Parts Discussed in Thread: C2000WARE
Hi,
I develop a driver for eeprom 24LC01B. The end of writing data is detected by polling. For this purpose only control byte should be sent without data. The result of test is depending on ACK presence.
There are two cases:
1) when internal write to eeprom is unfinished - this case I can handle, I detect NACK properly and force to generate STOP on i2c,
2) when the write operation is completed - this is the problem:
a. i2c does not generate STOP despite of ACK and empty data buffer,
b. no ARDY is signalled, so I cannot detect it and force STOP
Due to software requirements I cannot use interrupts, so I check I2CSTR register periodically.
In this region of interest I have read following sequence of the register values:
0: start of i2c transmission,
~0: 0x410 (XSMT = transmit shift register empty, XRDY = transmit data ready)
39us: end of ttransmission
44us: ack
no further activity on i2c lines
68us: 0x1010 ( BB = bus busy, XRDY)
101us: 0x0410 ( XSMT, XRDY)
164us: 0x1010
202us: 0x0410
...
I2c configuration
I use fifo for i2c transmission:
i2cregs->I2CFFTX.bit.I2CFFEN = 1;
i2cregs->I2CFFTX.bit.TXFFRST = 1;
Start of transmission:
i2cregs->I2CCNT = 0
no writes to fifo for this message
i2cregs->I2CMDR.all = I2CMDR_MST_MASK
| I2CMDR_IRS_MASK
| I2CMDR_TRX_MASK
| I2CMDR_STT_MASK
| I2CMDR_STP_MASK;
Why STOP condition nor ARDY are generated?
Regards,
Piotr Romaniuk