<?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>Clarifications on errata &amp;quot;[20] RTC: Register values are invalid&amp;quot;</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid</link><description>This is the errata: 
 
 Symptoms 
 
 
 
 RTC registers will not contain the correct/expected value if read. 
 
 
 Conditions 
 
 
 
 The RTC has been idle. 
 
 
 Consequences 
 
 
 
 RTC configuration cannot be determined by reading RTC registers. 
 </description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 27 Sep 2024 07:36:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid" /><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/504096?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 07:36:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7467368a-82dd-4b1e-aaba-0b0060bc15f6</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Thanks! I&amp;#39;ll ignore it then since I haven&amp;#39;t seen any issues either. Just wanted to make sure.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/504094?ContentTypeID=1</link><pubDate>Fri, 27 Sep 2024 07:33:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b537176b-940f-418c-9533-a1d2d20e4979</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Aryan"]This said, the SDK libraries and drivers does not seem to have applied this workaround and I am not sure why. I need to ask this to the hardware engineers and the SDK team.&amp;nbsp;[/quote]
&lt;p&gt;Yes Emil,&lt;/p&gt;
&lt;p&gt;There might have been a misunderstanding on the fix here. If you have some protocol stack that is initialized then it uses some RTC instance and will never let the LF-clock shutoff. So that makes the RTC what ever is used by application not idle. It looks like the core issue with this errata is the lfclock regulator and not just RTC being idle. There are 0 customers out of hundreds of thousand who have complained on wrong RTC values, So I am guessing that it is safe to ignore the workaround if you have any protocol stack initialized.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/503616?ContentTypeID=1</link><pubDate>Tue, 24 Sep 2024 15:00:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:17c7e3fc-c188-4cc0-9213-8db825612a8f</guid><dc:creator>Emil Lenngren</dc:creator><description>[quote userid="6207" url="~/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid/498946"]I need to ask this to the hardware engineers and the SDK team.&amp;nbsp;[/quote]
&lt;p&gt;Hi. Did you receive any reply yet?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/498946?ContentTypeID=1</link><pubDate>Tue, 20 Aug 2024 05:08:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2341d075-91db-4536-a3e0-5faaa8bb9752</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Emil Lenngren"]&lt;p&gt;From the above, it seems like &amp;quot;idle&amp;quot; means any time &lt;em&gt;after&lt;/em&gt; RTC has been used until the next time RTC is used.&lt;/p&gt;
&lt;p&gt;Doesn&amp;#39;t&amp;nbsp;that contradict your reply for my initial first question?&lt;/p&gt;[/quote]
&lt;p&gt;RTC idle means that the power regulator to it and the LFCLK most likely have been turned off. In the SDK and the protocol stacks, it looks like once the RTC is initialized, it is never allowed to go into idle states where the hardware power management will at any state decide to turn off power and clock to it as the part of automatic power management of a peripheral. This automatic power management to my understanding &lt;strong&gt;may&lt;/strong&gt; happens when you have TASKS_STOP on RTC after it has been started and being used for a while.&lt;/p&gt;
&lt;p&gt;This said, the SDK libraries and drivers does not seem to have applied this workaround and I am not sure why. I need to ask this to the hardware engineers and the SDK team.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/498870?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 13:31:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:69a84bbc-dde8-4518-ab8d-7af5755a6618</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Thanks for the quick reply. It makes most things clear now.&lt;/p&gt;
&lt;p&gt;However,&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid/498866"]I think that the condition where RTC is idle is never reached the way rtc drivers and libraries are written. That means that the drivers and libraries make sure that from the time RTC is initialized, there is no instance where it gets to IDLE state.[/quote]
&lt;p&gt;From the above, it seems like &amp;quot;idle&amp;quot; means any time &lt;em&gt;after&lt;/em&gt; RTC has been used until the next time RTC is used.&lt;/p&gt;
&lt;p&gt;Doesn&amp;#39;t&amp;nbsp;that contradict your reply for my initial first question?&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid/498803"]You need apply this workaround everytime you boot/reboot[/quote]
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;That seems to imply that &amp;quot;idle&amp;quot; could also refer to the time between boot and we use the RTC the first time?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/498866?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 13:23:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c18db348-1da7-4543-985d-88af8077682d</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="Emil Lenngren"]What I really meant here was, are we allowed to do other things between these lines so that the NRF_RTC0-&amp;gt;TASKS_STOP = 0; is executed some time later?[/quote][quote user="Emil Lenngren"]I guess if we want to use RTC1 as well the correct thing is to simply&amp;nbsp;append NRF_RTC1-&amp;gt;TASKS_STOP = 0; at the end[/quote]
&lt;p&gt;Correct.&lt;/p&gt;
&lt;p&gt;Right after the LFCLK is started you can just have a dummy read in both the RTCs like below, we just need a dummy read on that register and some traffic on the transport bus with RTC peripheral being the target.&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART = 1;
while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0) {}
NRF_RTC0-&amp;gt;TASKS_STOP = 0;
NRF_RTC1-&amp;gt;TASKS_STOP = 0;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The above mean that you have applied the workaround for both instances of RTC at startup.&lt;/p&gt;
&lt;p&gt;And yes you can have a delay between the LFCLK started and the fourth line, but it might be risky if some other context (with higher interrupt priority) stole the CPU and the new context started using RTC without the workaround being complete. This is less likely scenario, but a possibility that cannot be ignored in firmware design.&lt;/p&gt;
[quote user="Emil Lenngren"]. The busy-loop maxes the CPU. Will the workaround work as well if we set up an interrupt for LFCLKSTARTED and wait for that interrupt to be triggered instead, putting the CPU to sleep in the meantime? That will result in that the TASKS_STOP = 0; line will be executed a few microseconds later, since it takes some time for the CPU to wake up.[/quote]
&lt;p&gt;This will work aswell as long as you make sure that from the time the RTC interrupt is triggered in hardware to the time RTC ISR is called, the CPU will not execute any other higher priority context where it will either&amp;nbsp;&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;do something that in turns disable the LFCLK or&lt;/li&gt;
&lt;li&gt;try to use the RTC without the workaround is not completed.&lt;/li&gt;
&lt;/ol&gt;
[quote user="Emil Lenngren"]2. Is this workaround already implemented in nRF Connect SDK / nrfx / nRF5 SDK? I tried to do a fulltext seach on &amp;quot;TASKS_STOP = 0&amp;quot; but didn&amp;#39;t find anything relevant. I also tried looking[/quote]
&lt;p&gt;This is excellent question, you are right. The SDK does not seem to be applying this workaround both in nRF5SDK and in nrF Connect SDK. I think that the condition where RTC is idle is never reached the way rtc drivers and libraries are written. That means that the drivers and libraries make sure that from the time RTC is initialized, there is no instance where it gets to IDLE state.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/498844?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 12:39:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e34284fc-3e28-4e8c-9b86-2a817bb1866b</guid><dc:creator>Emil Lenngren</dc:creator><description>&lt;p&gt;Thanks for the&amp;nbsp;extremely fast and detailed response!&lt;/p&gt;
[quote userid="6207" url="~/f/nordic-q-a/114001/clarifications-on-errata-20-rtc-register-values-are-invalid/498803"]&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;Can an arbitrary amount of time pass between line 3 and 4?&lt;/div&gt;&lt;/blockquote&gt;&lt;div class="quote-footer"&gt;&lt;/div&gt;
&lt;p&gt;Depends on the clock used, this time should be fixed per chip/clock configuration. It can vary from one chip to the other in a cycle or two difference.&lt;/p&gt;
&lt;div class="quote-header"&gt;&lt;/div&gt;&lt;blockquote class="quote"&gt;&lt;div class="quote-content"&gt;&lt;/div&gt;&lt;/blockquote&gt;[/quote]
&lt;p&gt;What I really meant here was, are we allowed to do other things between these lines so that the NRF_RTC0-&amp;gt;TASKS_STOP = 0; is executed some time later? Otherwise&amp;nbsp;applying the same workaround for&amp;nbsp;both RTC0 and RTC1 would be impossible (since that would require a re-start of LFCLK if we literally copy-paste the code twice for both RTC0 and RTC1). I guess if we want to use RTC1 as well the correct thing is to simply&amp;nbsp;append NRF_RTC1-&amp;gt;TASKS_STOP = 0; at the end.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Some follow-up questions:&lt;/p&gt;
&lt;p&gt;1. The busy-loop maxes the CPU. Will the workaround work as well if we set up an interrupt for LFCLKSTARTED and wait for that interrupt to be triggered instead, putting the CPU to sleep in the meantime? That will result in that the TASKS_STOP = 0; line will be executed a few microseconds later, since it takes some time for the CPU to wake up.&lt;/p&gt;
&lt;p&gt;2. Is this workaround already implemented in nRF Connect SDK / nrfx / nRF5 SDK? I tried to do a fulltext seach on &amp;quot;TASKS_STOP = 0&amp;quot; but didn&amp;#39;t find anything relevant. I also tried looking in&amp;nbsp;&lt;a id="" href="https://github.com/NordicSemiconductor/nrfx/blob/master/haly/nrfy_rtc.h,"&gt;https://github.com/NordicSemiconductor/nrfx/blob/master/haly/nrfy_rtc.h&lt;/a&gt;&amp;nbsp;as well as the older app_timer.c in nRF5 SDK but didn&amp;#39;t find anything there either. Since the errata text is really vague on why/how the workaround code works or what the key&amp;nbsp;instructions&amp;nbsp;are making it work, it&amp;#39;s difficult to know if the workaround can be fulfilled in some other way apart from the exact instruction sequence supplied.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;From your description &amp;quot;&lt;span&gt;We need to have a dummy access to the RTC and writing 0 to that register does nothing but accesses the module clearly poking power management of the device to tell it to activate the resources needed by RTC.&amp;quot; it seems the key here in the workaround is to write anything to the RTC while LFCLK is running to &amp;quot;poke&amp;quot; the power management to activate the resources needed by RTC. Otherwise reading some register can return garbage since the RTC at that point does not have the resources needed enabled.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Clarifications on errata "[20] RTC: Register values are invalid"</title><link>https://devzone.nordicsemi.com/thread/498803?ContentTypeID=1</link><pubDate>Mon, 19 Aug 2024 11:10:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:aafbe389-ce4e-4f67-a1bf-72eb30c053f0</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Emil,&lt;/p&gt;
&lt;p&gt;You need apply this workaround everytime you boot/reboot or whenever you have forced the LFCLK to stop and start again.&amp;nbsp;&lt;span&gt;That means that as long as the LF-clock is running, the power domains in which the RTCs&amp;nbsp; reside is never switched off and the reads will return correct results.&lt;/span&gt;&lt;/p&gt;
[quote user=""]Can an arbitrary amount of time pass between line 3 and 4?[/quote]
&lt;p&gt;Depends on the clock used, this time should be fixed per chip/clock configuration. It can vary from one chip to the other in a cycle or two difference.&lt;/p&gt;
[quote user=""]Can line 4 (TASKS_STOP) be reordered, i.e. be executed before the LFCLK is started instead, or while it is being started (e.g. if using LFXO as source, it is ok to run line 4 once LFCLKSTAT says running, e.g.&amp;nbsp;before SRC has switched from RC to LFXO)?[/quote]
&lt;p&gt;We do not know, the workaround we provided have been tested. Reordering is not recommended or suggested.&lt;/p&gt;
[quote user=""]What &amp;quot;configuration&amp;quot; registers are affected?&amp;nbsp;The only configuration register I see present on the RTC peripheral is the PRESCALER. Does this mean as long as I only write to this register and never read from it, I can ignore this errata?[/quote]
&lt;p&gt;Does not matter, we should assume all registers are effected.&amp;nbsp;&lt;/p&gt;
[quote user=""]Is it a typo that 0 should be written to TASKS_STOP? According to the PS only 1 is a valid value to write to the TASKS_STOP register.[/quote]
&lt;p&gt;We need to have a dummy access to the RTC and writing 0 to that register does nothing but accesses the module clearly poking power management of the device to tell it to activate the resources needed by RTC.&lt;/p&gt;
[quote user=""]Any code that can reproduce the issue? I cannot reproduce the issue no matter what I&amp;#39;ve tried so far.[/quote]
&lt;p&gt;Might be that this is very timing related effecting some chips and not all. Best is to not take the risk and apply this workraound at the system startup.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>