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

nRF52832 Controlling Sleep Behavior with GPIO Pin

Hello,

I'm making an application that I want to have the following behavior:

1) 52832 starts in sleep mode

2)P0.14 pulls to LOW which brings out of sleep mode and then goes back to sleep after running application

3)P0.14 stays LOW and the 52832 stays in sleep mode

4)When P0.14 goes HIGH again 52832 comes back out of sleep mode and runs the application again

The problem I'm running into is that if P0.14 brings the 52832 out of sleep mode upon LOW that I can't keep the 52832 in sleep mode while that pin continues to stay LOW.  Is there a way to make the 52832 not come out of sleep mode after step 2 (above)?  For example:

1) 52832 starts in sleep mode

2)P0.14 pulls to LOW which brings out of sleep mode 

3) Somewhere in the application, change the logic to only wake up when P0.14 changes state/goes HIGH, and disable it from  coming out of state if LOW

4) 52832 then goes to sleep and only wakes up when P0.14 goes HIGH

5) After going HIGH and running the software configure to wake back up if P0.14 goes low

Thanks!

Parents Reply Children
  • Thanks, this worked and I was able to get the behavior I wanted using the nrf_gpio_cfg_sense_input() as follows!

    nrf_gpio_cfg_sense_input(Button, NRF_GPIO_PIN_PULLUP, NRF_GPIO_PIN_SENSE_HIGH);

    The issue was that I used button 1 which is included in the function bsp_wakeup_button_enable().  Even though I configured the button later with nrf_gpio_cfg_input() the bsp_wakeup_button_enable() was bringing the device out of sleep mode, so I had to remove this as well.  I did this by making a separate sleep_mode_enter() function, one with the bsp_wakeup_button_enable() and the other with it disabled (for the condition of going into sleep mode in sense mode).  I'm not posting the full code/logic because I think it would just be more complicated but if anyone wants to see it message me and I can add it in.

Related