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
Accessing other I2C ports on MOD54415
Re: Accessing other I2C ports on MOD54415
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
Project Engineer
Netburner, Inc
-
- Posts: 192
- Joined: Mon Dec 17, 2012 6:24 am
Re: Accessing other I2C ports on MOD54415
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.
Re: Accessing other I2C ports on MOD54415
To answer your question, to my knowledge I don't believe anything has changed in this regard.
Re: Accessing other I2C ports on MOD54415
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.
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.