<?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>Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65148/tickless-implementation-using-rtc-causes-freertos-idle-to-loop-for-one-tick</link><description>Hi 
 while developing I&amp;#39;ve discovered that the current tickless implementation using RTC causes the idle task to loop for one tick before waking the next task up. 
 I&amp;#39;ve instrumented the following point with a debug port toggle: 
 
 
 the following in</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 31 Aug 2020 11:52:48 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65148/tickless-implementation-using-rtc-causes-freertos-idle-to-loop-for-one-tick" /><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/267220?ContentTypeID=1</link><pubDate>Mon, 31 Aug 2020 11:52:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c0c11ab-e799-42d8-8c11-21e7e3601dc4</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;I took a look at it and replied. Please use that thread to respond and not here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/267184?ContentTypeID=1</link><pubDate>Mon, 31 Aug 2020 11:06:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:862d6a83-586b-4603-a33c-7b5a1d06a008</guid><dc:creator>dfer</dc:creator><description>&lt;p&gt;Hi Susheel I&amp;#39;ve posted this topic:&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;"&gt;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/65415/interrupts-not-waking-freertos-up-in-tickless-mode"&gt;devzone.nordicsemi.com/.../interrupts-not-waking-freertos-up-in-tickless-mode&lt;/a&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p style="color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="background-color:#ffffff;"&gt;if you could help it would be very appreciated.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/266509?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 13:04:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0331f3e6-b6c6-4fac-950b-52e9b1827bda</guid><dc:creator>Susheel Nuguru</dc:creator><description>[quote user="dfer"]Are you going to integrate this in the SDK?&amp;nbsp;[/quote]
&lt;p&gt;&amp;nbsp;Yes Davide,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This fix will go into the SDK after some testing.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/266508?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 12:56:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:41cdab3b-f79a-469d-8c90-887c75cefeca</guid><dc:creator>dfer</dc:creator><description>&lt;p&gt;Thank you Susheel&lt;/p&gt;
&lt;p&gt;Yes so actually you emulate in &lt;span style="background-color:#ffffff;"&gt;vPortSuppressTicksAndSleep&lt;/span&gt; what the interrupt already does.&lt;/p&gt;
&lt;p&gt;So our solutions are similar. I&amp;#39;ll consider to move to your solution. Are you going to integrate this in the SDK?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Regards.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/266491?ContentTypeID=1</link><pubDate>Wed, 26 Aug 2020 12:23:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7dde7ac-b2a8-484f-88ba-9e25db022c40</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi Davide,&lt;/p&gt;
&lt;p&gt;You have done a nice investigation. This is actually a bug in the tick handling and I have recently come to have known of it from &lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/63828/vtaskdelay-on-nrf52-freertos-port-wastes-cpu-power"&gt;this &lt;/a&gt;thread.&lt;/p&gt;
&lt;p&gt;The issue in both of the threads is identified correctly.&amp;nbsp;xTaskIncrementTick has a special meaning for FreeRTOS as it also hints the scheduling changes. But for the diff more than 1 this was not handled correctly.&lt;/p&gt;
&lt;p&gt;In my last reply in the given thread, I have proposed a similar but smaller workaround that seems to work as intended.&lt;/p&gt;
&lt;p&gt;The change is to call&amp;nbsp;&lt;span&gt;xTaskIncrementTick irrespective of the tick is greater or equal to one.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Tickless implementation using RTC causes FreeRTOS idle to loop for one tick</title><link>https://devzone.nordicsemi.com/thread/266220?ContentTypeID=1</link><pubDate>Tue, 25 Aug 2020 12:00:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8a45fa3-382e-4f2c-bb5f-8cdfaac39126</guid><dc:creator>dfer</dc:creator><description>&lt;p&gt;As info, the actual delayed Task is activated in&amp;nbsp;&lt;span style="background-color:#ffffff;"&gt;xTaskResumeAll&lt;/span&gt;, because the&amp;nbsp;&lt;span style="background-color:#ffffff;"&gt;uxPendedCounts&lt;/span&gt; variable is found set.&lt;/p&gt;
&lt;p&gt;This variable is incremented in the tick Interrupt when the function&amp;nbsp;&lt;span style="background-color:#ffffff;"&gt;xTaskIncrementTick&lt;/span&gt; isc called (after the __WFE, in my solution). The Scheduler is locked at this time, so that the only thing done is incrementing this variable.&lt;/p&gt;
&lt;p&gt;But of Course, if the function&amp;nbsp;&lt;span style="background-color:#ffffff;"&gt;xTaskIncrementTick&lt;/span&gt;&lt;span style="background-color:#ffffff;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt; &lt;/span&gt;is not called, the variable is not incremented and the mentioned Problem happens.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>