<?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 and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/11987/sleep-modes-and-wakeup-through-gpio-irq</link><description>I have attached all sleep modes of our controller that i found through forums and from your suggestions. 
 But my problem is No one of these sleep modes, wake-up through GPIO IRQ. 
 Please provide me accurate details along with accurate settings of</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 29 Mar 2022 12:52:53 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/11987/sleep-modes-and-wakeup-through-gpio-irq" /><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360549?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2022 12:52:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7b0fa04d-0a45-48cf-a7a9-cefcf91806b5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="RixtronixLAB"]Will this function overwrite &amp;quot;bsp_button_is_pressed()&amp;quot; function ?[/quote]
&lt;p&gt;The&amp;nbsp;bsp_button_is_pressed() simply reads the state of a GPIO pin , in the end using&amp;nbsp;nrf_gpio_pin_read(). So this cannot be &amp;quot;overwritten&amp;quot;. But if you change the confguration of this pin, for instance making it an output in stead of an input, changing pull configuration or similar, then it will affect how you read it.&lt;/p&gt;
&lt;p&gt;There are fundamental flaws about this code snippet, though, which are not directlyrelated to the question. You are making repeated calls to&amp;nbsp;bsp_btn_ant_init(), but this function is intended to be called once, and any subsequent call will overwrite the previous configuration (it updates internal static variables so there is only one channel and channel type at a time).&lt;/p&gt;
&lt;p&gt;PS: This is getting quite detailed and straying away from the original topic of this thread. Please make a new case for new questions in the future.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360537?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2022 12:32:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:932ec307-2bb3-4e1d-b8f0-b4bb317a6ede</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Thanks for the reply,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Will this function overwrite &amp;quot;bsp_button_is_pressed()&amp;quot; function ?&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;static void utils_setup(void)
{
    //ret_code_t err_code;
	  ret_code_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
    //originally
    err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS ,
                        bsp_event_handler);
	  /*
	  err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS,   //bsp_button_event_handler at E:\nRF5_SDK_17.0.2_d674dde\components\libraries\bsp\bsp.c 24Mar22 Rixtronix LAB
                        bsp_button_event_handler);
	  */
    APP_ERROR_CHECK(err_code);

    err_code = nrf_pwr_mgmt_init();
    APP_ERROR_CHECK(err_code);
		
	    
	
    err_code = bsp_btn_ant_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);

    //err_code = ant_state_indicator_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
	
	  err_code = bsp_btn_ant_init(m_ant_bsc.channel_number, BSC_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
		
		err_code = bsp_btn_ant_init(m_ant_bpwr.channel_number, BPWR_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
	
	  //err_code = ant_state_indicator_init(m_ant_bsc.channel_number, BSC_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
		NRF_LOG_INFO(&amp;quot;utils_setup\r\n&amp;quot;);
}
static void utils_setup(void)
{
    //ret_code_t err_code;
	  ret_code_t err_code = app_timer_init();
    APP_ERROR_CHECK(err_code);
    //originally
    err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS ,
                        bsp_event_handler);
	  /*
	  err_code = bsp_init(BSP_INIT_LEDS | BSP_INIT_BUTTONS,   //bsp_button_event_handler at E:\nRF5_SDK_17.0.2_d674dde\components\libraries\bsp\bsp.c 24Mar22 Rixtronix LAB
                        bsp_button_event_handler);
	  */
    APP_ERROR_CHECK(err_code);

    err_code = nrf_pwr_mgmt_init();
    APP_ERROR_CHECK(err_code);
		
	    
	
    err_code = bsp_btn_ant_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);

    //err_code = ant_state_indicator_init(m_ant_hrm.channel_number, HRM_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
	
	  err_code = bsp_btn_ant_init(m_ant_bsc.channel_number, BSC_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
		
		err_code = bsp_btn_ant_init(m_ant_bpwr.channel_number, BPWR_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
	
	  //err_code = ant_state_indicator_init(m_ant_bsc.channel_number, BSC_DISP_CHANNEL_TYPE);
    APP_ERROR_CHECK(err_code);
		NRF_LOG_INFO(&amp;quot;utils_setup\r\n&amp;quot;);
}
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I put this function,&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt; 	// Wake up button 28Mar22 Rixtronix LAB
    nrf_gpio_cfg_sense_input(BSP_BUTTON_3, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;after&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;log_init(); //comment out for GPS test 26 Oct 21
    utils_setup(); //comment out for GPS test 26 Oct 21
	  
    softdevice_setup(); //comment out for GPS test 26 Oct 21&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;but I can&amp;#39;t get a proper response,&lt;/p&gt;
&lt;p&gt;BSP_BUTTON_3 is working well for shutdown but can not turn on&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;	 void bsp_event_handler(bsp_event_t event)
	 .
	 .
	 .
	 case BSP_EVENT_KEY_2:
					 //NRF_LOG_INFO(&amp;quot;BSP_EVENT_KEY 2 PUSH \n&amp;quot;);
				   if(button2_state)
										{
										
											 NRF_LOG_INFO(&amp;quot;BSP_EVENT_KEY 2 PUSH OFF\n&amp;quot;);
												button2_state = STATE2_OFF;  
										
										}
										else
										{
											  NRF_LOG_INFO(&amp;quot;BSP_EVENT_KEY 2 PUSH ON\n&amp;quot;);
												button2_state = STATE2_ON;
											
										}&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;at main :&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;if(button2_state==STATE2_OFF) //check button2 ON/OFF flag
{	
  ssd1306_Power_On();
	nrf_delay_ms(888);		
	nrf_pwr_mgmt_run(); //Enter System On sleep mode****Rixtronix LAB 28Mar22
	
}		 

if(button2_state==STATE2_ON) //check button2 ON/OFF flag
{	
  ssd1306_Power_Off();
	nrf_delay_ms(888);	
  ssd1306_displayOff();	
	nrf_delay_ms(888);	
	//nrf_pwr_mgmt_run(); //Enter System On sleep mode****Rixtronix LAB 28Mar22
	nrf_pwr_mgmt_shutdown(NRF_PWR_MGMT_SHUTDOWN_GOTO_SYSOFF);//Enter System Off sleep mode****Rixtronix LAB 28Mar22
	
}		 
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Any clues ?&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Rixtronix LAB&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360526?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2022 12:01:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0e967e24-a324-4b24-a376-627ca9aa9123</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="RixtronixLAB"]Does bsp_button_is_pressed() work with softdevice ?[/quote]
&lt;p&gt;Yes.&lt;/p&gt;
[quote user="RixtronixLAB"]and will ant button initialization overwrite all the bsp init ?[/quote]
&lt;p&gt;I am not entirely sure what you mean. Can you elaborate?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360429?ContentTypeID=1</link><pubDate>Tue, 29 Mar 2022 06:52:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2464cc7f-1b8e-4a7c-ba28-a32d4b8ac151</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Hi Enar,&lt;/p&gt;
&lt;p&gt;Does bsp_button_is_pressed() work with softdevice ?&lt;/p&gt;
&lt;p&gt;and will ant button initialization overwrite all the bsp init ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Rixtronix LAB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360163?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2022 07:22:28 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e4cd5019-1013-4726-a238-de2b156f0a6a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Yes,&amp;nbsp;nrf_gpio_cfg_sense_input() can be used together with the SoftDevice.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/360136?ContentTypeID=1</link><pubDate>Mon, 28 Mar 2022 05:22:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6ebf9454-7678-4335-9e64-dc77948cd226</guid><dc:creator>RixtronixLAB</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;Does &amp;nbsp;nrf_gpio_cfg_sense_input work with softdevice ?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards,&lt;/p&gt;
&lt;p&gt;Rixtronix LAB&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/45372?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2016 12:37:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a268e9fd-c1ad-4db5-b57b-2bb6740f8892</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;How have you used it? You can verify that the above code works by running it on a nRF51 DK. You must of course adapt it to your application, but it shows the principle. Particularly you must substitute BSP_BUTTON_2 with whichever pin you want to use to wake up the chip.&lt;/p&gt;
&lt;p&gt;If you cannot make it work and need more assistance you would be more likely to get good help if you describe in detail what you have done and how it fails.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/45371?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2016 12:31:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ea4dcc0f-92cb-4a22-aa45-bb7be35dae99</guid><dc:creator>BHAGYESH</dc:creator><description>&lt;p&gt;I used your settings but it&amp;#39;s not working with my program. My controller still in sleep mode.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Sleep Modes and Wakeup Through GPIO IRQ</title><link>https://devzone.nordicsemi.com/thread/45370?ContentTypeID=1</link><pubDate>Fri, 19 Feb 2016 09:34:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c071ec1d-78ea-45f7-aeb6-0b1e3f03224a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;This example (tested with SDK 10) demonstrates how you can use a GPIO to wake up a chip from system OFF mode. The key is to use pin sensing. This can be configured with &lt;a href="http://infocenter.nordicsemi.com/topic/com.nordic.infocenter.sdk51.v10.0.0/group__nrf__gpio.html#ga91f72be8204a892956fa5d5dd59c32b2"&gt;&lt;code&gt;nrf_gpio_cfg_sense_input()&lt;/code&gt;&lt;/a&gt;.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;lt;stdbool.h&amp;gt;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_drv_gpiote.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;

static void gpio_init(void)
{
    ret_code_t err_code;

    // Configure output pin for LED
    err_code = nrf_drv_gpiote_init();
    APP_ERROR_CHECK(err_code);
    nrf_drv_gpiote_out_config_t out_config = GPIOTE_CONFIG_OUT_SIMPLE(false);
    err_code = nrf_drv_gpiote_out_init(BSP_LED_0, &amp;amp;out_config);
    APP_ERROR_CHECK(err_code);

    // Wake up button
    nrf_gpio_cfg_sense_input(BSP_BUTTON_2, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
}


int main(void)
{
    gpio_init();

    while (true)
    {
        // Toggle LED (will continuously toggle while button is pressed, so it will appear dimmed)
        nrf_drv_gpiote_out_toggle(BSP_LED_0);
        
        // Go to system off
        NRF_POWER-&amp;gt;SYSTEMOFF = 1; 
    }
}
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>