<?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>HW control for RTC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/9342/hw-control-for-rtc</link><description>Dears, 
 Just one question for RTC.
In SDK9.0, it&amp;#39;s possible to control of time to use HW RTC block??
If possible, please let me know how to use it.. 
 Thank you.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 22 Sep 2015 05:29:52 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/9342/hw-control-for-rtc" /><item><title>RE: HW control for RTC</title><link>https://devzone.nordicsemi.com/thread/34494?ContentTypeID=1</link><pubDate>Tue, 22 Sep 2015 05:29:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1ef732ae-4426-46f0-85a6-133f55013a69</guid><dc:creator>Peter</dc:creator><description>&lt;p&gt;If I understand you correctly, you want to use the RTC directly instead of using the timer library which is documented here &lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk51.v9.0.0%2Findex.html"&gt;infocenter.nordicsemi.com/index.jsp&lt;/a&gt; ?&lt;/p&gt;
&lt;p&gt;If you use a softdevice, you need to check which RTC instance is available in the SoftDevice Specification. Good chances are that the RTC1 is available.&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an example of how to set the RTC up for a compare interrupt using only bare metal registers:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    NRF_RTC1-&amp;gt;PRESCALER = 327;
	NRF_RTC1-&amp;gt;INTENSET = (RTC_INTENSET_TICK_Enabled &amp;lt;&amp;lt; RTC_INTENSET_TICK_Pos);
	NRF_RTC1-&amp;gt;EVTENSET = (RTC_EVTENSET_TICK_Enabled &amp;lt;&amp;lt; RTC_EVTENSET_TICK_Pos);
	
	NRF_RTC1-&amp;gt;INTENSET = 
    (RTC_INTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; RTC_INTENSET_COMPARE0_Pos);
	NRF_RTC0-&amp;gt;EVTENSET = 
    (RTC_EVTENSET_COMPARE0_Enabled &amp;lt;&amp;lt; RTC_EVTENSET_COMPARE0_Pos);
	
    NVIC_SetPriority(RTC1_IRQn,3);
	NVIC_ClearPendingIRQ(RTC1_IRQn);
	NVIC_EnableIRQ(RTC1_IRQn);
	
	NRF_RTC1-&amp;gt;TASKS_START = 1;
	
	NRF_RTC1-&amp;gt;CC[0] = NRF_RTC1-&amp;gt;COUNTER + 5;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Then just implement interrupt handler:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;void RTC0_IRQHandler(void)
{
	
	if(NRF_RTC0-&amp;gt;EVENTS_TICK )
	{
		...
     }
		NRF_RTC0-&amp;gt;EVENTS_TICK = 0;
	}
	else if(NRF_RTC0-&amp;gt;EVENTS_COMPARE[0])
	{
           ...
		
		NRF_RTC0-&amp;gt;CC[0] = NRF_RTC0-&amp;gt;COUNTER + 5;
		NRF_RTC0-&amp;gt;EVENTS_COMPARE[0] = 0;
	}
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: HW control for RTC</title><link>https://devzone.nordicsemi.com/thread/34493?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2015 13:20:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b7517f51-ad5a-4b21-b0ba-bb252183aa30</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;There is an RTC example in SDK 9.0.0, see &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v9.0.0/rtc_example.html?cp=4_1_0_4_6_17"&gt;this&lt;/a&gt;. Are you using a SoftDevice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>