![]() |
MKMxxZxxACxx5 Bare Metal Software Drivers
R4.1.6
Reference Manual
|
The fine compensation logic is suitable for many 32.768 kHz crystals, and can correct a wide range of crystal offsets.
The software example initializes IRTC module including so called fine compensation logic, RTCCLKOUT pin to generate 1 Hz pulse output, and FreeMASTER interface to communicate through UART2 module (38400/8-N-1). It demonstrates capability of the IRTC module to output a precise 1 Hz pulse output signal (through RTCCLKOUT pin) that represents clock frequency used to drive IRTC's internal time and date counters. This 1 Hz pulse output signal is outputted by the fine compensation logic and is generated with high resolution of the clock edge placement (up to 0.88 ppm) and near 50% duty cycle as shown in Figure 1.
The software sets an integral compensation value, a 2's complement value of the integer part of correction or compensation value that has to be adjusted in every 1 second period, to value -5 (-152.59 ppm), and a fraction compensation value, a fractional part of the correction or compensation value that has to be adjusted in every 1 second period, to value 11 (+2.62 ppm). Note that, integral and fraction compensation values are expressed in terms of number of clock cycles of the 32.768 kHz oscillator clock (30.51 ppm) and fixed 4.194304 MHz clock (0.24 ppm), respectively.
You may modify integral and fractional compensation values using FreeMASTER interface in order to analyze their impact on frequency of the generated 1 Hz pulse output.
IAR EWARM 7.40.7 | CodeWarrior 10.6 | KEIL uVision 5.15 | CrossWorks 3.6 | ATOLLIC TrueStudio 5.3.0 | Kinetis Design Studio 3.0.0 |
---|---|---|---|---|---|
♦ | ♦ | ♦ | ♦ | ♦ | ♦ |