Bare metal i2c

Hi,

I am trying to read files from the MMC using a bare metal program that I am attempting to write. I understand that I have to enable power to the MMC first and need to communicate with the power management chip to do so. The communication is via the i2c bus. I am writing a routine to send and receive bytes over the i2c, however, I just do not know if something is working or not. Do I need to keep programming blindly for this?

Any tips on debugging at this stage of bare metal programming?

Thank you,
Bharath.

Hi Bharath,

Can you toggle leds D12 ("LEDB/VIBRA.M" - G15 pin) or D14 (through
TL1963A, "LEDA/VIBRA.P" - F15 pin) through TPS65950 registers? If you
can toggle these leds than your bare metal i2c program works. :slight_smile:

Cheers,
Max.

Thanks that was a useful suggestion. I had not noticed the 3rd LED hidden near the power jack. However, LEDA is not implemented on the Rev C3.

However, I now have some other troubles. I am trying to read the vendor ID from the power management chip and am attempting to send the address to the chip. I have implemented the code to run the flowchart figure 18-29 from the spruf98r(http://focus.ti.com/lit/ug/spruf98r/spruf98r.pdf). However, when I try to send one byte and write the I2C_CNT register 1 and read it, I read the value 2. So, after transmitting 1 byte, I do not get the ARDY flag go up, nor do I get the XRD flag go up and end up in an infinite loop.

Why do I read I2C_CNT as 2, immediately after I write 1 to it? And after sending a byte, the I2C_CNT reads as 1, but never becomes 0.

Thank you.