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.

tirtos system clock

Other Parts Discussed in Thread: TM4C123GH6PM

I am use the CCS6.1 and the launch Pad is TM4C123GH6PM.I want to change the PWM frequency to 250KHz with the duty range can achieve 200.But the system clock is based on 1us,I can't realize my demand. Can you tell me how to change the PWM clock?

  • OK,I just quit up using the rtos PWM driver.I use the tiva driverlib to realize the high frequency.
  • Hi,

    I think you might be confused as to the clocking in BIOS & the device peripherals. The Clock module uses a timer to generate the system tick (by default, the tick period is 1us). However, this does not mean the timer is actually running at 1us, it is actually running at the CPU clock frequency & generating 1us interrupts. So unless you manually change the clocking configuration, all timers are ticking at CPU frequency (for TM4C123GH6Pm the default is 80 MHz).

    The PWMTimerTiva driver uses a peripheral timer to generate the PWM waveforms. You need only set the correct period in the PWM params to generate 250KHz waveforms (set a period of 4 us in the PWM_params). These timers are actually 24-bit timers so they can offer extra precision.

    The PWMTiva driver uses the PWM peripheral to generate the PWM waveforms. As stated above, you need only provide the period for it to generate. Keep in mind, that the PWM peripheral uses a clock divider to generate larger periods, so you may see that the duty will not be as precise as the Timer implementation.

    Please take some time to review the driver doxygen for more implementation specific detail/limitations. These can be found in:
    <ti_rtos _install_dir>/products/tidrivers-xx_yy_zz/docs/doxygen/html/index.html.

    Regards,
    -- Emmanuel
  • Thanks for your reply.
    Yes,I was confused when I found tirtos was based on 1us and I mistook I just could use the tirtos pwm driver.However the tiva driverlib is also useful in the tirtos project.Thanks for your assist.