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.

TM4C1294NCPDT: Is it possible to run the PWM peripheral at a period between 1 and 2 microseconds

Part Number: TM4C1294NCPDT

Hi,

I'm using TIRTOS 2.16 and TivaWare 2.1.4. It seems the lowest I can set the period with PWM_open is 1 microsecond. I'm driving LEDs that have a spec that respond to a period of 1.2 microseconds. I was wondering if there's a way that I can set the period to 1.2 microseconds or make the period based on clock ticks rather than time?

Thanks,

Max

  • The timing I'm attempting to achieve: 

  • Seemingly if I change PWMGenPeriodSet(hwAttrs->baseAddr, pwmGenerator, (tempPeriod / prescalar)); in PWMTiva.h to PWMGenPeriodSet(hwAttrs->baseAddr, pwmGenerator, 144)); while the program is running, I can achieve these results. Is there a way to do this from a higher level?

  • Hi Max,

    It seems the lowest I can set the period with PWM_open is 1 microsecond. I'm driving LEDs that have a spec that respond to a period of 1.2 microseconds. I was wondering if there's a way that I can set the period to 1.2 microseconds or make the period based on clock ticks rather than time?

      TI-RTOS PWM driver does not take clock ticks as the counter load value but rather as you have tried, only absolute time in terms of microsecond increment. The period (in terms of microsecond) that you input will be converted into cycles for the PMWLOAD register and also adjust for the clock divider in PWMDIV register. 

    typedef struct PWM_Params {
        uint32_t     period;         /*!< PWM period in microseconds */
        PWM_DutyMode dutyMode;       /*!< Units which duty is specified */
        PWM_Polarity polarity;       /*!< Set duty active high or active low */
        uintptr_t    custom;         /*!< Custom argument used by driver
                                          implementation */
    } PWM_Params;

    Seemingly if I change PWMGenPeriodSet(hwAttrs->baseAddr, pwmGenerator, (tempPeriod / prescalar)); in PWMTiva.h to PWMGenPeriodSet(hwAttrs->baseAddr, pwmGenerator, 144)); while the program is running, I can achieve these results. Is there a way to do this from a higher level?

    Yes, if you use the TivaWare API then it will give you more control and be able to fine tune the PWM period. I don't see a way to do this at TI-RTOS driver level.