<?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>Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/68527/sleep-modes-on-the-nrf9160-dk</link><description>Hi All, I&amp;#39;ve just received an nrf9160dk, I&amp;#39;m starting to investigate the development of our application while the hardware guys produce a custom board. 
 I&amp;#39;m just starting with the power management and sleep modes for the nrf9160. The form of the application</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 30 Nov 2020 10:32:30 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/68527/sleep-modes-on-the-nrf9160-dk" /><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/282408?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2020 10:32:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2253aef2-62c0-4cc8-93a9-dfd12c20fb5e</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hello again, Skipper!&lt;br /&gt;&lt;br /&gt;I understand. My bad! You can de-init peripherals during runtime. Given that you don&amp;#39;t need printk I suggest using&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/members/mjd093"&gt;MJD093&lt;/a&gt;&amp;#39;s approach in&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/55037/disabling-nrf9160-uart-during-runtime"&gt;this thread&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;The developers haven&amp;#39;t added support for the non-secure partition of the nRF9160 to that sample from what I can see. It should work if you unzip the attached archive and add the files to the &amp;quot;boards&amp;quot; folder in the sample!&lt;br /&gt;&lt;br /&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/3568.nrf916ns_5F00_conf_5F00_overlay.zip"&gt;devzone.nordicsemi.com/.../3568.nrf916ns_5F00_conf_5F00_overlay.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/282359?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2020 21:37:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b4215512-4f89-44d4-9a6c-54550d39d6df</guid><dc:creator>skipper</dc:creator><description>&lt;p&gt;We don&amp;#39;t need the UART in sleep, is there any way to de-init&amp;nbsp;the serial &lt;span&gt;peripheral&amp;nbsp;&lt;/span&gt;before sleep that has the same effect as&amp;nbsp;setting the CONFIG_&lt;span&gt;SERIAL&lt;/span&gt;=n?&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Aditionally the LPUART sample provided doesn&amp;#39;t compile with the below errors:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;3&amp;gt; In file included from C:/Users/josh/ncs/v1.4.0/zephyr/include/arch/arm/aarch32/arch.h:20,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/arch/cpu.h:19,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/kernel_includes.h:38,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/kernel.h:17,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/init.h:11,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/device.h:22,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/zephyr/include/drivers/uart.h:26,
