Teensy 4.1 / 4.0 When to use FlexPWM vs QuadTimer to strobe LEDs

RobbGodshaw

New member
Hi All!

I have a few questions.

I want to strobe 3 LEDs (at independent frequencies and duty cycles) via mosfets with a duty cycle of 0.05%-1% at a frequency range of 24-100hz. I would like to hold 1% or better accuracy for both duty cycle and frequency.
The Teensy 4.x seems perfect with its amazing PWM frequency and resolution controls, and generous number of independent PWM timers.

  1. For the purposes of my application, should I use pins with FlexPWM or QuadTimer? Does it matter?
  2. I see that the numbering convention is X.Y, is there any functional significance when X numbers are in common (IE FlexPWM 1.0 and FLexPWM 1.1)?

Thanks!
 
[*]For the purposes of my application, should I use pins with FlexPWM or QuadTimer? Does it matter?

Really doesn't matter for 0.05% accuracy.


[*]I see that the numbering convention is X.Y, is there any functional significance when X numbers are in common (IE FlexPWM 1.0 and FLexPWM 1.1)?

See "PWM Frequency" on this page.

https://www.pjrc.com/teensy/td_pulse.html

The 3 pins identified as "FlexPWM1.0" (1, 44, 45) will always run at the same frequency. If you want different PWM frequency, you would need to choose pins from different groups.

More detail on how the hardware actually works can be found in the reference manual. But usually that ends of being far too much information. The timers are packed with a mind boggling number of advanced features, which makes a steep learning curve if you want to dive into how the hardware really works.

Most applications work fine by simply using analogWrite, analogWriteResolution and analogWriteFrequency. Everything you've said sounds like a pretty simple application that can be done easily with these 3 functions. You're only looking for 9 bit resolution from hardware than is natively 15 or 16 bits. Just use the easy functions do the low-level work for you.
 
Back
Top