ppm of PWM timers

mnissov

Well-known member
I am looking at using the `TeensyTimerTool` lib for generating synchronizing signals and I was curious if there was any documentation regarding the accuracy of various onboard timers?

I know the teensy 4.1 has a RTC, rated for 20 ppm I think, and I know it's possible to buy external modules which are much more accurate (e.g. 1ppm). But there's also other time sources like GPT and PWM timers, there's a thread which analyzes the GPT against a GPS clock, finding it to be more accurate (~10ppm).

What about the PWM timers? Should they be more accurate, and is there any information available on this?
 
All of the non RTC timers the TimerTool uses (FTM, TMR, GPT, PIT) run off the same 24MHz crystal and will share the same drift. The RTC based timers (TCK_RTC) use the built in RTC as time base which has a dedicated 32kHz crystal. But, AFAIK this crystal has a similar spec than the 24MHz main crystal.

Since the hardware timers run off the same crystal, they are synced perfectly relative to each other. If you need the pulses synced to some outside clock it gets more difficult of course. There are threads in the forum discussing how to "discipline" the main Teensy clock using e.g. an external GPS signal, so, that might be the way to go if you need to sync your signals to some external time base.
 
PWM emphasizes pulse width not absolute clock accuracy

I don't think I've ever seen a PWM-controlled device that places tight requirements on the accuracy of its clock rate. The two parameters that almost all PWM-driven devices use are carrier frequency and either duty cycle or pulse width. Almost all effort in specifying how PWM-driven devices are controlled concentrate on the duty cycle or pulse width, and do not emphasize carrier frequency. As a result, the timing parameters of most microcontroller PWM blocks are derived from a common microcontroller clock source.

Carrier frequency is basically "pulses per second" and is often specified with a fairly wide range, such as "250 - 1000 Hz".

Some devices define their behavior in terms of pulse width expressed in units of time such as "700 - 2300 microseconds" to control a physical parameter like position or rate of rotation. Some devices define their behavior in terms of duty cycle, the ratio of "high" vs "low" input signal.

We often use PWM blocks to drive motor controllers, in which case the goal is to control the average power delivered to wheel motors. Again in this case, the pulse rate is less important than the pulse width that controls the flow of power to the wheel motor.

Here's a link to a basic article: https://control.com/technical-articles/understanding-the-basicsof-pulse-width-modulation-pwm/

PWM blocks in microcontrollers usually derive their clocks from the microcontroller's clock through a divider network to allow control of the pulse rate. The result is that variability in PWM clock rate matches the variability in the processor's clock.
 
Back
Top