I read the AN4949 application note http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4949.pdf
but it refers to Kinetis-M devices and I still don't understand how to set RTC_TCR register for frequency compensation in a Kinetis-K device like.
The CIR field set the compensation interval in seconds (from 1 to 256 s): every compensation interval the prescaler value is adjusted for one cycle with the value of the TCR field (+128 / -127) from the 32768 nominal value, right?
Now, I can measure the RTC_CLKOUT signal frequency, which quite always differs from the 32768 Hz nominal value; but how to calculate the right values for CIR and TCR fields?
If I measure RTC_CLKOUT = 32767.0000 Hz, should I set CIR = 0 and TCR = 1 ?
But what if I measure RTC_CLKOUT with a fractional part, i.e. 32767.1234 or 32768.8765 Hz ?