Hello!
I'm working on a project with a Teensy 4.1. Part of it is a frequency counter. Doesn't have to be super accurate. I need to count up to 50MHz to an accuracy of maybe 10kHz.
I found an example on github:
https://github.com/manitou48/teensy4/blob/master/gpt2_count.ino
The general principle is that you set GPT2 to use an external clock, and set up
an IntervalTimer object to read GPT2 at the gate time.
Unfortunately, it poops out above about 10MHz. Apparently, there is an internal clock ( clk_ipg ), and you cannot count anything higher than 1/4 the frequency of that clock. Even the prescaler doesn't work any faster.
The datasheet is coy about the frequency of clk_ipg, but I suspect 40MHz.
Any way to set it faster? Any other way to count that's not subject to the 1/4 clk_ipg limitation?
Right now, I'm looking at a string of D flip flops....
- jerryk
I'm working on a project with a Teensy 4.1. Part of it is a frequency counter. Doesn't have to be super accurate. I need to count up to 50MHz to an accuracy of maybe 10kHz.
I found an example on github:
https://github.com/manitou48/teensy4/blob/master/gpt2_count.ino
The general principle is that you set GPT2 to use an external clock, and set up
an IntervalTimer object to read GPT2 at the gate time.
Unfortunately, it poops out above about 10MHz. Apparently, there is an internal clock ( clk_ipg ), and you cannot count anything higher than 1/4 the frequency of that clock. Even the prescaler doesn't work any faster.
The datasheet is coy about the frequency of clk_ipg, but I suspect 40MHz.
Any way to set it faster? Any other way to count that's not subject to the 1/4 clk_ipg limitation?
Right now, I'm looking at a string of D flip flops....
- jerryk