<?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>nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/42272/nrf51422-cannot-be-waken-after-sleep-wake-quite-a-few-times</link><description>Hi, I am now developing a product which uses nrf51422 chip. In this product, I use buttons to turn on and off (since I don&amp;#39;t have hard-power cut off circuit, we use system-off sleep for power off and normal mode for active mode) . To turn off the device</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 20 Mar 2019 00:58:24 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/42272/nrf51422-cannot-be-waken-after-sleep-wake-quite-a-few-times" /><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/177189?ContentTypeID=1</link><pubDate>Wed, 20 Mar 2019 00:58:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:981528b0-d149-45d4-b7eb-a55a54fc978c</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;thanks for your suggestion, I did check with advertising on event and that I found out the event in the advertise.c file and I put some condition in the event (though it&amp;#39;s not a good practice) and now it worked.&lt;/p&gt;
&lt;p&gt;So the device is now just in a system on sleep in idle condition and I also put the watchdog just in case to prevent from the dead loop.&lt;/p&gt;
&lt;p&gt;Thanks again for your great help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/174606?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 14:29:25 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0099a9f5-a276-485c-8ed3-85c1e1e4e9bf</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi&lt;/p&gt;
&lt;p&gt;1. If you are using the ble_advertising module, then you can find that in&amp;nbsp;ble_advertising_on_ble_evt() on&amp;nbsp;BLE_GAP_EVT_DISCONNECTED, that&amp;nbsp;ble_advertising_start() is called automatically, you may consider comment out this.&lt;/p&gt;
&lt;p&gt;2. That was a bit strange, when advertisement timeout I assume the code callback on_adv_evt() and&amp;nbsp;BLE_ADV_EVT_IDLE event, maybe you are calling&amp;nbsp;sleep_mode_enter() from a different place in your code in this case?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/174409?ContentTypeID=1</link><pubDate>Wed, 06 Mar 2019 02:37:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:67943f89-9b05-4ff6-8524-d3b8a159cc0f</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, thanks and I did as what you mentioned but I still found some issues. I just put these code in the function &amp;quot;sleep_mode_enter()&amp;quot;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static void sleep_mode_enter (void)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;/* Turn off other peripherals before go to system on sleep mode */&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sd_ble_gap_disconnect(m_conn_handle, BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;sd_ble_gap_adv_stop();&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;for(;;)&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;{&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; sd_app_evt_wait();&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; if(nrf_gpio_pin_read(SW_PWR_ON_PIN)==0)&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; {&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;NVIC_SystemReset();&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp; &amp;nbsp; }&amp;nbsp;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;&amp;nbsp;}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;I can see the device goes to system on sleep when sleep_mode_enter function is called and can wake up reset when I press the switch.&lt;/p&gt;
&lt;p&gt;But the problems that I found out are&amp;nbsp;&lt;/p&gt;
&lt;p&gt;1. If the device is connected to the app and when I turn off the device (sleep_mode_enter called), the device disconnect the app and goes to sleep but it restarts advertising again so the app and the device got connected again.&lt;/p&gt;
&lt;p&gt;2. if the device is not connected, I put sleep after advertisment timeout and when advertisement timeout occurs the device can go to sleep but when I check the current in power profiler kit, the current consumption is too high (about 3mA). &lt;strong&gt;&lt;em&gt;But when the device is not connected and turn off the device before advertisement timeout, it goes to sleep and current consumption is acceptable (8uA only).&lt;/em&gt;&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;So what might be the possiblities?&lt;/p&gt;
&lt;p&gt;(By the way, do I need to create a new topic for this question since this is not related with my previous issue)&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173976?ContentTypeID=1</link><pubDate>Mon, 04 Mar 2019 12:50:35 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c69dad56-ed89-445d-b3b9-9c52e78a375b</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;To disconnect e.g.:&lt;/p&gt;
&lt;p&gt;sd_ble_gap_disconnect(p_ble_evt-&amp;gt;evt.gattc_evt.conn_handle,&lt;br /&gt; BLE_HCI_REMOTE_USER_TERMINATED_CONNECTION);&lt;/p&gt;
&lt;p&gt;To stop advertising e.g.:&lt;/p&gt;
&lt;p&gt;(void) sd_ble_gap_adv_stop(p_advertising-&amp;gt;adv_handle);&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173585?ContentTypeID=1</link><pubDate>Fri, 01 Mar 2019 02:01:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9f69bd5d-b1d6-436d-b143-eb462c955a6f</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, thanks for the suggestion. I will try to do this but could you also help me how to disconnect BLE and stop advertising properly so that I can also try with system on sleep instead of system off sleep? Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173465?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 12:10:43 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:37cdfe17-a1d2-4a33-87f9-98c5a549f22d</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Are you able to simplify and share your project to run on&amp;nbsp;nrf51-dk so I can recreate the issue here?&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173369?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 05:50:06 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0339296b-3522-434a-9577-be6046391d7f</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, sorry for my mistakes. Actually, the code is OK, I mean, the device blinking corretly but still the same issue that it cannot be wakeup after I press the button and put the device into deepsleep.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static void sleep_mode_enter(void)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; //uint32_t err_code;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; TurnOff_LEDs();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_delay_ms(10);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; __disable_irq();&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; //Disable Hi G, Low G and Emergency Interrupt pin to prevent System-off wakeup&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_uninit(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_uninit(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;nrf_drv_gpiote_in_uninit(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; nrf_delay_ms(1);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; nrf_gpio_cfg_input(SW_PWR_ON_PIN, NRF_GPIO_PIN_PULLUP);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpio_cfg_sense_set(SW_PWR_ON_PIN, NRF_GPIO_PIN_SENSE_LOW);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; //nrf_gpio_cfg_sense_input(SW_PWR_ON_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; // Go to system-off mode (this function will not return; wakeup will cause a reset).&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_delay_ms(10);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; NRF_POWER-&amp;gt;SYSTEMOFF=1;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; //sd_power_system_off();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; NVIC_SystemReset();&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; //APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173360?ContentTypeID=1</link><pubDate>Thu, 28 Feb 2019 02:30:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d09d85-8e49-4951-840a-bd2c938c99db</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, I don&amp;#39;t know what&amp;#39;s wrong with my code, I just tried what you suggested and it bacome even worse. When I tried the below code, my LED will blink twice and the device will go to deepsleep and couldn&amp;#39;t be waken up as usual.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static void sleep_mode_enter(void)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; //uint32_t err_code;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; TurnOff_LEDs();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_delay_ms(10);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; __disable_irq();&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; //Disable Hi G, Low G and Emergency Interrupt pin to prevent System-off wakeup&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_uninit(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_uninit(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;nrf_drv_gpiote_in_uninit(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_drv_gpiote_in_event_disable(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpiote_int_disable(SW_PWR_ON_PIN);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; nrf_gpio_cfg_input(SW_PWR_ON_PIN,NRF_GPIO_PIN_PULLUP);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; nrf_gpio_cfg_sense_set(SW_PWR_ON_PIN,NRF_GPIO_PIN_SENSE_LOW);&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; // Go to system-off mode (this function will not return; wakeup will cause a reset).&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; NRF_POWER-&amp;gt;SYSTEMOFF=1;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; NVIC_SystemReset();&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; //APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173289?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 15:18:04 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:99f94e0f-1c0c-4749-b6da-89e7bdd5b14d</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;OK Kenneth I will try and get back to you&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173257?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 13:42:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:016a84b5-be73-4168-9a88-baa43e2e9221</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Dont&amp;#39; enable irq again, instead follow my comment:&lt;/p&gt;
&lt;p&gt;Enable wakeup on the pins you want to wakeup on by calling nrf_gpio_cfg_input() and nrf_gpio_cfg_sense_set().&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173245?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 13:04:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1b485508-b630-4216-b9d1-680b8ba8da95</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, when I tried this&lt;/p&gt;
&lt;p&gt;static void sleep_mode_enter(void)&lt;br /&gt;{&lt;br /&gt; //uint32_t err_code;&lt;br /&gt; TurnOff_LEDs();&lt;br /&gt; &lt;br /&gt;__disable_irq() &lt;br /&gt; &lt;br /&gt; nrf_delay_ms(10);&lt;br /&gt; &lt;br /&gt; //Disable Hi G, Low G and Emergency Interrupt pin to prevent System-off wakeup&lt;br /&gt; nrf_drv_gpiote_in_uninit(SW_EMERGENGY_PIN);&lt;br /&gt; nrf_drv_gpiote_in_event_disable(SW_EMERGENGY_PIN);&lt;br /&gt; nrf_gpiote_int_disable(SW_EMERGENGY_PIN);&lt;br /&gt; &lt;br /&gt; nrf_drv_gpiote_in_uninit(LOWG_INT_PIN);&lt;br /&gt; nrf_drv_gpiote_in_event_disable(LOWG_INT_PIN);&lt;br /&gt; nrf_gpiote_int_disable(LOWG_INT_PIN);&lt;/p&gt;
&lt;p&gt;nrf_gpio_cfg_sense_input(SW_PWR_ON_PIN,NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);&lt;br /&gt; &lt;br /&gt;&amp;nbsp;NRF_POWER-&amp;gt;SYSTEMOFF = 1;&lt;br /&gt; NVIC_SystemReset(); // I just added this code&lt;/p&gt;
&lt;p&gt;//APP_ERROR_CHECK(err_code);&lt;br /&gt;}&lt;/p&gt;
&lt;p&gt;the device cannot wake up anymore.&lt;/p&gt;
&lt;p&gt;so I added, __enable_irq() before NRF_POWER-&amp;gt;SYSTEMOFF=1 and&amp;nbsp;&lt;/p&gt;
&lt;p&gt;it still cannot wake up after deepsleep (the symptom is the same as in my issue)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173234?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 12:48:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ff7a3836-57a2-4843-9b2c-70ab8cde9926</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Thanks Kenneth for your prompt reply. I will try this and let you know about the outcome.&lt;/p&gt;
&lt;p&gt;Thanks again for your great help and hope this will solve my issue.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173230?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 12:39:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a7efed92-c833-4374-a9ec-16bea5720e9f</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;See my suggestion inline (look for //KME 3 places):&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void sleep_mode_enter(void)
{
    //uint32_t err_code;
        TurnOff_LEDs();
        
        // KME: Disable all interrupts here, e.g. __disable_irq() 
        
        nrf_delay_ms(10);
    
        //Disable Hi G, Low G and Emergency Interrupt pin to prevent System-off wakeup
        nrf_drv_gpiote_in_uninit(SW_EMERGENGY_PIN);
        nrf_drv_gpiote_in_event_disable(SW_EMERGENGY_PIN);
        nrf_gpiote_int_disable(SW_EMERGENGY_PIN);
        
        nrf_drv_gpiote_in_uninit(LOWG_INT_PIN);
        nrf_drv_gpiote_in_event_disable(LOWG_INT_PIN);
        nrf_gpiote_int_disable(LOWG_INT_PIN);

        //KME: Enable wakeup on the pins you want to wakeup on by calling nrf_gpio_cfg_input() and nrf_gpio_cfg_sense_set().
        
        // Go to system-off mode (this function will not return; wakeup will cause a reset).
        sd_power_system_off(); // KME: You can use NRF_POWER-&amp;gt;SYSTEMOFF = 1; directly here.
        NVIC_SystemReset();  // I just added this code 

    //APP_ERROR_CHECK(err_code);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173198?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 10:24:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a685549-63ce-48e9-8120-e435e47319dc</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;And I want to test like this. In stead of going to system-off deep sleep mode, I want to try to go to system on sleep mode (power_manage) command but I want to turn off BLE and when the user press and hold the button again, I will just turn on the BLE and continue. Although it&amp;#39;s not good for power saving, I want to eliminate this issue first.&lt;/p&gt;
&lt;p&gt;So how can I do to turn off BLE and put the MCU in system on sleep mode and and turn on BLE again?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173197?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 10:17:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5247eaaa-4c54-4204-8f4a-e06bcc598e9b</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;em&gt;&lt;strong&gt;Can you provide detailed chip markings on the nRF51422 ic?&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;the chip marking =&amp;gt; N51422 QFACA1 170BAE&lt;/p&gt;
&lt;p&gt;&lt;span style="text-decoration:underline;"&gt;&lt;em&gt;&lt;strong&gt;Can you try adding a 1Mohm between SWDIO and GND and check if you experience the same?&lt;/strong&gt;&lt;/em&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;no I havent tried before and I will do it and may I know what&amp;#39;s the purpose for this?&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;strong&gt;Can you send me your updated&amp;nbsp;if(Flag.PowerOnOff==1){}?&lt;/strong&gt;&lt;/span&gt;&lt;/em&gt;&lt;/p&gt;
&lt;p&gt;&lt;em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt;&lt;/em&gt;&lt;span style="text-decoration:underline;"&gt;&lt;/span&gt;I just added a single NVIC Reset command after system off sleep mode as I state in the comment.&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;if(Flag.PowerOnOff==1)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt; {&lt;/strong&gt;&lt;br /&gt; &lt;br /&gt;&lt;strong&gt; if( nrf_drv_gpiote_in_is_set(SW_PWR_ON_PIN) == false) // if the power on button is pressed&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; for(uint8_t i=0;i&amp;lt;=6;i++)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; nrf_delay_ms(500);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( nrf_drv_gpiote_in_is_set(SW_PWR_ON_PIN) == true)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; break;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; if( i==6)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; {&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; sleep_mode_enter();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp; }&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;strong&gt;static void sleep_mode_enter(void)&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;{&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;//uint32_t err_code;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;TurnOff_LEDs();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_delay_ms(10);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;//Disable Hi G, Low G and Emergency Interrupt pin to prevent System-off wakeup&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_drv_gpiote_in_uninit(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_drv_gpiote_in_event_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_gpiote_int_disable(SW_EMERGENGY_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_drv_gpiote_in_uninit(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_drv_gpiote_in_event_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;nrf_gpiote_int_disable(LOWG_INT_PIN);&lt;/strong&gt;&lt;br /&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;// Go to system-off mode (this function will not return; wakeup will cause a reset).&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; sd_power_system_off();&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;span style="text-decoration:underline;"&gt;&amp;nbsp;&lt;/span&gt;&lt;em&gt;&lt;span style="text-decoration:underline;"&gt;NVIC_SystemReset();&lt;/span&gt;&amp;nbsp;&lt;/em&gt; // I just added this code &lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; //APP_ERROR_CHECK(err_code);&lt;/strong&gt;&lt;br /&gt;&lt;strong&gt;}&lt;/strong&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173193?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 10:03:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8fa3f33-96c4-4c40-a403-215b85ebc2ab</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Can you provide detailed chip markings on the nRF51422 ic?&lt;/p&gt;
&lt;p&gt;Can you try adding a 1Mohm between SWDIO and GND and check if you experience the same?&lt;/p&gt;
&lt;p&gt;Can you send me your updated&amp;nbsp;&lt;span&gt;if(Flag.PowerOnOff==1){}?&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/173170?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 08:42:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:30638941-e4e6-4947-bcff-4189e22f1a23</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Hi Kenneth, I already put in the code snippet that you suggested and tested but the issue is still there. When I checked the supply voltage of the MCU when this issue happen, I found the supply voltage is there (which means it&amp;#39;s not the hardware).Can I get any more suggestions? Thanks and waiting for your reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/166112?ContentTypeID=1</link><pubDate>Thu, 17 Jan 2019 01:33:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:b71ae7b6-24d6-48d3-9b79-08798dff5e80</guid><dc:creator>AnthonyThet</dc:creator><description>&lt;p&gt;Thanks so much for your suggestion Kenneth, I will do like this and see the outcome and sorry for my late reply.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF51422 cannot be waken after sleep/wake quite a few times.</title><link>https://devzone.nordicsemi.com/thread/164947?ContentTypeID=1</link><pubDate>Thu, 10 Jan 2019 14:06:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9a30b2a7-9756-48fb-ac3b-d5de5ad08be9</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Have you measured the current consumption, just to check if the chip is really in sleep?&lt;/p&gt;
&lt;p&gt;I was thinking you can add a nvic_systemreset() after the system OFF command(s), just to catch any potential failure here (can&amp;#39;t think of any, but might be worth a test to see if it impact the issue).&lt;/p&gt;
&lt;p&gt;I recommend that you disable global interrupts if&amp;nbsp;&lt;span&gt;if(Flag.PowerOnOff==1) is true, just to make sure you don&amp;#39;t have any interrupts when you start configuring the gpio&amp;#39;s as wakeup sources.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>