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

waking from sleep

Hi,

I am having some trouble getting the nrf51422 (running the s130 soft device) to wake up after entering sleep mode. I have successfully entered sleep mode using NRF_POWER->SYSTEMOFF = 1, and sd_power_system_off() (both seem to be effective). However, when I attempt to wake up on a pin change, the chip appears to enter an unresponsive state where it consumes excessive current.

initialize input pin:

ret_code_t err_code;

    //init gpiote module if not already initialized
    if (!nrf_drv_gpiote_is_init())
    {
        err_code = nrf_drv_gpiote_init();
        APP_ERROR_CHECK(err_code);
    }
    
    //uint32_t out_pin_initial_state = 0; //for the 3v3 enable
    
    /********** HALL INPUT PIN  *******/
    nrf_drv_gpiote_in_config_t in_config = GPIOTE_CONFIG_IN_SENSE_TOGGLE(true);
    in_config.pull = NRF_GPIO_PIN_PULLDOWN;

    err_code = nrf_drv_gpiote_in_init(SCOPE_HALL_PIN, &in_config, in_pin_handler); //set pin and event handler
    APP_ERROR_CHECK(err_code);

    nrf_drv_gpiote_in_event_enable(SCOPE_HALL_PIN, true); //enable event handling

sleep:

NRF_POWER->SYSTEMOFF = 1;  

pin change handler:

void in_pin_handler(nrf_drv_gpiote_pin_t pin, nrf_gpiote_polarity_t action)
{
    SEGGER_RTT_printf(0, "pin change \n");

    sd_nvic_SystemReset();
}

If I do not enter sleep mode, the pin handler works normally (resulting in a restart). However, it doesn't perform as expected when the device is sleeping. I can't tell if the code in the pin change handler actually runs, as the chip becomes unresponsive and nothing is printed. It definitely stops sleeping on pin change though (and consumes much more current than it does in normal operation). Any suggestions on how to properly wake the device would be greatly appreciated. Thanks!

Related