<?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>Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/5235/usage-of-rtc0-as-time-basis-system-time-possible</link><description>Hello everybody, 
 RTC0 is used by the SoftDevice. Is it possible to use the current RTC0 counter value as a system time, so that RTC1 doesn&amp;#39;t have to run additionally? For this purpose, RTC0 would have to run continuously. 
 My goal is to save timestamps</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 13 Feb 2017 14:58:42 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/5235/usage-of-rtc0-as-time-basis-system-time-possible" /><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18346?ContentTypeID=1</link><pubDate>Mon, 13 Feb 2017 14:58:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:68d14776-5b76-48b6-a0ad-b1fa4cab30ca</guid><dc:creator>puz_md</dc:creator><description>&lt;p&gt;Hi Anna,&lt;/p&gt;
&lt;p&gt;I was using RTC0 only to get some timestamps for short time interval measurements. As RTC0 was already running, I didn&amp;#39;t want to waste ressources and energy for using one more timer. Although this strategy worked very well in my prototypes, I would not suggest to use RTC0 in your final (series) product. Just like Stefan mentioned, there is no guarantee thet RTC0 will always be running in an endless loop.&lt;/p&gt;
&lt;p&gt;Which timer would be the best choice for your project depends on what you want to do with it. The RTCs are very energy efficient, but they are only 24 bits wide. Maybe the normal timers (which are 32 bits wide and provide more features) would fit your requirements better. Especially if you need higher precision timing = fast input clock, which would need the high frequency crystal to be activated (needs more energy in sleep phases).&lt;/p&gt;
&lt;p&gt;Just take a look at the nRF Product Specification (chapters TIMER and RTC), I think they have a very good documentation of their hardware.&lt;/p&gt;
&lt;p&gt;If you just used RTC0 like I did, you might want to use RTC1 or RTC2 (doesn&amp;#39;t really matter which instance, as long as it is not used by other software modules) to keep the changes in code down to a ninimum. I encapsulated my RTC0 access into a small module / function called &lt;code&gt;getTimestamp()&lt;/code&gt;. This way, I can easily replace RTC0 with RTC1 later.&lt;/p&gt;
&lt;p&gt;Good luck,
Michael&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18345?ContentTypeID=1</link><pubDate>Fri, 10 Feb 2017 14:06:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0fdf89d4-1734-4a6c-b769-ac640c4da3e8</guid><dc:creator>annapalu</dc:creator><description>&lt;p&gt;Hi puz_md,&lt;/p&gt;
&lt;p&gt;i have the some problem. I&amp;#39;m thinking to use a RTC2, even if RTC0 or RTC1.&lt;/p&gt;
&lt;p&gt;What do you think about that?&lt;/p&gt;
&lt;p&gt;Thanks,
Anna&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18344?ContentTypeID=1</link><pubDate>Tue, 27 Jan 2015 15:37:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d37d786f-161c-4045-90a9-d20cb5bca3d3</guid><dc:creator>puz_md</dc:creator><description>&lt;p&gt;Okay, I think your update makes it clear: Even if it seems to work at the moment, it&amp;#39;s against the specification and there is no guarantee that it will work in a reliable manner. Thanks!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18341?ContentTypeID=1</link><pubDate>Sat, 24 Jan 2015 01:10:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c03d689d-6afb-41e1-a91b-a67d2e7be0b0</guid><dc:creator>RK</dc:creator><description>&lt;p&gt;Even if currently RTC0 ran constantly, never stopped and was never reset and you could read it as you suggest, basing your application on that would be a very bad idea. The softdevice implementation could change at any time, in any way, to run, not run, reset the counter etc. as part of Nordic&amp;#39;s softdevice evolution.&lt;/p&gt;
&lt;p&gt;You should treat the resources which are documented as used by the softdevice as unavailable for any purpose unless there&amp;#39;s an exposed user API point or a documented exception.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18343?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2015 16:10:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9364eca-eb79-45e3-adee-6e8bf72d5c51</guid><dc:creator>puz_md</dc:creator><description>&lt;p&gt;Hi Stefan,&lt;/p&gt;
&lt;p&gt;there might be a misunderstanding in your interpretation of my question. I do NOT intend to do any write operations to RTC0, neither change its configuration that was made by the SoftDevice. All I want to do is use it as a constantly running counter (I am also aware that there will be an overflow every 512 seconds).&lt;/p&gt;
&lt;p&gt;Accessing RTC0 is not a problem: I can read NRF_RTC0-&amp;gt;COUNTER anytime, from within on_ble_evt() for example. That&amp;#39;s all I need to do.&lt;/p&gt;
&lt;p&gt;My question is: Is there any situation when this counter is stopped or manually reset/written by the SoftDevice? Or can I use it as a reliable time reference?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Usage of RTC0 as time basis (system time) possible?</title><link>https://devzone.nordicsemi.com/thread/18342?ContentTypeID=1</link><pubDate>Fri, 23 Jan 2015 15:19:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:acc838f9-424a-420f-8d35-b1a7cfed07bc</guid><dc:creator>Stefan Birnir Sverrisson</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;When the softdevice is enabled, the RTC0 is blocked, so you would need to disable the softdevice to use the RTC0. Many of the nRF51 SDK BLE example use app_timer library which uses RTC1 in the background, so if you have app_timer enabled, you can not use RTC1 either.&lt;/p&gt;
&lt;p&gt;The current consumption is ~0.1uA for the RTC so it is relatively very low current consumption. So there is practically no current cost of using the RTC1, if that is your concern.&lt;/p&gt;
&lt;p&gt;Most of the current consumption is during radio events. The largest factors are radio RX ~13mA, radio TX ~10.5mA, CPU ~4.1mA. The softdevice conumes ~3.1uA when idle and enabled. Usually, advertising is more current consuming than being in a connection. More on current connection on &lt;a href="https://devzone.nordicsemi.com/question/5186/how-to-minimize-current-consumption-for-ble-application-on-nrf51822/#reply-5187"&gt;this thread&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Putting the chip into System On sleep mode is actually just disabling the CPU. Putting the chip into System Off sleep mode is actually just disabling the CPU and all nRF51 peripherals.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;Update 27.1.2015&lt;/strong&gt;
RTC0 is listed as &amp;quot;blocked&amp;quot; in the SDS.  That means that it is in use by the SoftDevice when the SoftDevice is enabled, and the application should not assume anything about the state of this peripheral.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>