Timer Resolution #13701
Replies: 3 comments
-
The timer of the MIMXRT (Teensy 4.x) uses the generic software timer, which is limited to 1m resolution. The Teensy could indeed run at faster speed. As a workaround you could use PWM and feed back a PWM output to a GPIO Pin with pin.irq. Using a hard IRQ handler, rates > 100kHz are possible. Since the base frequency of PWM for Teensy is 150Mhz, you get a 1µs resulution up to 150 kHz. Edit: I looked up my notes: the trigger latency for hard GPIO irq of a Teensy 4.x is about 1.5µs fro the time between the trigger edge and the first statements of the handler being called. |
Beta Was this translation helpful? Give feedback.
-
Works great! |
Beta Was this translation helpful? Give feedback.
-
Instead of using Timer, use a PWM which can have a very high frequency in Teensy, RP2040 and others. Hardware the PWM pin to a digital pin. Set an ISR on the digital pin to read the data. |
Beta Was this translation helpful? Give feedback.
-
AFAICT the Timer on the Teensy 4.X port is limited to integer multiples of 1 ms. This seems like a huge waste of processing speed! I want to sample audio freqency+ signals, up this limits me to 1 kHz. I would be very happy using a timer with 1 us of resolution.
I have programmed using the IDE at speed up to 320 kHz using PDB's. Can I do this in micropython?
Beta Was this translation helpful? Give feedback.
All reactions