<?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>internal RTC example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/59164/internal-rtc-example</link><description>I am using the nRF9160dk development board and I could not find a test or example for the internal RTC. could you provide a simple example of using the internal RTC.</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 18 Mar 2020 13:52:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/59164/internal-rtc-example" /><item><title>RE: internal RTC example</title><link>https://devzone.nordicsemi.com/thread/240458?ContentTypeID=1</link><pubDate>Wed, 18 Mar 2020 13:52:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee85d26e-4a49-4747-abfc-82fac0a48fbf</guid><dc:creator>Sigurd</dc:creator><description>[quote userid="87403" url="~/f/nordic-q-a/59164/internal-rtc-example/240319"]I want a real time clock that knows it is March 17,202 and will know months, days, leap years etc.[/quote]
&lt;p&gt;The RTC is not a real time clock, its a&amp;nbsp;real time counter. For this calendar use-case, please have a look at &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/52151/nrf9160-calendar-mode"&gt;this &lt;/a&gt;and &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/55046/datetime-rtc-example"&gt;this&lt;/a&gt; post.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: internal RTC example</title><link>https://devzone.nordicsemi.com/thread/240319?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 18:19:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:624a5796-57e7-4c09-8e4b-0a053b76274c</guid><dc:creator>Timothy</dc:creator><description>&lt;p&gt;Sigrud&lt;/p&gt;
&lt;p&gt;yes I know how to use the timers. that is not what I want here. I will use the timers for other things in the application. I want a real time clock that knows it is March 17,202 and will know months, days, leap years etc. I loaded and ran the RTC example you pointed me to. it did nothing so I assume I did not do the following.&lt;/p&gt;
&lt;p&gt;Starting nrfx rtc sample!&lt;br /&gt;To run in non-secure mode, you need to add RTC0 to spm.c&lt;/p&gt;
&lt;p&gt;I did not understand what this meant. what do I need to add and where do I add it to spm.c. if this is a real RTC then this is what I need. I could not find the supporting documention (apis, etc.).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: internal RTC example</title><link>https://devzone.nordicsemi.com/thread/240216?ContentTypeID=1</link><pubDate>Tue, 17 Mar 2020 10:38:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:34002a5d-0047-4b8a-a11f-7b0e8e3c306f</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You can take a look at &lt;a href="https://github.com/Rallare/fw-nrfconnect-nrf/blob/nrf9160_samples/samples/nrf9160/nrfx/rtc/src/main.c"&gt;this sample&lt;/a&gt;, it uses the RTC directly.&lt;/p&gt;
&lt;p&gt;But for most use-cases, you should use the kernel timer instead (the kernel timer uses the RTC). See &lt;a href="https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html"&gt;this page&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Snippet:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;struct k_timer single_shot_timer;
struct k_timer multi_shot_timer;

static void my_expiry_function_1(struct k_timer *timer)
{
	ARG_UNUSED(timer);
	printk(&amp;quot;single_shot_timer expired\n&amp;quot;);

}

static void my_expiry_function_2(struct k_timer *timer)
{
	ARG_UNUSED(timer);
	printk(&amp;quot;multi_shot_timer expired\n&amp;quot;);

}

void main(void)
{
	printk(&amp;quot;The kernel timer sample started\n&amp;quot;); // Doc: https://docs.zephyrproject.org/latest/reference/kernel/timing/timers.html

	/* start one single shot timer that expires after 5000 ms */
	/* start one multi shot timer that expires after 5000ms, and then every 5000 ms */
    k_timer_start(&amp;amp;single_shot_timer, K_MSEC(5000),             0);
	k_timer_start(&amp;amp;multi_shot_timer,  K_MSEC(5000), K_MSEC(5000) );
}

K_TIMER_DEFINE(single_shot_timer, my_expiry_function_1, NULL);
K_TIMER_DEFINE(multi_shot_timer,  my_expiry_function_2, NULL);&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>