0

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-100 hz. 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)?

See "Frequency" section of this page

1 Answer 1

1

I had cross-posted, and Paul Stoffregen answered in the Teensy Forum. Pasting Paul's great answer here for posterity:

1: Really doesn't matter for 0.05% accuracy.

2:See "PWM Frequency" on this page.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.