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

For nRF52832 SDK 17.0.2 ,How to enter Sleep Mode (Power Off Mode) (Suspend Mode) then press the Button1 for wake up ??

For nRF52832 SDK 17.0.2 ,How to enter Sleep Mode (Power Off Mode) (Suspend Mode) then press the Button1 for wake up ??

Parents
  • Now I use following sleep_mode_enter() will be reset immediately ,can not enter sleep mode to wait button1 for wake up.

    static void sleep_mode_enter(void)
    {

     ret_code_t err_code;
    nrf_drv_twi_uninit(&m_twi); //keli

    nrf_gpio_cfg_sense_input(BUTTON1_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON2_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON3_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON4_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);

    NVIC_DisableIRQ(GPIOTE_IRQn);
    NVIC_ClearPendingIRQ(GPIOTE_IRQn);

    err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    APP_ERROR_CHECK(err_code);

    // Prepare wakeup buttons.
    err_code = bsp_btn_ble_sleep_mode_prepare();
    APP_ERROR_CHECK(err_code);

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    err_code = sd_power_system_off();
    APP_ERROR_CHECK(err_code);

    }

Reply
  • Now I use following sleep_mode_enter() will be reset immediately ,can not enter sleep mode to wait button1 for wake up.

    static void sleep_mode_enter(void)
    {

     ret_code_t err_code;
    nrf_drv_twi_uninit(&m_twi); //keli

    nrf_gpio_cfg_sense_input(BUTTON1_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON2_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON3_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);
    //nrf_gpio_cfg_sense_input(BUTTON4_GPIO_PIN,NRF_GPIO_PIN_PULLUP,NRF_GPIO_PIN_SENSE_LOW);

    NVIC_DisableIRQ(GPIOTE_IRQn);
    NVIC_ClearPendingIRQ(GPIOTE_IRQn);

    err_code = bsp_indication_set(BSP_INDICATE_IDLE);
    APP_ERROR_CHECK(err_code);

    // Prepare wakeup buttons.
    err_code = bsp_btn_ble_sleep_mode_prepare();
    APP_ERROR_CHECK(err_code);

    // Go to system-off mode (this function will not return; wakeup will cause a reset).
    err_code = sd_power_system_off();
    APP_ERROR_CHECK(err_code);

    }

Children
No Data
Related