<?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>FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/43669/freertos-and-rtc</link><description>Hello! I used the &amp;quot;blinky_rtc_freertos&amp;quot; example and transferred ticksource from RTC to SYSTICK in &amp;quot;FreeRTOSConfig.h&amp;quot;. The application has stopped working. What am I doing wrong? 
 I use nRF52840, SEGGER Embedded Studio for ARM Release 4.12 Build 2018112601</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 18 Feb 2019 14:40:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/43669/freertos-and-rtc" /><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171681?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 14:40:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a59c600f-ec86-424e-9718-bbdb75a1d210</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;We always assume that the&amp;nbsp;product is battery powered, as that is the typical use case for nRF devices. It is simply not possible to only use the RTC, as it need the LF clock to function. The LF clock and needed regulator will effectively consume about&amp;nbsp;2.5 µA on the nRF52832. This includes the RTC. This is the typical sleep current for any power optimized design with the nRF52840.&lt;/p&gt;
&lt;p&gt;Essentially what you need to do is what I suggested my previous post: use a RTC in some way (either directly or via a SW library) and wake up as seldom as possible to do timekeeping&amp;nbsp;before you go back to sleep (due to 24 bit RTC wrap around time being too long for 1 month sleep durations, regardless of prescaler configuration).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171668?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 14:15:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:caf3373f-0ecc-4313-8e5e-387b978930f4</guid><dc:creator>Valery</dc:creator><description>&lt;p&gt;Thank you for the detailed and quick response!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I want to minimize energy consumption, because I use battery power.&amp;nbsp;And of course, under a deep sleep, I understand the absence of any processor actions, except for the RTC ticks 8 times per second(use MAX PREACALER).&amp;nbsp;Therefore, I want to stop the FreeRTOS&amp;nbsp;and all interrupts, except RTC2.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171653?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 13:49:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a0ef5b52-bc2b-4e8c-ac94-13323af735f7</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Valery"]Let me remind you that I do not use SD.[/quote]
&lt;p&gt;SoftDevice or not does not really matter, but since you wrote &amp;quot;SoftDevice(yet)&amp;quot;, I take it that you intend to use in in the future? Therefor it makes sense to me to mention it where it might be relevant.&lt;/p&gt;
[quote user="Valery"] implemented the alarm clock on RTC2, for waking up once a month.[/quote]
&lt;p&gt;I do not see any reason for using a dedicated RTC for an alarm clock. That is a perfect example of where you want to use an app timer or FreeRTOS timer instead. The &lt;a href="https://www.nordicsemi.com/DocLib/Content/SDK_Doc/nRF5_SDK/v15-2-0/lib_timer"&gt;app timer library&lt;/a&gt; is essentially made to make it easier to make multiple virtual timers form a single physical RTC instance.&lt;/p&gt;
[quote user="Valery"]What should I do for a deep sleep app with FreeRTOS?[/quote]
&lt;p&gt;What do you mean by deep sleep? Do you mean system off (where you need an external wakeup source), or do you mean system ON low power mode? As we are discussing waking up once a month, then I assume the latter. And in that case, you essentially just make a normal timer based on the RTC, for instance a app timer or a FreeRTOS timer directly (use&amp;nbsp;xTimerCreate). Note that you may have to wake up more than once a month due to the wraparound time of the RTC, but that has no practical impact on average current consumption.&lt;/p&gt;
&lt;p&gt;In short, make a timer that times out regularly and keep track of time based on that. Other than that, go to system off low power mode (using something like __SEV(); __WFE(); __WFE();, and moving to sd_app_evt_wait when you introduce the SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171643?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 13:32:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b136b101-43ce-4af9-9a16-730c8a3ec93d</guid><dc:creator>Valery</dc:creator><description>&lt;p&gt;Hi!&lt;/p&gt;
&lt;p&gt;I realized that SysTimer can not be used.&amp;nbsp;Let me remind you that I do not use SD.&amp;nbsp;I implemented the alarm clock on RTC2, for waking up once a month.&amp;nbsp;What should I do for a deep sleep app with FreeRTOS?&amp;nbsp;Stop RTC1 counter? Thank you.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171626?ContentTypeID=1</link><pubDate>Mon, 18 Feb 2019 13:03:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b3c3084e-a3b0-42fd-baa9-0c4eacbcffa4</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As &lt;a href="https://devzone.nordicsemi.com/members/turboj"&gt;Turbo J&lt;/a&gt; wrote, you should stick with using the RTC. There is nothing to gain by using the SysTick timer as the current consumption is negligible (an RTC instance only consumes about&amp;nbsp;0.1&amp;nbsp;µA since the LF clock must anyway always be running once you enable the SoftDevice).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171182?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 14:43:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ead91ec-86c1-4527-bd6c-bdad57934bcb</guid><dc:creator>Valery</dc:creator><description>&lt;p&gt;I do not use SoftDevice(yet). I want to&amp;nbsp;know can be used SysTick in FreeRTOS.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171181?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 14:31:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1064b422-5657-47ce-8e92-583738fc1123</guid><dc:creator>Turbo J</dc:creator><description>&lt;p&gt;This unfortunately breaks all timing in FreeRTOS, since the basis timer will now run roughly at 1/1000 the rated speed. &lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Also did you do the stuff with NVIC_SetPriority()? The SoftDevice will generate faults otherwise - it checks internal BTLE timing very precisely.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/171033?ContentTypeID=1</link><pubDate>Thu, 14 Feb 2019 08:41:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b9e322b-e8ab-40f4-9b66-90b8a4b63b21</guid><dc:creator>Valery</dc:creator><description>&lt;p&gt;I will explain my problem. I need to minimize consumption, so the processor will sleep 99.9% of the time and wake up on RTС2. So, I want to transfer FreeRTOS to SysTimer and&amp;nbsp;so turn off all the processes.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/170886?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 12:58:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5482bc98-94fb-454b-a3f2-520566a774cf</guid><dc:creator>Valery</dc:creator><description>&lt;p&gt;It&amp;#39;s clear,&amp;nbsp;I removed the line &amp;quot;SCB-&amp;gt;SCR |= SCB_SCR_SLEEPDEEP_Msk;&amp;quot; in &amp;quot;main.c&amp;quot;.&amp;nbsp;How to make&amp;nbsp;the core not fall to sleep mode and&amp;nbsp;and the application worked?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: FreeRTOS and RTC</title><link>https://devzone.nordicsemi.com/thread/170874?ContentTypeID=1</link><pubDate>Wed, 13 Feb 2019 12:42:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:45312092-661b-4f27-bc09-2d0d4baa795d</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="76886" url="~/f/nordic-q-a/43669/freertos-and-rtc"]The application has stopped working. What am I doing wrong?[/quote]
&lt;p&gt;SYSTICK does not run when the core is in sleep mode. HFINT and HFCLK are stopped in order to save power - only the RTC is kept running.&lt;/p&gt;
&lt;p&gt;One can even abuse this behaviour to implement a CPU load gauge - just count actual SYSTICK interrupts per second. Does not work with a connected debugger, though.&lt;/p&gt;
&lt;p&gt;You must remember to set the Priority to a different value, as default zero is reserved by the softdevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>