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.

TM4C1237D5PM: How do you use TI-RTOS to configure a PWM module using the timer module

Part Number: TM4C1237D5PM
Other Parts Discussed in Thread: SYSBIOS

I have working code using the PWM modules and the drivers from TI-RTOS. Can the driver be used to send a PWM through the CCPx module. We prototyped with the TM4C123_EDK and our selected micro does not have the PWM module. We just need a simple pwm. 

  • Hello James,

    Going through the TI-RTOS drivers and BIOS I don't believe that is included. It looks like TI-RTOS uses the Timer peripheral to run the Clocks module of the SYS/BIOS.

    Depending how you are configuring your system, you may be able to find an unused Timer by the RTOS and do some manual TivaWare configuration. If you need to use an ISR though then it gets more complex and I would need to see what our prior RTOS expert had said about the issues with that. But it sounds like you can just set it and let it run so that may be possible.

    Best Regards,

    Ralph Jacobi

  • Maybe I didnt phrase the question right as I saw someone post source code before that looks like it did what I wanted. I just cant locate the code again. Basically the code had configured the TxCCPx module, and configured the PWM driver which used the PWM portion of the TxCCPx module. It allowed the TI-RTOS driver to create a PWM when it did not contain a PWM module.

  • So I guess my question is if there is any way to use the TI-Rtos static congiguration or apis to handle the PWM for TM4C1237 that does not have a dedicated PWM module but has PWM through the GPTM Module TxCCPx.

  • Hi James,

    There is not a way that I can see for this.

    What you saw is likely someone in adding in that capability and posting how they got it working which is certainly possible to do. Though I can't find anything for the timer, just posts using the PWM module.

    Best Regards,

    Ralph Jacobi

  • Can the PWM be setup by TivaWare for the timer? Or am I working from scrath for this. Were can I find an example?

  • Hello James,

    Yep! TivaWare can be downloaded from: https://www.ti.com/tool/SW-TM4C

    You can find the example we have for this at: C:\ti\TivaWare_C_Series-2.2.0.295\examples\peripherals\timer\pwm.c

    TI-RTOS uses an older version of TivaWare as the base drivers but I don't think any of those APIs would have changed.

    Best Regards,

    Ralph Jacobi

  • I am going to look into it more, but it looks like there ia s driver for PWM through timer in TI-RTOS. Include file is PWMTimerTiva.h in the RTOS folder. Not sure why it wasnt showing up in the documentation.

  • Hi James,

    Interesting, that does look promising. Without any documentation behind it, it makes me think perhaps it may not have been fully tested/validated. But I think that should give you a strong stand point to start working from.

    If it is working right though, it seems to be pretty robust:

     * Creating a PWM instance will make the corresponding timer unavailable to the
     * TI-RTOS kernel until the PWM instance is closed. Additionally, if the
     * required timer is already used by the kernel, the PWM instance will not be
     * opened.

    It looks like the kernelTimerID variable passed in will determine a lot of that.

    Best Regards,

    Ralph Jacobi

  • Ok code works so I am good. Basically looks like it uses the same PWM calls it was before but redirects them to use the timer module. Had to change the sysbios clock tick but now seems good. They should note this in the documentation that there is some code to look at to generate the PWM from timers even if its untested.