<?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>Entering low power modes in zephyr environment</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108781/entering-low-power-modes-in-zephyr-environment</link><description>Hello everyone, 
 
 I am having trouble understanding how to enter power saving modes. I understand that once there are no tasks to run, the scheduler selects idle task which puts the mcu into system on power saving mode. However, it is not exactly clear</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 01 Mar 2024 07:39:57 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108781/entering-low-power-modes-in-zephyr-environment" /><item><title>RE: Entering low power modes in zephyr environment</title><link>https://devzone.nordicsemi.com/thread/471685?ContentTypeID=1</link><pubDate>Fri, 01 Mar 2024 07:39:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a6ddf96a-1bf7-49d3-96cb-3d5a4aecf41d</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;The default behaviour in most modules is to race to idle and wait for events. And this is how you shoud do with your tasks as well. There are many mechanisms that help you do this, which to use depend on the use case. The typical is k_sleep to wait for a defined time, or&amp;nbsp;&amp;nbsp;semaphore, mutex, fifo or message queues and wait for something there (you can also use a timeout if you won&amp;#39;t want to wait forever). You can see an example of this with a FIFO in the &lt;a href="https://docs.nordicsemi.com/bundle/ncs-latest/page/zephyr/samples/basic/threads/README.html"&gt;Basic thread manipulation sample&lt;/a&gt;.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering low power modes in zephyr environment</title><link>https://devzone.nordicsemi.com/thread/471624?ContentTypeID=1</link><pubDate>Thu, 29 Feb 2024 16:28:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:947bc2e7-c65a-4c96-b813-11b387869284</guid><dc:creator>LameCode</dc:creator><description>&lt;p&gt;Thank you for your answer.&amp;nbsp;&lt;/p&gt;
[quote userid="7377" url="~/f/nordic-q-a/108781/entering-low-power-modes-in-zephyr-environment/471541"]As long as no tasks run, the idle thread will run, and put the device to sleep.[/quote]
&lt;p&gt;This is exactly my point. How do&amp;nbsp;I make this happen - that no tasks run. I want to run tasks normally when device is in active state&amp;nbsp;in such manner as I presented in pseudocode. And then, by my command, I want to stop those same tasks from running for as long as I want. Then, whenever I want, with a push of a button or some other interrupt, I want those tasks to resume working normally.&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t want to just sleep in between tasks, I want my system to stay&amp;nbsp;idle continuously for any amount of time. I hope you understand what I mean.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Entering low power modes in zephyr environment</title><link>https://devzone.nordicsemi.com/thread/471541?ContentTypeID=1</link><pubDate>Thu, 29 Feb 2024 13:17:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e45713f0-1d9b-4fb9-bba8-f81f4e85ba6b</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;As you write, the idle thread will enter low power mode (essentially wait for event - WFE). It will stay there until woken up by an event/interrupt. This can be externally (like from a GPIO or similar, or from the RTC, which the Zephyr scheduler use to keep track of time).&lt;/p&gt;
[quote user=""]when gpio interrupt fires, I should create a new task which would just idle forever[/quote]
&lt;p&gt;No, you do not need to create anything to enter sleep mode. As long as no tasks run, the idle thread will run, and put the device to sleep.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>