I've searched the extranet and MQX sample code and I can't identify any I2C code that use the actual registers identified in MVF50GS10MK50.h. Does any exist? I want to make sure before I start writing new code to the raw I2C regs. Polling or interrupt driven is fine. Thanks, Chris
Solved! Go to Solution.
oops, never mind. I see the #define in MVF50GS10MK50.h (I2C0) which I'll use as the parm, Chris
Hi Chris,
Please take a look at this thread and it should have what you're looking for: https://community.freescale.com/thread/305795
We'll add that to the sample code in a future release.
Nice simple driver. I like it. The usage of I2C_Type * could be a bit tricky in terms of how I map the hardware address of the I2C peripheral to the structure. Do you know where the example calling code is?
oops, never mind. I see the #define in MVF50GS10MK50.h (I2C0) which I'll use as the parm, Chris
The LCD I2C code that Anthony was good enough to share was a great starting point for my I2C master driver. It was VERY helpful to have a working example. I think I added some value and took the code to the next level. New features:
- Replace the "byte shifting complete" timing loop with a loop waiting on the hardware indication (the user no longer needs to adjust the timing loop for local CPU clock speed, except for the IBFD value which I haven't had time to figure out, math-wise, it works, I kept going)
- Same with stop condition asserted (don't start another transfer until last one is really stopped, now transfers are closely spaced without timing risk)
- Multi-byte write allowed to a reg number (allows efficient filter table loading into a codec for example)
i2c.h and i2c_vybrid.c form the core package. vybrid_i2c.h are the I2C peripheral register defines. adc3101.c is an example using this new code.
Just trying to give back to the community. Maybe I can save someone else some code development time. I've done a good amount of testing and have verified the low-level operation on a logic analyzer.
Enjoy, Chris