<?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>How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100933/how-to-enable-nrf52840-rtc-using-zephyr</link><description>First of all, I see that NRF52840 doesn&amp;#39;t have a Real Time Clock but it has a Real Time Counter which is not working in case of sleep and low power mode, am I correct? 
 Second, How to enable this RTC (What ever it is) , set the current data/time and</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 21 Dec 2024 05:24:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100933/how-to-enable-nrf52840-rtc-using-zephyr" /><item><title>RE: How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/thread/516024?ContentTypeID=1</link><pubDate>Sat, 21 Dec 2024 05:24:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1f8134ff-91b1-4d5e-b87c-7854fe02a48a</guid><dc:creator>lara</dc:creator><description>&lt;p&gt;have u enabled the rtc?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/thread/432803?ContentTypeID=1</link><pubDate>Sat, 24 Jun 2023 20:51:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9e4bd800-f805-42c2-8181-b87fc8a84e53</guid><dc:creator>ahmedwahdan</dc:creator><description>&lt;p&gt;Thanks&lt;br /&gt;I tried using this timer as suggested and it works just fine,&lt;br /&gt;I still can&amp;#39;t figure out how to connect the dots.&lt;/p&gt;
&lt;p&gt;I need to set the current epoch, and in run time will get the updated epoch on specific event.&lt;br /&gt;How to do so, is there direct way or need to handle it myself?&amp;nbsp;And will counter keeps it&amp;#39;s state in deep sleep?&lt;br /&gt;&lt;br /&gt;Thanks for the support!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/thread/432757?ContentTypeID=1</link><pubDate>Fri, 23 Jun 2023 16:08:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93bec8e7-2c76-4fb3-90fb-62cdea2c7fb3</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;yes. Kernel timer uses RTC.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can read this&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/kernel/services/timing/timers.html"&gt;https://docs.zephyrproject.org/latest/kernel/services/timing/timers.html&lt;/a&gt;&amp;nbsp;documentation to know how to define timer and how to use this.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;For example: A timer is defined using a variable of type&amp;nbsp;&lt;/span&gt;&lt;code&gt;&lt;span&gt;k_timer&lt;/span&gt;&lt;/code&gt;&lt;span&gt;. It must then be initialized by calling&amp;nbsp;&lt;/span&gt;&lt;a title="k_timer_init" href="https://docs.zephyrproject.org/latest/kernel/services/timing/timers.html#c.k_timer_init"&gt;&lt;code&gt;&lt;span&gt;k_timer_init()&lt;/span&gt;&lt;/code&gt;&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Timer expiry funciton works like this-&lt;code&gt;&lt;span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/p&gt;
&lt;pre&gt;&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;my_work_handler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;k_work&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;work&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;{&lt;/span&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;/* do the processing that needs to be done periodically */&lt;/span&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;...&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;

&lt;span&gt;K_WORK_DEFINE&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;my_work&lt;/span&gt;&lt;span&gt;,&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;my_work_handler&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;

&lt;span&gt;void&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;my_timer_handler&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;struct&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;k_timer&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;*&lt;/span&gt;&lt;span&gt;dummy&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;
&lt;span&gt;{&lt;/span&gt;
&lt;span&gt;    &lt;/span&gt;&lt;span&gt;k_work_submit&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;&amp;amp;&lt;/span&gt;&lt;span&gt;my_work&lt;/span&gt;&lt;span&gt;);&lt;/span&gt;
&lt;span&gt;}&lt;/span&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/thread/432300?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 11:52:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e7d65b05-25d4-4700-8c2a-51a09d4b8fcb</guid><dc:creator>ahmedwahdan</dc:creator><description>&lt;p&gt;Thanks Kazi&lt;br /&gt;Does Kernel timer uses RTC? or Do I need to configure something?&lt;/p&gt;
&lt;p&gt;Any example or guidance on how to get thing working?&lt;/p&gt;
&lt;p&gt;Thanks in advance!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How to enable NRF52840 RTC using Zephyr?</title><link>https://devzone.nordicsemi.com/thread/432218?ContentTypeID=1</link><pubDate>Wed, 21 Jun 2023 08:24:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5b72346d-d0d2-495d-b5b0-76bf47541339</guid><dc:creator>Kazi Afroza Sultana</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt; &amp;#39;&amp;#39;I see that NRF52840 doesn&amp;#39;t have a Real Time Clock but it has a Real Time Counter which is not working in case of sleep and low power mode,&amp;#39;&amp;#39; It&amp;nbsp;is not correct.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;&amp;nbsp;RTC peripheral has low-power timer on the low-frequency clock source. then it (counter) enables the real-time clock. &amp;nbsp;LFCLK XTAl oscillator is for generating low power.&amp;nbsp;So,&amp;nbsp;the RTC still works in System ON sleep mode. It&amp;#39;s only in System OFF mode it&amp;#39;s completely turned off.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;For use in Zephyr, you should use kernel timer. &lt;a title="https://docs.zephyrproject.org/latest/kernel/services/timing/clocks.html" href="https://docs.zephyrproject.org/latest/kernel/services/timing/clocks.html" rel="noopener noreferrer" target="_blank"&gt;https://docs.zephyrproject.org/latest/kernel/services/timing/clocks.html&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
&lt;p&gt;BR&lt;/p&gt;
&lt;p&gt;Kazi&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>