<?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>getting millis from startup</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/29547/getting-millis-from-startup</link><description>I need to count millis from nrf52 start 
 I have seen that all are using rtc1 but I did not find any example from which i can integrate it to my project.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 19 Jan 2018 12:45:10 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/29547/getting-millis-from-startup" /><item><title>RE: getting millis from startup</title><link>https://devzone.nordicsemi.com/thread/117462?ContentTypeID=1</link><pubDate>Fri, 19 Jan 2018 12:45:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4bf2395d-2e36-4393-b64a-406bee58f584</guid><dc:creator>Joakim Jakobsen</dc:creator><description>&lt;p&gt;Hi Dhaval!&lt;/p&gt;
&lt;p&gt;The reason that &amp;quot;all are using &lt;code&gt;RTC1&lt;/code&gt;&amp;quot;, is because the softdevice is using &lt;code&gt;RTC0&lt;/code&gt;.&lt;br /&gt;
We do have an RTC example in the SDK that you can take a look at.&lt;br /&gt;
Located at; &lt;code&gt;sdk_location/examples/peripheral/rtc&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;The Real Time Counter (RTC) uses the low-frequency clock source (LFCLK, 32KHz).
That means less resolution (~30us) and lower power consumption. The RTC features a 24 bit
Counter and a 12 bit prescaler.&lt;/p&gt;
&lt;p&gt;When using prescaler value 0 the RTC will overflow after 512 seconds, with a period of 30us.&lt;br /&gt;
With a max. prescaler value the RTC will overflow after ~582.5 hours, with a period of 125ms.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t know what SDK you are working with, so I just assume &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk/keydef/PLUGINS_ROOT/com.nordic.infocenter.sdk5.v14.2.0/index.html?cp=4_0_0"&gt;SDK 14.2.0.&lt;/a&gt;&lt;br /&gt;
To implement such a counter in your project, I would suggest that you take a look at the
&lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__app__timer.html?resultof=%22%61%70%70%5f%74%69%6d%65%72%5f%63%6e%74%5f%67%65%74%22%20"&gt;Application Timer&lt;/a&gt; in the infocenter.&lt;br /&gt;
The function &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v14.2.0/group__app__timer.html#gae36265bac1480fbb1522f63f70ac369f"&gt;app_timer_cnt_get()&lt;/a&gt; can be used to get the current value of the RTC1 counter.
Then you need to convert the number of ticks to ms.&lt;/p&gt;
&lt;p&gt;Take a look at my answers in these cases, that might be of interest.&lt;br /&gt;
&lt;a href="https://devzone.nordicsemi.com/question/174690/how-to-covert-app_timer-ticks-to-ms/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;br /&gt;
&lt;a href="https://devzone.nordicsemi.com/question/164346/app_timer-tick-problem/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Hope that helps, but be sure to let me know if you face any problems.&lt;br /&gt;
Best regards,&lt;br /&gt;
Joakim&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>