This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC3220SF: Setting I2C bitrate to 50kHz

Part Number: CC3220SF
Other Parts Discussed in Thread: SYSCONFIG, , CC3200

I have an I2C device that is prone to errors when the bit rate is set to 100kHz.  I am using the I2C interface used for the example programs and there isn't an enum for setting a speed lower than 100kHz.  Is there another interface or process I can use to get to 50kHz? 

  • Hi David,

    The CC3220 only supports two I2C bit rates: 100 and 400 Kbps, as documented in the datasheet and TI Drivers API guide.

    Best regards,

    Sarah

  • Hi David,

    CC32xx I2C peripherial supports wide range of baudrates (if I am not wrong, capabilities are at range ~20kHz to ~2MHz). But there is no support for setup such speed by TI drivers or driverlib. But you can setup baudrate directly via registers - see TRM.

    Jan

  • The CC3220 SDK doesn't have any examples of how I can use those registers.  Do you know where I can find the entry point?  If I can use those registers, do you know if I can use them in together with the ti drivers and SysConfig?  Is there a protocol for changing registers while using those interfaces?

    Thank you for your time,

    David

  • Hi David,

    There is no example how to set custom baud-rate for I2C using TI Drivers and Sysconfig. Because there is no direct support inside this wrapper layers. In case of you set custom baudrate for I2C peripheral initially configured by Sysconfig, it maybe can cause some side-effects especially when power save modes are used. Implementation will be up to you.

    Useful resources:

    • CC3220 registers are described at TRM chapter 7.
    • See implementation inside driverlib \source\ti\devices\cc32xx\driverlib\i2c.c and function I2CMasterInitExpClk()

    Jan

  • I found the file you mentioned in my CCS project.  However, when I added a break point to debug, it says the code isn't in any loaded symbols, so it seems like this file doesn't get loaded in my project.  I used the search tool to find the I2CMasterInitExpClk() function and CCS couldn't find it anywhere even though I can see it in the directory in the project explorer. So it seems like the ti drivers don't use that file to set the registers for the clock.

    I see the file you mentioned has a function for modifying registers, but I don't know how to get the information for the base address or the address for the i2c register because opening the declaration doesn't lead anywhere.  Are there any examples for working at this level?  It seems like all the examples I can find in the SDK are for the high level and not at this low level stuff.  I also don't know how to view the registers in the debugger, so I'm flying blind.   It seems like the debugger for the ARM devices is different from the MSP430.  Any advice is much appreciated.

    Thank you for your time,

    David

  • Hi David,

    Yes, it is expected that breakpoint inside files at \source\ti\devices\cc32xx\driverlib\ cannot work. TI drivers uses internally driverlib functions like a I2CMasterInitExpClk(). There are using drivelib functions from CC32xx ROM. For more details please see help file \docs\cc32xx\CC32xx_ROM_services.html.

    Base address for each peripheral you find at TRM. For example for I2C it is 0x40020000 (I2CA0_BASE at header file hw_memmap.h). There is no examples how to use direct register access of driverlib driver inside CC32xx SDK. This is reason why you got such answer from Sarah above (no examples inside SDK and no direct support from TI side). If you want to see content of I2C registers during debug, you can use memory view at particular address of register. If you want to see I2C examples with driverlib, you can check i2c example inside CC3200 SDK (SDK for previous generation of devices - CC3200). Be aware that this SDK is not compatible with CC3220SF. I2C peripheral is same at CC3200 and CC3220SF and you can use that code for inspiration.

    I think you have two options:

    • use Sysconfig and TI-Drivers. And after initialisation try to re-configure baudrate of I2C peripheral like at function I2CMasterInitExpClk(). Re-configuration after exiting power save mode may to be required as well. Important thing is dig deeper into TI-Drivers I2C peripheral initialisation to be sure that are no unwanted side-efects.
    • do not use Sysconfig and TI-Drviers for I2C. Use driverlib directly (like example inside CC3200 SDK) and instead of function I2CMasterInitExpClk() directly write into registers. This way may to less problematic. Some other samples of code you can find at e2e forum at discussions about I2C for CC3200.

    Jan

  • If anyone else has this issue, I was able to change the baud rate. However changing likely tripped something in the power saver modules and went into an infinite loop.  It seems really complicated to try to make it work that way, so if you want to manually change registers, don't mix it with the TI drivers.  My whole project scope relies on the simplicity of those drivers, so I'm going to have to look at other devices.