<?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 Appropriately calibrate for RTC drift in i.MX RT Crossover MCUs</title>
    <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2032472#M33272</link>
    <description>&lt;P&gt;I'm running an i.MX RT1170 series processor for a GUI application. The application happens to display a clock. I've noticed that the time I'm displaying lags behind my PC (connected to the internet) by around 6 seconds per day.&lt;/P&gt;&lt;P&gt;I've tried to enter a calibration value to adjust for this drift, but it appears that it's not being applied. Below is my initialization code for the RTC module:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* High power module */
snvs_hp_rtc_config_t rtcConfig;
SNVS_HP_RTC_GetDefaultConfig(&amp;amp;rtcConfig);
rtcConfig.rtcCalValue = 0xf; // +15 counts per each 32768 ticks of the counter
rtcConfig.rtcCalEnable = true; // enable RTC calibration
SNVS_HP_RTC_Init(SNVS, &amp;amp;rtcConfig);
SNVS_HP_RTC_StartTimer(SNVS);

/* Coin-cell powered low power module */
...

/* Synchronize RTC time and date with SRTC */
SNVS_HP_RTC_TimeSynchronize(SNVS);

...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Originally we calculated the calibration value to be +2 counts per 32768 ticks of the counter:&lt;/P&gt;&lt;P&gt;6 seconds behind = missing approximately 6s* 32768 ticks/s = missing approximately 196608 ticks&lt;/P&gt;&lt;P&gt;196608 ticks / (seconds per day) = 196608 ticks / (24hr/day * 60min/hr * 60s/min) = 2.275 ticks/s&lt;/P&gt;&lt;P&gt;Therefore every second and additional 2 counts need to be added to the RTC counter. After adding this it appeared to have no change. So I changed the value to +15 counts per 32768 ticks of the counter to see if I can notice a difference. Once again I can't see a change.&lt;/P&gt;&lt;P&gt;Is the code snippet above the appropriate way to use the RTC calibration value?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMoran_0-1737561803859.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/320903i3F475590AB37D23E/image-size/large?v=v2&amp;amp;px=999" role="button" title="CMoran_0-1737561803859.png" alt="CMoran_0-1737561803859.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's what the processor's reference manual says on the subject.&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 16:05:37 GMT</pubDate>
    <dc:creator>CMoran</dc:creator>
    <dc:date>2025-01-22T16:05:37Z</dc:date>
    <item>
      <title>Appropriately calibrate for RTC drift</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2032472#M33272</link>
      <description>&lt;P&gt;I'm running an i.MX RT1170 series processor for a GUI application. The application happens to display a clock. I've noticed that the time I'm displaying lags behind my PC (connected to the internet) by around 6 seconds per day.&lt;/P&gt;&lt;P&gt;I've tried to enter a calibration value to adjust for this drift, but it appears that it's not being applied. Below is my initialization code for the RTC module:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;/* High power module */
snvs_hp_rtc_config_t rtcConfig;
SNVS_HP_RTC_GetDefaultConfig(&amp;amp;rtcConfig);
rtcConfig.rtcCalValue = 0xf; // +15 counts per each 32768 ticks of the counter
rtcConfig.rtcCalEnable = true; // enable RTC calibration
SNVS_HP_RTC_Init(SNVS, &amp;amp;rtcConfig);
SNVS_HP_RTC_StartTimer(SNVS);

/* Coin-cell powered low power module */
...

/* Synchronize RTC time and date with SRTC */
SNVS_HP_RTC_TimeSynchronize(SNVS);

...&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Originally we calculated the calibration value to be +2 counts per 32768 ticks of the counter:&lt;/P&gt;&lt;P&gt;6 seconds behind = missing approximately 6s* 32768 ticks/s = missing approximately 196608 ticks&lt;/P&gt;&lt;P&gt;196608 ticks / (seconds per day) = 196608 ticks / (24hr/day * 60min/hr * 60s/min) = 2.275 ticks/s&lt;/P&gt;&lt;P&gt;Therefore every second and additional 2 counts need to be added to the RTC counter. After adding this it appeared to have no change. So I changed the value to +15 counts per 32768 ticks of the counter to see if I can notice a difference. Once again I can't see a change.&lt;/P&gt;&lt;P&gt;Is the code snippet above the appropriate way to use the RTC calibration value?&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="CMoran_0-1737561803859.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/320903i3F475590AB37D23E/image-size/large?v=v2&amp;amp;px=999" role="button" title="CMoran_0-1737561803859.png" alt="CMoran_0-1737561803859.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Here's what the processor's reference manual says on the subject.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 16:05:37 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2032472#M33272</guid>
      <dc:creator>CMoran</dc:creator>
      <dc:date>2025-01-22T16:05:37Z</dc:date>
    </item>
    <item>
      <title>Re: Appropriately calibrate for RTC drift</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2032631#M33281</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://community.nxp.com/t5/user/viewprofilepage/user-id/193765"&gt;@CMoran&lt;/a&gt;,&lt;/P&gt;
&lt;P&gt;What do you mean you don't see any changes? Do you see the register's values change on the peripherals+ window? It should look something like this:&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="EdwinHz_0-1737584984294.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/320931i19E86416C14BE2E8/image-size/medium?v=v2&amp;amp;px=400" role="button" title="EdwinHz_0-1737584984294.png" alt="EdwinHz_0-1737584984294.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;I did the test on my side and are seeing increases of 15 ticks in between some counts, so I know it is working for me. How are you measuring your results?&lt;/P&gt;
&lt;P&gt;BR,&lt;BR /&gt;Edwin.&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 22:31:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2032631#M33281</guid>
      <dc:creator>EdwinHz</dc:creator>
      <dc:date>2025-01-22T22:31:02Z</dc:date>
    </item>
    <item>
      <title>Re: Appropriately calibrate for RTC drift</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2033214#M33291</link>
      <description>&lt;P&gt;I do see this change in the Peripherals+ window too.&lt;/P&gt;&lt;P&gt;I have a GUI I setup for testing this, with a calendar to select a date, 2 rollers to select the hours and minutes (seconds default to 0), and a button to set the date and time. I synchronize the GUI with my PC by pressing the button the moment the minute changes. When I come into work the next day the RTC will be 6 seconds behind the clock on my PC despite changing the RTC calibration value. My observations would be like so:&lt;/P&gt;&lt;P&gt;No calibration, after 24hrs the clock is approximately 6 seconds behind.&lt;/P&gt;&lt;P&gt;+2 calibration, after 24hrs the clock is approximately 6 seconds behind.&lt;/P&gt;&lt;P&gt;+15 calibration, after 24hrs the clock is approximately 6 seconds behind.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 13:28:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2033214#M33291</guid>
      <dc:creator>CMoran</dc:creator>
      <dc:date>2025-01-23T13:28:24Z</dc:date>
    </item>
    <item>
      <title>Re: Appropriately calibrate for RTC drift</title>
      <link>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2033910#M33302</link>
      <description>So I came in to work after letting the RTC run for another 24hrs. This time it is ahead of what my PC time is showing, the expected results for a +15 calibration value. I did not change my code from the last run. The only difference was that I placed a breakpoint right before the RTC initialization to confirm in the Peripherals+ window that the values I set were being assigned to the registers.</description>
      <pubDate>Fri, 24 Jan 2025 14:02:54 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-RT-Crossover-MCUs/Appropriately-calibrate-for-RTC-drift/m-p/2033910#M33302</guid>
      <dc:creator>CMoran</dc:creator>
      <dc:date>2025-01-24T14:02:54Z</dc:date>
    </item>
  </channel>
</rss>

