<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)? in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757104#M46154</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robin,&lt;/P&gt;&lt;P&gt;From the formula above I can get the tcr and CIR values.&lt;/P&gt;&lt;P&gt;tcr may result positive or negative (signed char).&lt;/P&gt;&lt;P&gt;The TCR field in the RTC_TCR register should be set with the exact tcr value (with sign) or not?&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32769.846 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = -46 = 0xD2&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 24&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0xD2?&lt;/P&gt;&lt;P&gt;Another example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32767.123 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = 110 = 0x6E&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 124&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0x6E?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Alessandro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Dec 2017 17:03:14 GMT</pubDate>
    <dc:creator>Vagni</dc:creator>
    <dc:date>2017-12-06T17:03:14Z</dc:date>
    <item>
      <title>How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757101#M46151</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I read the AN4949 application note &lt;A class="" data-content-finding="Community" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fcache.freescale.com%2Ffiles%2Fmicrocontrollers%2Fdoc%2Fapp_note%2FAN4949.pdf" rel="nofollow" target="_blank"&gt;http://cache.freescale.com/files/microcontrollers/doc/app_note/AN4949.pdf&lt;/A&gt;&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;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?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If I measure RTC_CLKOUT = 32767.0000 Hz, should I set CIR = 0 and TCR = 1 ?&lt;/P&gt;&lt;P&gt;But what if I measure RTC_CLKOUT with a fractional part, i.e. 32767.1234 or 32768.8765 Hz ?&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 01 Dec 2017 14:57:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757101#M46151</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2017-12-01T14:57:12Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757102#M46152</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Alessandro,&lt;/P&gt;&lt;P&gt;Sorry for the late reply!&lt;/P&gt;&lt;P&gt;Please refer the equation shown below:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="CodeCogsEqn.gif"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/60161i30908BDFFE1FA11C/image-size/large?v=v2&amp;amp;px=999" role="button" title="CodeCogsEqn.gif" alt="CodeCogsEqn.gif" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;tcr:&amp;nbsp;&amp;nbsp;&amp;nbsp;-127~128&lt;/P&gt;&lt;P&gt;CIR:&amp;nbsp;&amp;nbsp;&amp;nbsp;0~255&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 08:12:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757102#M46152</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-12-05T08:12:31Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757103#M46153</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you, Robin.&lt;/P&gt;&lt;P&gt;So the right values for CIR and TCR fields are the one that in fractional mode best approximate the difference between &lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;the nominal value and the measured value&lt;/SPAN&gt;&lt;/SPAN&gt; of the RTC oscillator frequency, right?&lt;/P&gt;&lt;P&gt;Then I should embed the following procedure in my firmware application:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Calculate the difference between &lt;SPAN class="" lang="en"&gt;&lt;SPAN class=""&gt;the nominal value and the measured value&lt;/SPAN&gt;&lt;/SPAN&gt; of the RTC oscillator frequency, i.e D = Fnom - Fmeasure&lt;/LI&gt;&lt;LI&gt;Convert D from signed decimal number in signed fractional number, i.e D = N / M&lt;/LI&gt;&lt;LI&gt;Calculate the equivalent minimum terms fractional number, i.e. D = n / m&lt;/LI&gt;&lt;LI&gt;Find the TCR value in the range [-127, 128] and CIR value in the range [0, 255] that best approximate D = n / m = TCR/(CIR + 1)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Is it right?&lt;/P&gt;&lt;P&gt;Or there is a better and faster way to get both TCR and CIR values?&lt;/P&gt;&lt;P&gt;Dealing with fractional approximations is not so easy to code....&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 05 Dec 2017 13:55:34 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757103#M46153</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2017-12-05T13:55:34Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757104#M46154</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robin,&lt;/P&gt;&lt;P&gt;From the formula above I can get the tcr and CIR values.&lt;/P&gt;&lt;P&gt;tcr may result positive or negative (signed char).&lt;/P&gt;&lt;P&gt;The TCR field in the RTC_TCR register should be set with the exact tcr value (with sign) or not?&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32769.846 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = -46 = 0xD2&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 24&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0xD2?&lt;/P&gt;&lt;P&gt;Another example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32767.123 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = 110 = 0x6E&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 124&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0x6E?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Alessandro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Dec 2017 17:03:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757104#M46154</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2017-12-06T17:03:14Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757105#M46155</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Robin,&lt;/P&gt;&lt;P&gt;Can you confirm the following?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;First case:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;RTC_CLKOUT = 32769.846&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - RTC_CLKOUT = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = -46&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 24&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;The RTC is early,&lt;/SPAN&gt; so every (CIR + 1) = 25 sec the RTC prescaler register should be adjusted in order to count (32768 + 46) = 32814 cycles for one second.&lt;/P&gt;&lt;P&gt;So TCR should be set to -46, i.e. TCR = 0xD2&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Second case:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;RTC_CLKOUT = 32767.123&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - RTC_CLKOUT = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = 110&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 124&lt;/P&gt;&lt;P&gt;&lt;SPAN style="text-decoration: underline;"&gt;The RTC is late&lt;/SPAN&gt;, so every (CIR + 1) = 125 sec the RTC prescaler register should be adjusted in order to count (32768 - 110) = 32658 cycles for one second.&lt;/P&gt;&lt;P&gt;So TCR should be set to 110, i.e. TCR = 0x6E&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&lt;/P&gt;&lt;P&gt;Best Regards&lt;/P&gt;&lt;P&gt;Alessandro&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2017 08:40:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757105#M46155</guid>
      <dc:creator>Vagni</dc:creator>
      <dc:date>2017-12-07T08:40:02Z</dc:date>
    </item>
    <item>
      <title>Re: How to Use the Kinetis RTC Time Compensation Register (RTC_TCR)?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757106#M46156</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Every (&lt;STRONG&gt;CIR+1&lt;/STRONG&gt;)second apply &lt;SPAN style="color: #ff0000;"&gt;(&lt;/SPAN&gt;32768-&lt;SPAN style="color: #1f76f0;"&gt;tcr&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;)&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="RTC_TCR[TCR].png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/2303iF3093EFD1EB9C736/image-size/large?v=v2&amp;amp;px=999" role="button" title="RTC_TCR[TCR].png" alt="RTC_TCR[TCR].png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;For example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32769.846 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = -46 = 0xD2&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 24&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0xD2?&lt;/P&gt;&lt;P&gt;Yes&lt;/P&gt;&lt;P&gt;if every (&lt;STRONG&gt;CIR+1&lt;/STRONG&gt;)second apply &lt;SPAN style="color: #ff0000;"&gt;(&lt;/SPAN&gt;32768-&lt;SPAN style="color: #1f76f0;"&gt;tcr&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if every (&lt;STRONG&gt;25&lt;/STRONG&gt;)second apply &lt;SPAN style="color: #ff0000;"&gt;(32814)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;[32768*(&lt;STRONG&gt;CIR+1&lt;/STRONG&gt;)-(&lt;SPAN style="color: #1f76f0;"&gt;tcr&lt;/SPAN&gt;)]/32769.846Hz=[32768*(&lt;STRONG&gt;25&lt;/STRONG&gt;)-(&lt;SPAN style="color: #1f76f0;"&gt;-46&lt;/SPAN&gt;)]/32769.846Hz=24.999995422621149943762323448209sec&lt;/P&gt;&lt;P&gt;if not apply:&lt;/P&gt;&lt;P&gt;[32768*(&lt;STRONG&gt;25&lt;/STRONG&gt;)]/32769.846Hz=24.998591693107132697541514232322sec&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Another example:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;32768 - 32767.123 = tcr / (CIR + 1)&lt;/P&gt;&lt;P&gt;I get:&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;tcr = 110 = 0x6E&lt;/P&gt;&lt;P style="padding-left: 30px;"&gt;CIR = 124&lt;/P&gt;&lt;P&gt;In the RTC_TCR register should I set TCR = 0x6E?&lt;/P&gt;&lt;P&gt;Yes&lt;/P&gt;&lt;P&gt;if every (&lt;STRONG&gt;CIR+1&lt;/STRONG&gt;)second apply &lt;SPAN style="color: #ff0000;"&gt;(&lt;/SPAN&gt;32768-&lt;SPAN style="color: #1f76f0;"&gt;tcr&lt;/SPAN&gt;&lt;SPAN style="color: #ff0000;"&gt;)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;if every (&lt;STRONG&gt;125&lt;/STRONG&gt;)second apply &lt;SPAN style="color: #ff0000;"&gt;(32668)&lt;/SPAN&gt;:&lt;/P&gt;&lt;P&gt;[32768*(&lt;STRONG&gt;CIR+1&lt;/STRONG&gt;)-(&lt;SPAN style="color: #1f76f0;"&gt;tcr&lt;/SPAN&gt;)]/32767.123Hz=[32768*(&lt;STRONG&gt;125&lt;/STRONG&gt;)-(&lt;SPAN style="color: #1f76f0;"&gt;100&lt;/SPAN&gt;)]/32767.123Hz=125.00029373955107380040658436812sec&lt;/P&gt;&lt;P&gt;if not apply:&lt;/P&gt;&lt;P&gt;[32768*(&lt;STRONG&gt;125&lt;/STRONG&gt;)]/32767.123Hz=125.00334557904274964878668169921sec&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best Regards,&lt;/P&gt;&lt;P&gt;Robin&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Dec 2017 09:24:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-Use-the-Kinetis-RTC-Time-Compensation-Register-RTC-TCR/m-p/757106#M46156</guid>
      <dc:creator>Robin_Shen</dc:creator>
      <dc:date>2017-12-07T09:24:40Z</dc:date>
    </item>
  </channel>
</rss>

