Kuba0040
Well-known member
Hello,
I need to urgently figure out how to generate, as accurately as possible a 32768Hz 50% duty cycle pulse with a Teensy 4.0. I’ve built a clock for a friend (not using the teensy, it’s an unrelated project) and need to tune its crystal oscillator. I need a as accurate as possible reference signal to compare the crystals output to. I do not have any fancy equipment that could do that. The teensy is my best shot.
I’ve already tried generating the frequency using analogWrite. With that, at a CPU speed of 1.008Ghz and analog write resolution of 2 bits, according to my calculations, the best accuracy could be achieved with a frequency off only by +0.765644Hz.
However, I also know that the Teensy 4.0 has integrated RTC circuitry which uses a 32.768kHz clock for keeping time. Is there anyway I could output this clock signal to a pin of the teensy? This would give me the best accuracy possible.
I apologize for essentially asking the forums to prepare a piece of code for me, however I need to have this clock tuned no later than by the 29th of August. I am under a serious time crunch, also working on other things as I need to ship this clock to another country.
Thank You for understanding and all help.
I need to urgently figure out how to generate, as accurately as possible a 32768Hz 50% duty cycle pulse with a Teensy 4.0. I’ve built a clock for a friend (not using the teensy, it’s an unrelated project) and need to tune its crystal oscillator. I need a as accurate as possible reference signal to compare the crystals output to. I do not have any fancy equipment that could do that. The teensy is my best shot.
I’ve already tried generating the frequency using analogWrite. With that, at a CPU speed of 1.008Ghz and analog write resolution of 2 bits, according to my calculations, the best accuracy could be achieved with a frequency off only by +0.765644Hz.
However, I also know that the Teensy 4.0 has integrated RTC circuitry which uses a 32.768kHz clock for keeping time. Is there anyway I could output this clock signal to a pin of the teensy? This would give me the best accuracy possible.
I apologize for essentially asking the forums to prepare a piece of code for me, however I need to have this clock tuned no later than by the 29th of August. I am under a serious time crunch, also working on other things as I need to ship this clock to another country.
Thank You for understanding and all help.