3&amp;gt;                  from C:/Users/josh/ncs/v1.4.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c:7:
3&amp;gt; C:/Users/josh/ncs/v1.4.0/zephyr/include/devicetree.h:297:40: error: &amp;#39;DT_N_INST_0_nordic_nrf_sw_lpuart_BUS_P_label&amp;#39; undeclared here (not in a function)&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/281966?ContentTypeID=1</link><pubDate>Thu, 26 Nov 2020 08:45:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7c861e09-085f-4f9a-9637-c3f8ff8c496f</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi again, Skipper!&lt;br /&gt;&lt;br /&gt;Good to hear!&amp;nbsp; The device is able to go to sleep with serial enabled, but it will consume quite a lot more current (~900uA). However, with version 1.4.0 of the nRF Connect SDK we released a &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/drivers/uart_nrf_sw_lpuart.html#uart-nrf-sw-lpuart"&gt;Low Power UART driver&lt;/a&gt;&amp;nbsp;that doesn&amp;#39;t rely on the serial flag. I haven&amp;#39;t tested the actual power consumption when using the driver yet, but you can have a look at the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/nrf/samples/peripheral/lpuart/README.html"&gt;sample demonstrating how it&amp;#39;s used&lt;/a&gt;.&lt;br /&gt;&lt;br /&gt;You should not need to disable the RTT logging before going to sleep from what I know, but I will double check that.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/281928?ContentTypeID=1</link><pubDate>Thu, 26 Nov 2020 04:21:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c46a41ab-e471-4930-adba-9ccf3274be43</guid><dc:creator>skipper</dc:creator><description>&lt;p&gt;Hi Carl,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;We were able to get the sleep current down to the around ~3 uA thanks for the help!&lt;br /&gt;&lt;br /&gt;&lt;span&gt;We have external devices that we want to talk to via UART. Currently, I&amp;#39;m using zephyr&amp;#39;s UART implementation which works well but when I disable serial (CONFIG_SERIAL=n) my code fails to compile: &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;quot;uart.h:180: undefined reference to `z_impl_uart_irq_rx_enable&amp;#39;&amp;quot;,&lt;br /&gt;&lt;br /&gt;&lt;/span&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;&lt;span&gt;Is there something I&amp;#39;m missing or is the NRF9160 unable to go into low power sleep if built with the serial flag enabled?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;We&amp;#39;ve got CONSOLE, RTT_CONSOLE and PRINTK enabled so we can use printk to debug through Segger RTT. &lt;br /&gt;&lt;br /&gt;Will we need to disable this before going to sleep?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Cheers, &lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Skipper&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/281631?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2020 15:19:32 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e65e0713-10ae-4e41-8edd-8924a5e975b6</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi!&lt;br /&gt;&lt;br /&gt;I&amp;#39;ve attached an application that achieves average sleep current of ~3.16 µA using only k_sleep(i.e the RTC), as well as the following prj.conf:&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_SYS_POWER_MANAGEMENT=y
CONFIG_SYS_POWER_DEEP_SLEEP_STATES=y
CONFIG_SYS_PM_STATE_LOCK=y
CONFIG_SERIAL=n
CONFIG_DK_LIBRARY=y&lt;/pre&gt;&lt;br /&gt;It seems like SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1 somehow forced the device to stay sleeping(or off, as the current consumed was far below our minimum specs), but I&amp;#39;m not sure why. Notice as well that I&amp;#39;ve added the CONFIG_SYS_PM_STATE_LOCK.&lt;br /&gt;&lt;br /&gt;In addition you should add CONFIG_SERIAL=n to the prj.conf of the SPM sample, located at &lt;strong&gt;&amp;lt;ncs_root&amp;gt;/nrf/samples/spm.&lt;/strong&gt; Hope this helps you on your way, if not I&amp;#39;ll take a look at your RTC handling as well.&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/4578.sleep.zip"&gt;devzone.nordicsemi.com/.../4578.sleep.zip&lt;/a&gt;&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/281228?ContentTypeID=1</link><pubDate>Mon, 23 Nov 2020 02:25:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d86b00b1-85cc-4ffb-b337-db8d53d030da</guid><dc:creator>skipper</dc:creator><description>&lt;p&gt;Hi Carl,&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;Your answer has got us most of the way there, we&amp;#39;ve just got one problem with deep sleep.&amp;nbsp;&lt;br /&gt;prf.config&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;SYS_POWER_DEEP_SLEEP_STATES=y
SYS_PM_MIN_RESIDENCY_DEEP_SLEEP_1=1000&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;main.c&lt;/p&gt;
&lt;pre class="c-mrkdwn__pre"&gt;&lt;pre class="ui-code" data-mode="text"&gt;void main(void) {
   nrf_gpio_cfg_output(LED_0);
   while (1) {
      nrf_gpio_pin_toggle(LED_0);
      k_sleep(K_MSEC(500));
      nrf_gpio_pin_toggle(LED_0);
      k_sleep(K_MSEC(5000));
   }
}&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;&lt;/pre&gt;
&lt;div class="p-rich_text_section"&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;This blinks the LED once goes into deep sleep and never wakes.&amp;nbsp;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;Attempt to use RTC:&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;const nrfx_rtc_t rtc = NRFX_RTC_INSTANCE(0);
static void rtc_handler(nrfx_rtc_int_type_t int_type) {
  if (int_type == NRFX_RTC_INT_COMPARE0) {
    nrf_gpio_pin_toggle(LED_0);
  }
}
static void rtc_config(void) {
  uint32_t err_code;
  nrfx_rtc_config_t config = NRFX_RTC_DEFAULT_CONFIG;
  config.prescaler = 4095;
  err_code = nrfx_rtc_init(&amp;amp;rtc, &amp;amp;config, rtc_handler);
  if (err_code != NRFX_SUCCESS) {
    printk(&amp;quot;Failure in setup\n&amp;quot;);
    return;
  }
  nrfx_rtc_cc_set(&amp;amp;rtc, 0, 10, true);
  nrfx_rtc_enable(&amp;amp;rtc);
}
void main(void) {
   nrf_gpio_cfg_output(LED_0);
   rtc_config();
   IRQ_DIRECT_CONNECT(RTC0_IRQn, 0, nrfx_rtc_0_irq_handler, 0);
   irq_enable(RTC0_IRQn);
   nrf_gpio_pin_toggle(LED_0);
   k_sleep(K_MSEC(500));
   nrf_gpio_pin_toggle(LED_0);
   sys_set_power_state(SYS_POWER_STATE_DEEP_SLEEP_1);
}&lt;/pre&gt;&lt;/div&gt;
&lt;div class="p-rich_text_section"&gt;&lt;/div&gt;
&lt;pre class="c-mrkdwn__pre"&gt;&lt;/pre&gt;
&lt;div class="p-rich_text_section"&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;This blinks the LED once goes into deep sleep and never wakes. RTC seemingly gets unpowered?&lt;br /&gt;&lt;br /&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;&lt;span class="c-mrkdwn__br"&gt;&lt;/span&gt;If I set SYS_POWER_DEEP_SLEEP_STATES=n then it works, LED blinks continuously but only enters sleep (not deep sleep). De-initing bsdlib and CONFIG_SERIAL=n made normal sleep current consumption much better (now in uA) but ideally want to get to deep sleep.&lt;br /&gt;&lt;br /&gt;Cheers,&amp;nbsp;&lt;br /&gt;Skipper&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes on the nrf9160 DK</title><link>https://devzone.nordicsemi.com/thread/281039?ContentTypeID=1</link><pubDate>Fri, 20 Nov 2020 08:26:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ef1844e-8c0e-492a-ac51-a17e7a74252e</guid><dc:creator>Carl Richard</dc:creator><description>&lt;p&gt;Hi, Skipper!&lt;br /&gt;&lt;br /&gt;Zephyr handles power management quite well in the backround, requiring little effort in terms of dedicated function calls.&amp;nbsp;Using the function &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/kernel/threads/index.html?highlight=k_sleep#c.k_sleep"&gt;k_sleep&lt;/a&gt;&amp;nbsp;puts the thread from which it&amp;#39;s called into sleep. If all threads in the application are sleeping the OS will put the device in low power operation, with the RTC running. For your case I suggest having main wakeup every 5 minutes&amp;nbsp;to do sampling while you have a separate timer that fires every eight hours, setting a &amp;quot;upload&amp;quot; flag for example.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Note that serial operation should be deactivated for optimal power consumption. This can be done by setting CONFIG_SERIAL=n in prf.conf. If you are using other peripherals they may have to be deinitialized or turned off.&amp;nbsp; For information on that, as well as more details around power management in Zephyr I suggest reading up on the &lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/latest/zephyr/reference/power_management/index.html#power-management"&gt;Zephyr Power Management API&lt;/a&gt;.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope this answers your question!&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Carl Richard&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>