<?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>nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/24733/nrf52840-sdk-14-0-0-and-tickless-idle-freertos---some-suggestions</link><description>This post is more about some suggestions for review rather than a question. 
 I&amp;#39;ve been looking at implementing a project using the nRF52840, SDK 14.0.0 and FreeRTOS in a low power application. The release note for SDK 14.0.0. indicates that FreeRTOS</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 17 Nov 2020 20:40:35 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/24733/nrf52840-sdk-14-0-0-and-tickless-idle-freertos---some-suggestions" /><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/280474?ContentTypeID=1</link><pubDate>Tue, 17 Nov 2020 20:40:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b343790c-2dc1-49b2-bd91-e64192e529c7</guid><dc:creator>BretH</dc:creator><description>&lt;p&gt;Sorry for nesting this under another comment., but due to the age of this ticket, I&amp;#39;m forced to reply to a comment.&lt;/p&gt;
&lt;p&gt;For any future consumers of &amp;#39;s solution, which I do find to be quite nice, there are a few things to watch out for.&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;In ISRs that wake the cpu from sleep, the tick count will be stale, meaning any FreeRTOS call that relies on the tick value will be inaccurate. I found out the hard way that my software timer started from an ISR was inaccurate because the RTOS tick count isn&amp;#39;t updated until after the ISR completes. Austin hints at this in the description, but I thought it would be useful to explicitly call out.&lt;/li&gt;
&lt;li&gt;While it is common practice to minimize time in ISRs, there is a race condition with the RTC tick and ISR completion when waking from sleep. If sleep is exited due to the RTC timeout and then an interrupt occurs prior to reading the RTC counter for performing the vTaskStepTick(diff) operation, if the interrupt&amp;#39;s ISR runs long enough for another RTC tick to occur, then the tick correction&amp;#39;s diff value will exceed&amp;nbsp;
&lt;div&gt;&lt;span&gt;&lt;span&gt;xExpectedIdleTime. If&amp;nbsp;&lt;/span&gt;&lt;/span&gt;configUSE_TICKLESS_IDLE_SIMPLE_DEBUG is defined, a tick will be lost. If not defined,&amp;nbsp;vTaskStepTick will assert if enabled.&lt;/div&gt;
&lt;/li&gt;
&lt;/ol&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/160856?ContentTypeID=1</link><pubDate>Sun, 09 Dec 2018 22:57:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:dca6b289-9d80-4c60-9c75-90b9d04dae3a</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;Thanks for posting your current consumption statistics, that&amp;#39;s a great result.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/160817?ContentTypeID=1</link><pubDate>Fri, 07 Dec 2018 23:18:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:185271eb-3035-4620-b3bc-d0a10e254d3e</guid><dc:creator>grzegorz</dc:creator><description>&lt;p&gt;Hi Austin!&lt;/p&gt;
&lt;p&gt;Great work! With your code current consumption on my nRF52832 custom board dropped from 1 mA to 0,1 mA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/153142?ContentTypeID=1</link><pubDate>Wed, 17 Oct 2018 08:13:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4225d245-1f66-48f8-8b10-bc7c872dc967</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Ing,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;A quick test with SDK15.2 on PCA10056 DK with ble_app_hrs_freertos example gives me these results&amp;nbsp;while advertising&lt;/p&gt;
&lt;p&gt;1) Tickless IDLE enabled ~700uA&lt;/p&gt;
&lt;p&gt;2) Tickless IDLE disable and forever looking with sd_app_evt_wait() in vApplicationIdleHook gives around ~920uA while advertising.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/142272?ContentTypeID=1</link><pubDate>Wed, 01 Aug 2018 00:55:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ee960582-b315-4f54-a573-9eb95ca7e38a</guid><dc:creator>inghowe83</dc:creator><description>&lt;p&gt;Hi there I also working on tickless topics. May I know what was the current consumption value for non tickless vs tickless for rRF52832 which you managed to get from your board? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97394?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2017 01:02:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:01404f28-77a6-4385-a0a4-0e6748f5bbec</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;nRF52832 on both Custom board and the DK using S132.  Compiled with GCC.  HRS freeRTOS example from the SDK.  Measurements with Rigol multimeter.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97393?ContentTypeID=1</link><pubDate>Fri, 01 Sep 2017 00:57:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:372af0dc-2729-4d7d-943c-7077dddb8359</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@Nguyen Which board, compiler and SoftDevice are you using?  From what I can gather in other posts, tickless on pca10040 with S132 is likely working with low power.  In my case with pca10056 and S140 it&amp;#39;s not.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97389?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 23:30:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3e4ccd2-3704-4233-ad14-c56ccdc1b164</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;Worst is that we started with SDK13.  We couldn&amp;#39;t get bellow 3mA no mater tickless or IdleHook.  Then we decided to test with SDK14 and the result was as I described in previous comment.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97392?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 22:42:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:561d53ef-b875-470b-8ccf-6eeb125b5a0e</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@Aryan Thanks, definitely be interested to hear feedback from your developer.  I&amp;#39;m surprised by results from @Nguyen.  As tick is still active if vApplicationIdleHook is used to sleep CPU, CPU will be waking at least every 1ms with current FreeRTOSConfig.h and so presume would use more power than a tickless implementation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97390?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 18:07:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0abdfa5d-51e3-4b4b-9641-4b589c72e8e1</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;This is interesting, seems like the tickless mode have some corner case regarding the idle sleep.
if disabling tickless and using IdleHook keeps the current below 50uA, then i think we should use that instead. I haven&amp;#39;t done this testing but this seems acceptable workaround for now. I will ask the developer to look into this thread whenever possible.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97395?ContentTypeID=1</link><pubDate>Thu, 31 Aug 2017 04:05:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4e407ce6-7594-415e-aa7c-48b076b64b7e</guid><dc:creator>Nguyen Hoan Hoang</dc:creator><description>&lt;p&gt;I have done some testing too.  Using the HRS freeRtos example code.  With tickless enable, below 1mA for a few second then jumps up to 7mA.  Disable tickless and use IdleHook, can get down to bellow 50uA.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97391?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 23:07:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:04e6b5da-ba63-4163-9efc-296f11e8e813</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@gkovelman_tap I&amp;#39;m just using the ble_app_hrs{_freertos} example, I&amp;#39;ve been more interested in comparative measurements between FreeRTOS/non-FreeRTOS examples.  For pca10056, that difference is over 6mA.  Nordic hrs example without FreeRTOS 650uA, hrs example with FreeRTOS 6.7mA, with my FreeRTOS changes 670uA.  As you indicate, there&amp;#39;s additional things I can do to minimise the power.  I suspect the FreeRTOS tickless behaviour on pca10056 is related to use of S140, it&amp;#39;s possibly got a different timing profile for its BLE interrupts and this is usually masked in normal apps by the tight while(1) { sd_app_event_wait(); process() } loops in main().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97387?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 22:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4b90f819-1171-4d13-9e76-e6dbb0077e52</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@Eric I&amp;#39;ve re-uploaded the tgz to the post (I likely made an error during upload), please retry&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97386?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 18:00:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:09817327-0360-4b54-ab2e-077e003d3cd9</guid><dc:creator>Eric Smith</dc:creator><description>&lt;p&gt;Thanks for sharing this; I&amp;#39;ve been trying to do similar things but have not made as much progress. I&amp;#39;m trying to download your ble_app_hrs_freertos_pca10056.tgz, but when I click on the link, the web site gives me port_cmsis_systick_with_profiling.c instead, consistently. Web site malfunction? Could you put the tgz online somewhere else?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97388?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 11:18:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b693b6d6-d50a-4cf9-8569-61a9c9d570f8</guid><dc:creator>gkovelman_tap</dc:creator><description>&lt;p&gt;Using a custom board with NRF52832, S132 v5.0.0, SDK 14.0.0, IAR 7.80.4.
Honestly, the only issue is the FPU errata. I can&amp;#39;t tell the NRF52&amp;#39;s exact consumption, but it is less than 100uA.
Make sure that you don&amp;#39;t measure the consumption when debugging and you don&amp;#39;t have any logging such as RTT logging. What are the numbers that you&amp;#39;re seeing?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97399?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 11:07:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c7b62c2d-fdcd-4875-820c-3a7f954c1bd8</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@gkovelman_tap Thanks for information about your setup, good to have another data point.  A colleague independently ported ble_app_hrs_freertos to PCA10056 using IAR compiler and he obtained the same high &amp;gt; 6mA consumption measurements so I assumed that it was an issue with the source, not our setup.  What board are you using and what consumption do you achieve with tickless?  Which SoftDevice are you using?  For profiling I added a counter after sd_app_event_wait() in port_cmsis_systick.c (line 284) and found that this line was being hit a very large number of times.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97385?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 07:33:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:116bdd17-8b43-42c6-b3c0-6c14505a8b3f</guid><dc:creator>gkovelman_tap</dc:creator><description>&lt;p&gt;@Austin I&amp;#39;ve had the same consumption issues with the tickless mode in SDK 14 but they were quickly resolved with the FPU fix. That&amp;#39;s why I&amp;#39;m asking about the other issues. I haven&amp;#39;t seen myself any reasons for waking up sporadically. There&amp;#39;s also some tickless implementation issue described here: &lt;a href="https://devzone.nordicsemi.com/question/73962/freertos-tick-count-invalid-when-using-tickless-idle/"&gt;devzone.nordicsemi.com/.../&lt;/a&gt; but it&amp;#39;s not causing high power consumption much&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97397?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 07:05:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:849f785e-ab80-420f-ae70-6a2bc271db39</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@gkovelman_tap I don&amp;#39;t believe the consumption improvements are due to FPU errata.  Both the current measurements listed above contain the FPU fix so there is definitely something else causing current consumption.  I was surprised that tickless idle as implemented in SDK 14.0.0 didn&amp;#39;t appear to sleep the CPU (sd_app_event_wait() always exits immediately).  Any interrupt in the system will case the CPU event flag to be set even when not in idle, including tick interrupts and this would cause SDK 14 implementation to drop out of tickless idle immediately on each iteration.  I wonder if others have experienced high current consumption with tickless idle?  It seems strange to me that I would be the first to encounter this.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97396?ContentTypeID=1</link><pubDate>Wed, 30 Aug 2017 06:57:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d45b0d4d-b4f1-4a0c-9385-fd5aed5504fa</guid><dc:creator>gkovelman_tap</dc:creator><description>&lt;p&gt;@Austin most of it was probably from the FPU errata. Did you see any improvement from the other suggestions you made?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97384?ContentTypeID=1</link><pubDate>Tue, 29 Aug 2017 23:16:17 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:28c2f016-011c-4d18-9413-59ae2cba0e0d</guid><dc:creator>Austin</dc:creator><description>&lt;p&gt;@Aryan With original port_cmsis_systick.c, measured 7.3mA.  With updated port, 670uA.  Measured using PPK on PCA10056, connected via BLE with heart rate characteristic enabled.  The 7.3mA indicates a CPU spinning hard (ie tickless not working at all) and this was borne out by my investigations when profiling how many times sd_app_event_wait() was called; it was called thousands of time in a few seconds for the original implementation.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52840, SDK 14.0.0 and tickless idle FreeRTOS - some suggestions</title><link>https://devzone.nordicsemi.com/thread/97398?ContentTypeID=1</link><pubDate>Tue, 29 Aug 2017 11:33:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72f44be5-968b-405d-a6fe-fcbd7237ac96</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Thanks Austin,
Before i can pass this information , could i ask you how much power consumption improvement you noticed in numbers?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>