Rohit Girme

Programming I2C module on mCF5485

Discussion created by Rohit Girme on Aug 6, 2009
Latest reply on Aug 14, 2009 by yevgenit

Hello, I am trying to connect an I2C device to the MCF5485. I want to read data from the device. Basically i want to write a device driver for that device. I have read the reference manual of the processor. I have inferred the following:The processor should be in master mode.


First I need to initialize the I2C module.


set correct value in I2FDR for SCL.


question: How do I address I2FDR? How so I set the I2FDR to a particular value?Will I2FDR = 0x36 work? I want the clock frequency to be 400KHz. Should I set I2FDR with 0x36 or 0x37?


set I2CR.


question : How do I address single bit in this register? I want the processor to be in Master mode, it will receive data from I2C device. But while transmitting device address, does the processor need to be in transmitter mode and then switch to receiver mode? What about acknowledge signal? Do i have to generate it every time or it is generated automatically?


Do dummy read of I2DR.


set I2SR.


start reading data from I2DR.


question: Do i need to set and clear any flag/bit from I2SR while reading data from I2DR?


Am I right about the above procedure? if not please let me know the correct procedure.

Thank you,