<?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>nRF5340 RTC with external crystal clock</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/97476/nrf5340-rtc-with-external-crystal-clock</link><description>I am using nRF5340 RTC with external crystal. I have verified with following piece of code that LXFO is working. During normal scenario RTC is working fine as a counter. 
 
 
 I want to retain the RTC counter value when there is software reset e.g NVIC_SystemReset</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 14 Mar 2023 16:45:23 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/97476/nrf5340-rtc-with-external-crystal-clock" /><item><title>RE: nRF5340 RTC with external crystal clock</title><link>https://devzone.nordicsemi.com/thread/415313?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 16:45:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:478df800-bbda-460e-a36b-14d5347e2e4d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;The RTC&amp;#39;s in the nRF9160 is the same, they are just low frequency counters that are reset on a system reset. As you have an nRF9160 on the board, an option could perhaps be to get the time and date from the network? You may find&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/63154/nrf9160-real-time-counter-for-timestamping"&gt;this thread&lt;/a&gt;&amp;nbsp;useful in that regard.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 RTC with external crystal clock</title><link>https://devzone.nordicsemi.com/thread/415246?ContentTypeID=1</link><pubDate>Tue, 14 Mar 2023 14:21:09 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a1012db2-99a6-487d-b3f8-d20c16896334</guid><dc:creator>Dilawar Ali</dc:creator><description>&lt;p&gt;Thanks for the info.&lt;br /&gt;&lt;br /&gt;We have the nRF9160 as well on the same board. I see also the nRF9160 have 2 RTC as well. From description it looks like that its same as nRF5340.&lt;br /&gt;&lt;br /&gt;Before we go ahead for the hardware update, I just want to be sure that is there a way to add&amp;nbsp;calendar support persistent to soft reset? Will the nRF9160 be helpful in this scenario?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 RTC with external crystal clock</title><link>https://devzone.nordicsemi.com/thread/414385?ContentTypeID=1</link><pubDate>Thu, 09 Mar 2023 13:12:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:168f3082-6215-4b50-ae89-640b842f2311</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user=""]I want to retain the RTC counter value when there is software reset e.g NVIC_SystemReset. Is it possible to achieve it with external crystal clock enabled?[/quote]
&lt;p&gt;No, that is not possible. The RTC peripheral is reset to the default values, so it will start counting from 0. (This is regardless of the clock source.)&lt;/p&gt;
[quote user=""]Also we have two RTC peripherals in nRF5340, Is there anyway we can implement the&amp;nbsp;Real time clock using both RTCs? Or we must have to use the external RTC for&amp;nbsp;clock purpose?[/quote]
&lt;p&gt;By real time clock here I assume you mean something like what you would get from an external RTC with calendar functionality etc? If so, you would have to implement this in software, with the help of an RTC to know how much time has elapsed since last time. Then you could use&amp;nbsp;k_uptime_get(). But you would have to implement the calendar functionality yourself. And a reset would mean you loos track of time. If you need to consistently keep track of calendar (date and time) across resets, you should consider an external RTC with calendar functionality.&lt;/p&gt;
&lt;p&gt;By the way, there are 4 RTC instance, 2 for the app core and 2 for the net core. Depending on what you do, several of these may be unavailable though, as Zephyr use RTC for keeping track of time, and also the SoftDevice Controller if you are using bluetooth.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>