Last Update: Preliminary information, subject to change.
This application note describes the method and PiXCL app used to calibrate a Decaf board Real Time Clock to account for the variations in clock frequencies.
Firmware v20.0 added the USBCalibrateRTC command to read and optionally replaces the PreDivider value used to configure the RTC on power up.
Board firmware sets a default value for the PreDivider and assumes a nominal RTC clock of 40kHz for 72MHz boards, and 32kHz for 168MHz boards. Due to crystal oscillator frequency tolerances, these clocks are often around 6 percent fast.
The calibration app is written using PiXCL 20.0, and is found in the PiXCLe Utilities directory. Up to three Decaf boards can be processed at once. Functionally, the reads the current PC time, writes this to each IOC board, and them waits for at least 60 seconds (you can change this if needed), then reads the new current PC time and the current RTC time.
With uncalibrated boards, there will be an elapsed time variation. For example, the PC elapsed time may be 62 seconds, and an RTC time might be 58 seconds or 64 seconds. The app will then calculate the new PreDivider value, and ask if you want to apply this. If so, you then exit the app, power-on reset the boards to cause an RTC_Init. Start the app again and try the calibration test to verify that the RTC is now approximately accurate to the PC clock.
If the Decaf board has a RTC backup battery, the clock will continue to update when the board is unplugged.
< More to be added. >
Copyright © 2025 PiXCL Automation Tech Notes, Canada. All Rights Reserved.