CC3230SF: Error while use I2c and PWM both modules

Part Number: CC3230SF

Hi,

In my application, I am using I2C and PWM both modules but I observed that if I used both together I2C is failed (I am using I2C as an I2C_MODE_CALLBACK mode) I did not receive the interrupt in a callback function. but if I comment out the PWM module its works fine.

Can you just help me with what's going wrong here? OR is there any limitation that we are not using both in cc32xx if we are using both then what's the correct way?

  • Hi,

    There shouldn't be any limitation on using the I2C and PWM peripherals together, unless you're trying to use them on the same pin at the same time.

    Are you using your own custom board or are you developing with a CC32xx launchpad?

    Regards,

    Michael

  • Hi Michael,

    The pins are different and  I am using my own custom board..

    I am briefing you what happened here.

    1) I am using PWM module by

    PWM_Params_init();

    PWM_open();

    PWM_start();

    PWM_setDuty();

    PWM_stop();

    PWM_close();

    2) After that I am using I2C APIs at that i2C write is failed every time as I mentioned earlier I configure i2c as an I2C_MODE_CALLBACK mode.

    but If I Follow below steps then it works fine

    1) 

    PWM_Params_init();

    PWM_open();

    PWM_start();

    PWM_setDuty();

    PWM_stop();

    PWM_close();

    PWM_Params_init()

    PWM_open();

    2) and after that, if I use the I2c it works fine for me why this happen can help me on this

  • Hi,

    Hmm, trying out the same code on a launchpad might be worthwhile, to see if the issue is somehow tied to your custom board and its I2C setup. Do you have access to a CC32xx launchpad to try that out? If not, then perhaps I can test your code sequence to see what happens on a TI launchpad EVM.

    That being said, it seems like the code should work in both cases - it looks like the only extra step in your second code block is that you reopen the PWM after closing it.

    Is there a reason why you need to close the PWM? What happens if you simply leave it open in case 1 and don't call PWM_stop() and PWM_close() before running your I2C code?


    Regards,

    Michael

  • Hi,

    I just stop and close the PWM after I complete the work..Is it wrong steps to do this..should We leave it open?

  • Hi,

    If you do not need the PWM pins for another purpose and can keep them assigned to the PWM peripheral, then you should be able to keep it open. Of course stopping the PWM if your program doesn't actively need that output signal would save power, but otherwise you should be able to keep the PWM peripheral open and ready to use without any issues.

    If you keep the PWM open, but stopped, does the I2C work?


    Regards,
    Michael

  • Hi,

    I tested I2C is worked if I just stope the PWM and did not close it.

    But in my case, I want to close the PWM after its execution and re-open it before execution. but as I said if I do that then I2C is not working.
    Let me know whats the resolution for this.

  • Hi,

    From a code architecture perspective, is there a specific reason why there is the need to close the PWM after execution and then re-open it later?

    Assuming that the PWM is the only function of the pin assigned to it, then initializing the PWM at startup and then keeping it ready to start/stop throughout your code's execution should be acceptable, unless there is something I am misunderstanding about your use case.

    Regards,

    Michael

  • Hi,

    If not closing the PWM will cause an additional drain in LPDS mode?

  • Hi,

    When you call PWM_stop, that will not only stop the PWM signal generation but also reconfigure the pin as a GPIO output automatically. As such, it should not result in additional drain, assuming you set idleLevel at PWM_open correctly. Do you see any changes on your power measurement tool with PWM closed vs PWM stopped?

    Regards,
    Michael