I2C Vybrid Code?

cancel
Showing results for 
Search instead for 
Did you mean: 

I2C Vybrid Code?

Jump to solution
872 Views
Contributor III

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

0 Kudos
1 Solution
178 Views
Contributor III

oops, never mind.  I see the #define in MVF50GS10MK50.h (I2C0) which I'll use as the parm, Chris

View solution in original post

0 Kudos
4 Replies
178 Views
NXP Employee
NXP Employee

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.

0 Kudos
178 Views
Contributor III

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?

0 Kudos
179 Views
Contributor III

oops, never mind.  I see the #define in MVF50GS10MK50.h (I2C0) which I'll use as the parm, Chris

View solution in original post

0 Kudos
178 Views
Contributor III

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

0 Kudos