CALCLK Oscillator Calibration

by <a href=""><font color="#000000"><font size="2">Hero Employee</font></font> </a> Alan_S on ‎12-12-2016 02:54 PM

The CMU in Geckos have built in HW support for calibrating oscillators at run-time. It can compare the HFCLK against a selected reference clock (CALCLK). The basic principle of the calibration is that it counts how a given number of cycles of one clock compares to the number of cycles another clock goes through in the same amount of time.


For example, let's say the HFCLK is supposed to be twice as fast as the CALCLK selection. If the HFCLK goes through 100 cycles and CALCLK goes through 55 cycles in this same time frame, the CALCLK should be slowed down slightly. 


Please refer to Application Note AN0004 for more information about CALCLK as well as some software examples.


Something to note is that there is currently a typo in AN0004 in the equation it gives for CALCLKcounter. Please refer to the below picture showing the correct equation.