Accessing other I2C ports on MOD54415

Discussion to talk about software related topics only.
barttech
Posts: 135
Joined: Fri Feb 20, 2009 12:59 pm

Re: Accessing other I2C ports on MOD54415

Post by barttech »

I guess when mbrown said:
"You shouldn't need to change any of your function calls, just include the new files. " I didn't realize that I could no longer use macros like I2C_SR in my own code. In i2cmaster.h that worked, but now I can see why it doesn't in the new multichanneli2c. So I can't just change the includes and get multi channel I2C functionality.
I used the macro I2C_SR (sim2.i2c0.i2sr) to use the status register to reset the bus. How should I do this with multichanneli2c? I can see that I can't just use sim2.i2c0.i2sr or I lose the multi channel ability. Should I use I2CMultiChannelResetPeripheral()?
Similarly with I2C_SR_BUSY (((0x20 & I2C_SR) == 0x20) expands to ((0x20 & sim2.i2c0.i2sr) == 0x20), how should I check that the busy is not busy?
Thanks,
Sam
User avatar
dciliske
Posts: 624
Joined: Mon Feb 06, 2012 9:37 am
Location: San Diego, CA
Contact:

Re: Accessing other I2C ports on MOD54415

Post by dciliske »

So, in the event you want to actually use the macros directly in your code, you'll want to define the i2cModule pointer. You should set it locally based on what channel you want to use. Remember, somehow the software needs to know which submodule your trying to use.
Dan Ciliske
Project Engineer
Netburner, Inc
jediengineer
Posts: 192
Joined: Mon Dec 17, 2012 6:24 am

Re: Accessing other I2C ports on MOD54415

Post by jediengineer »

I realize it's 2 years later, but has any of this been incorporated into the NNDK2.7.3? I need to use I2C 0 and I2C1 for a project and am hoping not to have to go through all these steps to use it... or change my board design.
sblair
Posts: 162
Joined: Mon Sep 12, 2011 1:54 pm

Re: Accessing other I2C ports on MOD54415

Post by sblair »

To answer your question, to my knowledge I don't believe anything has changed in this regard.
mbrown
Posts: 61
Joined: Tue Jan 29, 2013 7:12 pm

Re: Accessing other I2C ports on MOD54415

Post by mbrown »

The multichannel I2C drivers currently work in master only mode. You can use 0 and 1 or more modules. I believe the problem we were having with this thread dealt with the I2C macros I2C_SR and I2C_CR which require defining the pointer to i2cModule before use.

For instance, to use I2C_CR, you would just need the line of code

i2cModule = &sim2.i2c0;

or a similar pointer for any of the other macros.

If you want to avoid using the macros altogether, as most of us here in the office would, you don't even need to bother defining the i2cModule, just use the normal I2C functions with the added argument of the module number you'd like to talk to. Take a look at the multichanneli2c.h file to confirm how to pass in arguments.
Post Reply