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

Wakeup from SystemOFF mode when button_1 is pressed and go to SystemOFF mode when button_2 is pressed

Hello,

 

I am using nRF52832, SDK_15.3.0, S132 SoftDevice and Segger for flashing the image. I am using ‘ble_app_blinky’. Currently it is SystemON mode. But I need to change to SystemOFF mode.

 

I have two buttons. One for Start mode and the other button for Stop mode. In Start mode, device should wakeup from SystemOFF mode and start some operations. In Stop mode, device should stop doing operations and go to SystemOFF mode.

During Start mode

1) As part of app_button_init(), buttons are configures as GPIOTE_CONFIG_IN_SENSE_TOGGLE(false). In this case if chip went to SystemOFF mode, whether

a) Pressing button will make chip reset and come out of SleepOFF mode, but button event handler will not execute ?

b) Whether Release button (Because of Toggle) will generate button event handler with button_action as APP_BUTTON_RELEASE ?

 

2) At the same time assume when chip is already wakeup (Come out of SystemOFF) mode and during this

a) when button is pressed & released, then whether button event handler will detect both Press & Release events ? (Above case only Release is detected ?).

 

During Stop mode

3) Since all buttons are configures as SENSE_TOGGLE, for Stop button if I press, it will generate PRESS event and call sd_power_system_off(), so that device will go to SystemOFF mode. But due to toggle sense, if I release Stop button whether chip will come-out of SystemOFF mode. Then in this case never chip will go to System OFF mode ?

Thanks & Regards

Vishnu Beema

Parents
  • Hello,

    I'm not sure if I understood your questions correctly. Have you tried this? Observed any unexpected behaviors?  

    1 a) It depends on the input state when it comes out of reset and started initialization of the button handler. 

    1 b) The event should get triggered if the button is pressed until the button module is initialized

    2. a) The press event will not be detected.

    3.  You should re-configure the other pins before entering system OFF mode so that there's only one wake-up pin. You can use the nrf_gpio_cfg_default() function for this. 

    Regards,

    Vidar

Reply
  • Hello,

    I'm not sure if I understood your questions correctly. Have you tried this? Observed any unexpected behaviors?  

    1 a) It depends on the input state when it comes out of reset and started initialization of the button handler. 

    1 b) The event should get triggered if the button is pressed until the button module is initialized

    2. a) The press event will not be detected.

    3.  You should re-configure the other pins before entering system OFF mode so that there's only one wake-up pin. You can use the nrf_gpio_cfg_default() function for this. 

    Regards,

    Vidar

Children
  • Hello,

     

    I implemented all above scenarios and below are my observations.

     

    1.a) When device is already in “System OFF” mode and if I press start button, device will come out of “System OFF” mode and button event handler will not execute.

     

    1.b) Due to GPIOTE_CONFIG_IN_SENSE_TOGGLE(false), start button release will trigger button event handler (As device is already out of System OFF mode due to button press).

     

    2.a) Since already system is in “System ON” mode, for each press & release, button handler will be executed.

     

    3.a) For stop button press, button handler will execute and then go to “System off” mode as sd_power_system_off() is called. But stop button release is detected and come out of “System OFF” mode.

     

    My queries are:

    1) For '3.a' If I call app_button_disable() all buttons are disabled. How to disable only stop button interrupts. As mentioned whether directly calling nrf_gpio_cfg_default() should disable only that pin ?

     

     

    Thanks & Regards

    Vishnu Beema

  • Hello,

    yes, you can use nrf_gpio_cfg_default() to disable individual pins. Alternatively, use app_button_disable() then enable the pin you want to use for wake-up.

    Regards,

    Vidar

Related