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

sometimes the device wakes up immediately after calling sleep function

Hi,

I am using the system off power down mode in my application to keep the device in sleep mode and it works most oif the time. but sometimes it will restart immediately after the deep sleep indication (led blink) and it will continue this process until another rest, ie after a period of inactivity it will call sleep function and it will restart again.If i am giving one reset, it works as expected without any restarts.

it has two spi sensors and 2 i2c sensors. i am disabling all the spi and other  i2c and timers before going to sleep mode.

The wake up is configured through gpio interrupt from sensor.

void goto_deepsleep(void){

    nrf_gpio_cfg_sense_input(INT_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
    nrf_gpio_cfg_sense_input(17, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);

    enable_imu_power_down();
    uninit_timer();
    uninit_spi();
    
    uninit_i2c();

   sd_power_system_off();

}

I am not sure what exactly is causing this behavior, any suggestion to fix this will be much helpful.

I am using nrf52832 with sdk 14.0. using armgcc on linux.

Parents
  • Hi,

    This question might be obvious, but have you verified that there is no activity on either of the two wakeup pins which could cause the wakeup? Without knowing more about your code I would think rearranging your goto_deepsleep() to something like this would be more sensible:

    void goto_deepsleep(void){
        enable_imu_power_down();
        uninit_timer();
        uninit_spi();
        
        uninit_i2c();
    
        nrf_gpio_cfg_sense_input(INT_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
        nrf_gpio_cfg_sense_input(17, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
    
        sd_power_system_off();
    }

Reply
  • Hi,

    This question might be obvious, but have you verified that there is no activity on either of the two wakeup pins which could cause the wakeup? Without knowing more about your code I would think rearranging your goto_deepsleep() to something like this would be more sensible:

    void goto_deepsleep(void){
        enable_imu_power_down();
        uninit_timer();
        uninit_spi();
        
        uninit_i2c();
    
        nrf_gpio_cfg_sense_input(INT_PIN, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
        nrf_gpio_cfg_sense_input(17, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_LOW);
    
        sd_power_system_off();
    }

Children
Related