A few days ago I asked about sample code for I2C in the U-boot sources, and was pointed to it.
I still have problems, and would like some guidance. When I take the controller out of reset, I find that the bus is busy, and the condition does not clear up even after waiting. If I go ahead and try to start a slave selection anyway, arbitration fails (not surprising).
I am using the P1010-RDB reference design board for my software development.
After system reset, I find the registers contain (as expected):
I2C_ADR = 00
I2C_FDR = 00
I2C_CR = 00
I2C_SR = 0x81 = MCF + RXAK
I2C_DR = 00
I2C_DFSRR = 0x10
In my initialization routine, I set
I2C_FDR = 0x15 (with CCB clock at 400 MHz, that should yield an I2C clock at just under 2 kHz)
I2C_CR = 0x80
I now find that
I2C_SR = 0xA1 = MCF + MBB + RXAK
Where did the MBB (Bus Busy) come from ? How do I clear it ?
Am I supposed to set MSTA then clear it at initialization time ?
Message was edited by: Lars Poulsen I have attached the source code of my failing driver.
After initialization I get:
I2C Port 0 Interface Status
Registers: Adr=00
FDR=07 factor=1024 freq=195312
CR =80 MEN
SR =B3 MCF MBB MAL MIF RXAK
DR =00
DFSRR=10
Data: State=00 RESET
I2C Port 1 Interface Status
Registers: Adr=00
FDR=07 factor=1024 freq=195312
CR =80 MEN
SR =86 MCF SRW MIF
DR =FF
DFSRR=10
Data: State=00 RESET
Anyone have ideas ?
Original Attachment has been moved to: p10_i2c.c.zip
Look at attached file. It is simple I2C example for the MPC8349. The P1010 I2C is similar to the MPC8349 I2C. Compare your code and this simple program example.
Have a great day,
Pavel Chubakov
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------