<?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>Maximal power efficiency in main loop - further question</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37681/maximal-power-efficiency-in-main-loop---further-question</link><description>Hi, 
 I asked previously about power efficiency for the NRF52840 SDK version V15 ( https://devzone.nordicsemi.com/f/nordic-q-a/36083/maximal-power-efficiency-in-main-loop ). 
 At that time I used the timer to poll the SPI using SPIM and timer event callbacks</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 22 Aug 2018 11:40:22 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37681/maximal-power-efficiency-in-main-loop---further-question" /><item><title>RE: Maximal power efficiency in main loop - further question</title><link>https://devzone.nordicsemi.com/thread/145296?ContentTypeID=1</link><pubDate>Wed, 22 Aug 2018 11:40:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a287f91d-def2-4238-a09b-33da857ab5b9</guid><dc:creator>Daniel Reisfeld</dc:creator><description>&lt;p&gt;Sigurd, Great, Thanks! Daniel&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Maximal power efficiency in main loop - further question</title><link>https://devzone.nordicsemi.com/thread/145291?ContentTypeID=1</link><pubDate>Wed, 22 Aug 2018 11:24:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50042f9f-1fbc-4d5e-ad03-d963c196025b</guid><dc:creator>Sigurd</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote userid="67166" url="~/f/nordic-q-a/37681/maximal-power-efficiency-in-main-loop---further-question"]Do I need to change my main loop?[/quote]
&lt;p&gt;No. After the CPU is done with the&amp;nbsp;interrupt handler, it will go back to main context and go to sleep.&lt;/p&gt;
&lt;p&gt;Note that if you are using the nrf_log module, you might want to process pending log operations before going to sleep using&amp;nbsp;NRF_LOG_PROCESS().&lt;/p&gt;
&lt;p&gt;Note that in SDK 15, the BLE examples mostly uses the p&lt;span&gt;ower management module. So it typically&amp;nbsp;looks like this:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;    // Enter main loop.
    for (;;)
    {
        idle_state_handle();
    }&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;where&amp;nbsp;idle_state_handle() is defined as:&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**@brief Function for handling the idle state (main loop).
 *
 * @details Handle any pending log operation(s), then sleep until the next event occurs.
 */
static void idle_state_handle(void)
{
    if (NRF_LOG_PROCESS() == false)
    {
        nrf_pwr_mgmt_run();
    }
}&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>