<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/14157/freertos-rtc-prescaler-produces-incorrect-time</link><description>In SDK 11 the FreeRTOS port has the following line is declared in portmacro_cmsis.h 
 #define portNRF_RTC_PRESCALER ( (uint32_t) (ROUNDED_DIV(configSYSTICK_CLOCK_HZ, configTICK_RATE_HZ) - 1) )
In the above example configSYSTICK_CLOCK_HZ is 32.768kHZ</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 03 Nov 2016 12:29:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/14157/freertos-rtc-prescaler-produces-incorrect-time" /><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54101?ContentTypeID=1</link><pubDate>Thu, 03 Nov 2016 12:29:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:760580b2-f6f3-48de-a093-5684b693d82a</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi, I think the best now is to configure configTICK_RATE_HZ to 1024  and&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;
&lt;p&gt;do NOT use portTICK_PERIOD_MS because configTICK_RATE_HZ &amp;gt; 1000 because this will make portTICK_PERIOD_MS = 0.&lt;/p&gt;
&lt;/li&gt;
&lt;li&gt;
&lt;p&gt;You have to use pdMS_TO_TICKS because configTICK_RATE_HZ &amp;gt; 1000 and as the millisecond argument given increases then the accuracy becomes better.&lt;/p&gt;
&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;I am not sure if we can do anything about it as long as we use RTC for low power modes and with  only integer prescalar values we can achieve limited tick frequencies.&lt;/p&gt;
&lt;p&gt;This for me looks more of a limitation with FreeRTOS to work with 32KHz oscillators with integral prescalars. Maybe @www.FreeRTOS.org can comment on it!?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54100?ContentTypeID=1</link><pubDate>Thu, 02 Jun 2016 11:57:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1384847a-0d92-4c50-8e3e-f9921449c2a2</guid><dc:creator>John</dc:creator><description>&lt;p&gt;Darren, you are going through exactly the same thing I did a few months ago. The equation in the data sheet works once you realize that the prescaler is 0 based not 1 based. So if you want a prescaler of 32 you really write a 31 into the register.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54097?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2016 23:05:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1837198d-fb7b-4067-af89-b32652c1754f</guid><dc:creator>WestCoastDaz</dc:creator><description>&lt;p&gt;Anders, is this a hardware bug or incorrect documentation?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54099?ContentTypeID=1</link><pubDate>Wed, 01 Jun 2016 23:04:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:94ff1e60-1847-466d-a40e-b82ccccd09c3</guid><dc:creator>WestCoastDaz</dc:creator><description>&lt;p&gt;John,
Thanks for the note!  What I&amp;#39;m trying to understand is why the document the prescaler calculation in the datasheet doesn&amp;#39;t produce the correct time base.  Any thoughts?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54098?ContentTypeID=1</link><pubDate>Tue, 31 May 2016 15:57:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4119bd4a-1e4a-41d3-908c-6c14e4db126b</guid><dc:creator>John</dc:creator><description>&lt;p&gt;We ran into the same thing a while back. If configTICK_RATE_HZ is 1,000, then it does not divide evenly into the 32768 configSYSTICK_CLOCK_HZ. So you end up one tick of the 32kHz clock off. We changed configTICK_RATE_HZ to 1024 to get an accurate 1 second tick we could use to keep our system time.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS RTC Prescaler Produces Incorrect Time</title><link>https://devzone.nordicsemi.com/thread/54096?ContentTypeID=1</link><pubDate>Mon, 30 May 2016 09:39:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6bec4ad9-ed08-483b-84b6-3dca45c0150d</guid><dc:creator>Anders Strand</dc:creator><description>&lt;p&gt;Thanks. I will report this internally&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>