Message Edited by airswit on 05-13-200601:00 AM
Now,I use M52233 Demo Board + 24LC256.
I use Coldfire Lite for web server.
Can use this code for read/write 24LC256.?
I try many time.
It printf to terminal
initialization start!
initialization complete!
data = 0xFF
data = 0xFF
data = 0xFF
data = 0xFF
data = 0xFF
data = 0xFF
data = 0xFF
data = 0xFF
Hi Trevor
I didn't check your code (since I haven't actually used the IIC controller on the Coldfire yet) but do have a suggestion as to what you could quickly check.
How have you defined the status registers (such as MCF_I2C_I2SR) which you are polling to see when each step has completed? Check that they are indeed defined as "volatile".
The CW will typically optimise the code (when volatile is not used) to read the location once and use the same value for subsequent 'polling'. It may then get stuck in a polling loop. Typically it is obvious that this is happening when a routine like that gets stuck when run at full speed but it walks through with the debugger. as the flags are set fast enough at each step.
Maybe it's as simple as that? Otherwise I hope you can solve it - IIC is not that complicated if you are only doing single master transferes and is more convenient that SPI for multiple slaves - so weather it out - it will be worth it.
Regards
Mark Butcher
www.mjbc.ch
Hi Trevor,
Which ColdFire device?
I'm not an i2c expert (or even novice) but can point you to some example code for i2c that is on the Freescale web site along with appnotes:
https://www.freescale.com/webapp/Download?colCode=MPC860COD12&appType=license&location=null&srch=1
http://www.freescale.com/webapp/sps/site/overview.jsp?code=8BITAPPNOTEIIC&srch=1
Regards, DavidS