This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Sleep Modes and Wakeup Through GPIO IRQ

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 SLEEP MODES and WAKE-UP using GPIO IRQ.

I want to sleep my system(OFF), and it's wake-up on GPIO IRQ as RESET.

(I want full system go into OFF mode BLE, timers, and all other thing will off, BUT GPIO IRQ WORKING and my system wake-up through GPIO IRQ)

But in every sleep mode our GPIO has been disable or not working properly.

Please go through my attachment and suggest me what i have do for this sleep and wake-up mode using GPIO IRQ.New Microsoft Office Word Document (3).docx

Parents
  • 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 nrf_gpio_cfg_sense_input().

    #include <stdbool.h>
    #include "nrf.h"
    #include "nrf_drv_gpiote.h"
    #include "app_error.h"
    #include "boards.h"
    
    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, &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->SYSTEMOFF = 1; 
        }
    }
    
Reply
  • 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 nrf_gpio_cfg_sense_input().

    #include <stdbool.h>
    #include "nrf.h"
    #include "nrf_drv_gpiote.h"
    #include "app_error.h"
    #include "boards.h"
    
    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, &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->SYSTEMOFF = 1; 
        }
    }
    
Children
Related