Hello,
I am trying to get the I2C peripheral working on a DM6435. I started using the PSP drivers, but found that they frequently fail as soon as any abnormal condition occurs (for example, it gets stuck when the address is NACKed in a one-byte transfer (i.e. the address would be followed by a single byte only), it simply crashes (stack corruption) when a timeout occurs, ...).
I started modifying the driver, but the documentation (spru991e.pdf) leaves many details unspecified. Ultimately, the driver would have to support multi-master operation. I wonder if anyone could help me with the following questions:
- The note in 2.1 seems to imply that the individual roles (master/slave) are only meaningful during a transfer (which makes sense). However, there are different initialization procedures for masters and slaves. In a multi-master environment, should I stay in slave-receiver mode when idle? I guess I should.
- My understanding is that the device should be set in reset (ICMDR.IRS = 0) whenever it is reconfigured. Does that include setting up transfers (e.g., writing to ICCNT or ICMDR.STT/STP...)?
- Otherwise, are ICPSC, ICCLKH, and ICCLKL the only affected registers?
- Does the I2C peripheral watch the bus for other masters while it is reset (ICMDR.IRS = 0)?
- If the answer to 2 is yes and the answer to 3 is no, how am I supposed to start a transfer in a multi-master environment?
- Does setting IRS to 0 reset any other register except ICSTR? (The PSP driver goes through hoops to save ICCNT and ICCLKL/H, among others.)
- Does setting IRS to 0 clear all pending interrupts?
- spru991 contains contradicting information on what happens when ICMDR.STT is set to 1 while BB=1: 2.5 says "A repeated START condition generates when BB is set to 1 and STT is also set to 1." while Table 7 (description of ICSTR) says that AL is set and the device goes into slave-receiver mode if "The I2C attempts to start a transfer while the BB (bus busy) bit is set to 1". I guess the behavior depends on who's owning the bus?
- Will the device recognize its own address in a transfer during which it lost the arbitration?
- As a master, how can I safely abort a transfer without potentially blocking the bus? Is it safe to set ICMDR.STP=1 and ICMDR.RM = 1?
I guess that's all at the moment.
Thanks a lot
Markus