Teensy 3.6 - analogWriteFrequency on pin 16 and 17

Status
Not open for further replies.

t.gurriet

New member
Hello all,

I'm trying to lower the PWM frequency of pins 16 and 17 to 200Hz on a Teensy 3.6, but it seems to bottom out at 400Hz (checked with an oscilloscope).

Any idea on how to get around this limitation?

Thanks in advance,
Tom
 
On the page linked below TABLE :: PWM Resolution (Teensy LC, 3.0 - 3.6)

I see this:: On Teensy 3.6, pins 16 & 17 operate from a fixed 16 MHz clock. For these pins, the ideal frequency is one third of the ideal PWM frequency at 48 MHz.

On this page:: pjrc.com/teensy/td_pulse.html
 
Thanks, but I don't see how that would allow for frequencies higher than 400Hz but not lower.
I've tried 500Hz and 600Hz no problem. Am I missing something?
 
Pins 16 and 17 do not use the highly configurable and luxurious FTM Flextimers but the somewhat simpler TPM timer. That might be the cause for the restrictions you see. I'd strongly recommend to move away from these both and use pins which are bound to one of the FTM modules, which might be able to operate in the sub hertz range thanks to their pre-scaler.
 
Looking at the table - higher frequencies require fewer counts between triggering. I just did a quick web search and found that those selected pins are unique. Not sure if that is better or worse, but noteworthy. It seems the base clock is slower - but as Thierry indicates those pins are under control of a less capable timer module.
 
Yup, the TPM timers lack the option to use a slow clock source. It's a hardware limitation.

The FTM timers also have this limit when running from F_BUS. But the analogWriteFrequency() code automatically reconfigures the timer to run from the slow 32 kHz clock when you request very low frequencies.
 
Status
Not open for further replies.
Back
Top