<?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>Power consumption is too high</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/108104/power-consumption-is-too-high</link><description>I am using the PCA10028 to connect to my board and use Segger embedded studio. I am unable to bring my power consumption below 1 mA. 
 To exclude my hardware from the equation, I decided to connect the EEPROM I&amp;#180;m using (24LC16) and one key to the PCA10028</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 14 Feb 2024 12:27:04 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/108104/power-consumption-is-too-high" /><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468801?ContentTypeID=1</link><pubDate>Wed, 14 Feb 2024 12:27:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d4a32cb3-ef01-43dd-bbc5-e8438f9f5f39</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Yes. This is another problem! I tried during 2 days to solve the toolchain crash problem without success!&lt;/p&gt;
&lt;p&gt;I did however succeed to flash the&amp;nbsp;power management example and the consumption is nearly 0 when system is off (my voltmeter measure 0.0 mV over 22 Ohm).&amp;nbsp; This confirms that my measurement setup is correct.&lt;/p&gt;
&lt;p&gt;As you can see by my history, this has been a recurrent problem in this project for years!&lt;/p&gt;
&lt;p&gt;I give up!&lt;/p&gt;
&lt;p&gt;I am handing over the project to someone else and it is up to him to solve or change to another solution.&lt;/p&gt;
&lt;p&gt;Anyway, thanks for your support, although it really didn&amp;#39;t help.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468341?ContentTypeID=1</link><pubDate>Mon, 12 Feb 2024 08:57:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:29332172-51f0-4a09-a615-61744c320604</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;This problem is not directly related to your original question regarding power consumption. I would suggest that you create a new ticket for this, so that we can focus in this discussion on resolving your original issue.&lt;/p&gt;
&lt;p&gt;You can always use nRF Command Line Tools to program your board if nRF Connect Programmer doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468267?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 16:40:27 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:185aae5d-1efe-47fc-b913-a73f63e13c36</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;While updating the nRF Connect App (Programmer was not working because out of date), it destroyed my Segger Embedded Studio. Now it can no longer run the code on my target board!&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Any idea what could be?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I can compile and download to the board but the program crashes.&lt;/p&gt;
&lt;p&gt;I restored my computer from a previous backup of the PC but it still doesn&amp;#39;t work.&lt;/p&gt;
&lt;p&gt;The software crashes when app_timer_start is called. I followed step-by-step and it crashes when it returns from the function. Does this mean the addresses on the controller are wrong?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I noticed there was no more Section Placement Macro so I defined again with te following settings:&lt;/p&gt;
&lt;p&gt;FLASH_PH_START=0x0&lt;/p&gt;
&lt;p&gt;FLASH_PH_SIZE=0x100000&lt;/p&gt;
&lt;p&gt;RAM_PH_START=0x20000000&lt;/p&gt;
&lt;p&gt;RAM_PH_SIZE=0x40000&lt;/p&gt;
&lt;p&gt;FLASH_START=0x1B000&lt;/p&gt;
&lt;p&gt;FLASH_SIZE=0xE5000&lt;/p&gt;
&lt;p&gt;SRAM_START=0x20002080&lt;/p&gt;
&lt;p&gt;SRAM_SIZE=0x1F80&lt;/p&gt;
&lt;p&gt;I believe these are right. Still the software crashes when app_timer_start is called.&lt;/p&gt;
&lt;p&gt;Any idea?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468189?ContentTypeID=1</link><pubDate>Fri, 09 Feb 2024 10:34:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:164a134d-a246-494e-9f92-8039eb7752b0</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="Sergio T"]I am not able to compile the power management project because I don&amp;#39;t have a compatible development environment (I don&amp;#39;t remember anynmore how I did it, as it was 5 years ago I started this!).&amp;nbsp;[/quote]
&lt;p&gt;There is already pre-compiled hex in the hex folder of the example, so there is no need to compile it. Just use nRF Command Line Tools or nRF Connect Programmer app to program the example to your board.&lt;/p&gt;
[quote user="Sergio T"]If I disconnect the USB and supply with a battery, then I would assume that the board would not work in DEBUG mode. Still I see similar consumption. How can I prevent or disconnect the DEBUG mode?[/quote]
&lt;p&gt;The device will exit DEBUG mode after a power cycle. Just make sure that you don&amp;#39;t connect to RTT or start a debug session and the device will not enter DEBUG Mode.&lt;/p&gt;
[quote user="Sergio T"]How can I set the controller to sleep? NRF_POWER-&amp;gt;SYSTEMOFF = 1; doesn&amp;#39;t work![/quote]
&lt;p&gt;To summarize, there is 2 kinds of sleep. There is SYSTEM OFF sleep where everything is turned off including all Timers and internal CLOCKs. This is the lowest kind of power saving mode the nRF can enter. An exit from System Off sleep will always result in a reset.&lt;/p&gt;
&lt;p&gt;The other kind of sleep is System On sleep (IDLE sleep). This will use more power than system off sleep. In IDLE sleep Timer and Clock can be active, it depends on your application. The CPU will exit System On (IDLE) sleep if an interrupt or event is generated, it will not reset the system when it exits System On sleep.&lt;/p&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;NRF_POWER&lt;/span&gt;&lt;span&gt;-&amp;gt;&lt;/span&gt;&lt;span&gt;&lt;span&gt;SYSTEMOFF is indeed the correct method to enter system off sleep. If you use the softdevice then you have to go trough the Softdevice API and use&amp;nbsp;&lt;/span&gt;&lt;/span&gt;
&lt;div&gt;
&lt;div&gt;&lt;span&gt;sd_power_system_off(). If you can&amp;#39;t see the current consumption decrease when you enter System Off sleep then either the device is woken up from System Off sleep immediately, or your current measurement setup is not correct. If you could try the example I suggested and put the device to System Off sleep by pressing button 1 then we could confirm whether&amp;nbsp;your measurement&amp;nbsp;setup is correct or not.&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;regards&lt;/span&gt;&lt;/div&gt;
&lt;div&gt;&lt;span&gt;Jared&amp;nbsp;&lt;/span&gt;&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;
&lt;/div&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468121?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2024 17:03:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:453a663c-67b1-4368-a81d-794470a108f0</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks for your reply. My measurement setup is probably not 100% accurate as I am measuring with too less resolution. Still the differences are there.&lt;/p&gt;
&lt;p&gt;I am not able to compile the power management project because I don&amp;#39;t have a compatible development environment (I don&amp;#39;t remember anynmore how I did it, as it was 5 years ago I started this!).&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Still, I would expect that changing the main.c and the sdk_config files would make the job, because all the rest is the same, but it doesn&amp;#39;t work!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If I disconnect the USB and supply with a battery, then I would assume that the board would not work in DEBUG mode. Still I see similar consumption. How can I prevent or disconnect the DEBUG mode?&lt;/p&gt;
&lt;p&gt;I think it is better I make another question:&lt;/p&gt;
&lt;p&gt;Do you have any documentation explaining how to select and configure the peripherals we need using the code you provide in your examples?&lt;/p&gt;
&lt;p&gt;How can I set the controller to sleep? NRF_POWER-&amp;gt;SYSTEMOFF = 1; doesn&amp;#39;t work!&lt;/p&gt;
&lt;p&gt;How can I stop the 16 MHz clock? I can&amp;#39;t see any oscillation with an oscilloscope, so I assume it is OFF, but the consumption says otherwise!&lt;/p&gt;
&lt;p&gt;There must be some instructions that do the job!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The production of the final product is stopped because of the power consumption issue, now that a battery backup for the time was implemented.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/468086?ContentTypeID=1</link><pubDate>Thu, 08 Feb 2024 14:09:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fabbf1a-4005-4996-8d23-e39c58168a45</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Before we proceed we need to verify your measurement setup. You should measure around 4 µA with the example that I shared in my previous reply, if you measure anything else then your measurement setup is not correct. Can you confirm what you measure with the Power management example, is that 9 µA?&lt;/p&gt;
&lt;p&gt;Also if the debug connector is connected then the chip will be in debug mode. The chip will never go to system off in debug mode, it will only emulate it, and the HFCLK will be kept active which will consume current, around a 1mA which explains what you measure. If you want to measure current then chip can&amp;#39;t be in debug mode.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;regards&lt;/p&gt;
&lt;p&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467969?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2024 16:40:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0485f492-06b6-4d6b-84ce-b574c2c1193c</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Hi Jared:&lt;/p&gt;
&lt;p&gt;I am using nRF51 board PCA10028 development kit. In my project, I am using the nRF51822.&lt;/p&gt;
&lt;p&gt;I am using&amp;nbsp;s130 softdevice and SDK V12.3.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I place 22 Ohm in R6 to measure with a voltmeter on P22.&lt;/p&gt;
&lt;p&gt;Step 1: Connect the USB to the PC.&amp;nbsp;Voltmeter reads 0.2&amp;nbsp;mV (9 uA)&lt;/p&gt;
&lt;p&gt;Step2: Start SEGGER and load the program. Voltmeter reads 26.4 mV (1.2 mA). I didn&amp;#39;t press RUN&amp;nbsp;and I placed a BREAK at reset_handler&amp;#39;s first instruction in&amp;nbsp;ses_nrf51_startup.s (that I didn&amp;#39;t change).&lt;br /&gt;Probably this consumption is because the 16 MHz quartz was started!?&lt;/p&gt;
&lt;p&gt;Step 3: If I define my main as:&lt;/p&gt;
&lt;p&gt;int main(void)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp; for(;;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;power_manage();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;and run it, then voltmeter reads 101.3 mV (4.6 mA)&lt;/p&gt;
&lt;p&gt;If instead I define main as:&lt;/p&gt;
&lt;p&gt;int main(void)&lt;/p&gt;
&lt;p&gt;{&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;ble_stack_init();&lt;/p&gt;
&lt;p&gt;&amp;nbsp; for(;;)&lt;/p&gt;
&lt;p&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp;power_manage();&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;and run it, then voltmeter reads 27.7 mV (1.2 mA).&lt;/p&gt;
&lt;p&gt;If I put in this loop NRF_POWER-&amp;gt;SYSTEMOFF = 1; then the loop continues to operate (probably because of debug) but the power consumption goes to 4.6 mA.&lt;/p&gt;
&lt;p&gt;My question is: how can I put the controller to the lower power consumption, as when I first powered the board? What is the function(s) I have to call to do that?&lt;/p&gt;
&lt;p&gt;Kind regards&lt;/p&gt;
&lt;p&gt;Sergio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467885?ContentTypeID=1</link><pubDate>Wed, 07 Feb 2024 10:06:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c064eb1b-7d60-4561-83f0-9fc568d2fb3b</guid><dc:creator>Jared</dc:creator><description>&lt;p&gt;Hi there,&lt;/p&gt;
[quote user=""]To exclude my hardware from the equation, I decided to connect the EEPROM I´m using (24LC16) and one key to the PCA10028 board and use the nRF current measurement feature. I soldered a 22 Ohm resistor on R6 and loaded my program into it.&amp;nbsp;[/quote]
&lt;p&gt;To be clear, you&amp;#39;re using the nRF51 development kit right?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Let&amp;#39;s start with verifying your current measurement setup:&lt;/p&gt;
&lt;p&gt;Can you describe your measurement setup in more detail, how are you measuring the current?&lt;/p&gt;
&lt;p&gt;What current do you measure if you run the &lt;a href="https://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk5.v12.3.0/pwr_mgmt_example.html?cp=9_5_10_4_5_17"&gt;Power Management Example &lt;/a&gt;with nothing external connected to the development kit. Follow the instructions in the example description to put the chip into System Off mode. What current do you measure?&lt;/p&gt;
[quote user="Sergio T"] using soft_device 13[/quote]
&lt;p&gt;Did you mean nRF5SDK v13? nRF51 is only supported up to v12.3,&lt;/p&gt;
&lt;p&gt;regards&lt;br /&gt;Jared&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467790?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2024 16:29:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0a2cdfa1-5a78-405c-bc72-6277ca549ee5</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;I forgot to mention: I am using soft_device 12 and I can say that it is the BLE soft_device that is consuming this power. So I think the answer to my problem could be quite simple:&lt;br /&gt;How can I switch off the complete BLE before going into low power consumption?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467788?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2024 16:12:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bc515fc8-e293-46ec-8235-5e70c6f3fa70</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Another thing: if I hold the controller in RESET (on the PCA10028) I have 1 mA consumption!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467784?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2024 15:59:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c3e7d3a2-f92e-4808-ae4a-e42e2bbbd225</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;Here is the rest:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//-------------------------------------
void StopBLE(void)
{
#ifdef USE_BLE
  if (f_bt_connected)
    bsp_event_handler(BSP_EVENT_DISCONNECT);
  advertising_stop();
#endif
  app_timer_stop(kernel_clock_id);
  InitIo();                       // set IO to minimum consumption
}
//-------------------------------------
//
//-------------------------------------
void StartBLE(void)
{
#ifdef USE_BLE
  ble_advertising_start(BLE_ADV_MODE_FAST);
#endif
  app_timer_start(kernel_clock_id, 327, false);
  InitIo();                       // set IO to minimum consumption
}
//-------------------------------------
//
//-------------------------------------
void PowerOnToOff(void)
{
  nrf_gpio_pin_set(LED);
  nrf_gpio_pin_set(P_ON);
  i2c_init();
  app_timer_stop(real_time_clock_id);       // stop RTC1 - also clears COUNTER
}
//-------------------------------------
//
//-------------------------------------
void PowerOffToOn(void)
{
  lword seconds_elapsed;
  
  seconds_elapsed = NRF_RTC1-&amp;gt;COUNTER;
  app_timer_start(real_time_clock_id, 32767, false);
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467783?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2024 15:54:44 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4c2bf30d-f533-49e3-8415-01c266e80db3</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;and the Check Power Key routine:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//-------------------------------------
void CheckPowerKey(void)
{
  if (f_key_was_on)
    {
#ifdef DEMO_BOARD
    if (nrf_gpio_pin_read(K_PWR) || !nrf_gpio_pin_read(PDN))
#else
    if (!nrf_gpio_pin_read(K_PWR) || !nrf_gpio_pin_read(PDN))
#endif
      {
      f_key_was_on = 0;   // key changed ON -&amp;gt; OFF
      }
    else // Key is On and not PDN: =&amp;gt; switch on if was off
      {
      if (!f_power_is_on)
        {
        f_power_is_on = 1;
        PowerOffToOn();
        first_minute = 60;
        StartBLE();       // start BLE and kernel_int
        RebuildActionSequence();
//        ReloadOnPeriod();
//        ReloadOffPeriod();
        if (!po_on_period)
          po_on_period = TEST_ON_PERIOD;
        }
      }
    }
  else // f_key_was_on = 0
    {
#ifdef DEMO_BOARD
    if (!nrf_gpio_pin_read(K_PWR) &amp;amp;&amp;amp; nrf_gpio_pin_read(PDN))
#else
    if (nrf_gpio_pin_read(K_PWR) &amp;amp;&amp;amp; nrf_gpio_pin_read(PDN))
#endif
      {
      f_key_was_on = 1;       // key changed OFF -&amp;gt; ON
      }
    else // Power key is OFF: =&amp;gt; switch off if it was on
      {
      if (f_power_is_on)
        {
        StopBLE();       // stop BLE and kernel_int
        f_power_is_on = 0;
        first_minute = 0;
        PowerOnToOff();
        }
      }
    }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Power consumption is too high</title><link>https://devzone.nordicsemi.com/thread/467781?ContentTypeID=1</link><pubDate>Tue, 06 Feb 2024 15:53:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b923475-1c5a-451e-a89c-3a7612e01e28</guid><dc:creator>Sergio T</dc:creator><description>&lt;p&gt;For information, here is my main loop:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;//-------------------------------------
/**@brief Application main function.
 */
//-------------------------------------
int main(void)
{
    uint32_t err_code;

// ---- Initialize ckock timer ----
    
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, false);
    err_code = app_timer_create(&amp;amp;real_time_clock_id, APP_TIMER_MODE_REPEATED, rtc_handler);
    app_timer_start(real_time_clock_id, 32767, false);
    
// ---- Initialize kernel timer ----
    err_code = app_timer_create(&amp;amp;kernel_clock_id, APP_TIMER_MODE_REPEATED, kernel_handler);
// ----
#ifdef USE_BLE
    ble_stack_init();
    gap_params_init();
    services_init();
    advertising_init();
    conn_params_init();
#endif
//    configure_ram_retention();
#ifdef DEBUG_PRINT
    printf(&amp;quot;\r\nUART Start after RESET!\r\n&amp;quot;);
    printf(&amp;quot;BT Disconnected&amp;quot;);
    printf(&amp;quot;\r\n&amp;quot;);
#endif
    InitIo();
    CheckWarmCold();      // chek if EEPROM was initialized
    ClearRxString();      // clear BLE receive buffer
    f_key_was_on = 0;
    f_power_is_on = 0;    
    InitIo();             // configure ports
    for (;;)
      {
      power_manage();
      if (f_power_is_on)
        {
        if (f_data_rx)
          {
          f_data_rx = 0;
#ifdef DEBUG_PRINT
          printf(&amp;quot;RX: &amp;quot;);
          printf(rx_string);
          printf(&amp;quot;\r\n&amp;quot;);
#endif
          if (ParseMessage())           // parse command to rx_data[]
            {
            ClearRxString();            // clear rx_buffer for next communication
            ExecuteMessage();
            }
          else
            ClearRxString();            // message invalid: clear rx_buffer for next communication
          }
        if (f_data_tx)
          {
          f_data_tx = 0;
#ifdef DEBUG_PRINT
          printf(&amp;quot;TX: &amp;quot;);
          printf(tx_string);
          printf(&amp;quot;\r\n&amp;quot;);
#endif
          ble_nus_string_send(&amp;amp;m_nus, tx_string, tx_string_len);
          }
        }
      CheckPowerKey();                // check power key
      if (f_power_is_on)
        {
        CheckScheduling();
        UpdatePumpOperation();
        Timers();
        UpdateLed();
        }
      }
}
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>