Works for me too.
Here is complete example using FreqCount to measure frequency on pin 14. (For Teensy 4, gateinterval is in microseconds ! Who knew. web page documentation needs updating.) Jumper pin 9 to pin 14.
Code:
#include <FreqCount.h>
void setup() {
Serial.begin(57600);
while (!Serial);
analogWriteFrequency(14, 2 * 1000000); // test jumper 9 to 14
analogWrite(14, 128);
FreqCount.begin(1000000); // 1 second gateinterval for T4
}
void loop() {
if (FreqCount.available()) {
unsigned long count = FreqCount.read();
Serial.println(count);
}
}
Sketch reports 2000000 every second. No real need to mess with analogWriteResolution(), as the teensy core adjusts duty value based on frequency (hardware/teensy/avr/cores/teensy4/pwm.c)