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

Not able to wake the board from deep sleep(System off)

I am very new to Nordic products so please excuse my ignorance.I have been trying to put my nrf52840 board to deep sleep. It seems to go to sleep but when I try to wake it up by pushing the buttons, it doesn't wake up.

This is how  I modified Ble_app_blinky_c, I added sleep_mode_enter(){}, buttons_leds_init(){}, and bsp_event_handler(bsp_event_t event){} from Ble app template . And then I am calling buttons_leds_init  and sleep_mode_enter in Main.c.Basically I want the board to be in deep sleep at all times and wake up only when I push the buttons.

I have included my project below.

What I am doing wrong?

Thank you in advanceble_app_blinky_c.zip

Parents
  • Hi David

    First of all, by setting sleep_mode_enter() function before the init functions causes a fatal error, and the chip to just reset over and over. Next, by setting the sleep_mode_enter() function in the main loop will cause the application to go to sleep every time it wakes up, as it resets when it wakes up, and starts the main loop from the beginning, causing the device to never be able to scan.

    The ble_app_blinky_c example kind of already implements what you're looking for, as it starts out with scanning, then goes to sleep when you press button 1 (see bsp_event_handler), and it only wakes up by either pressing the reset button or button 2 which is set to wake it up.

    Best regards,

    Simon

Reply
  • Hi David

    First of all, by setting sleep_mode_enter() function before the init functions causes a fatal error, and the chip to just reset over and over. Next, by setting the sleep_mode_enter() function in the main loop will cause the application to go to sleep every time it wakes up, as it resets when it wakes up, and starts the main loop from the beginning, causing the device to never be able to scan.

    The ble_app_blinky_c example kind of already implements what you're looking for, as it starts out with scanning, then goes to sleep when you press button 1 (see bsp_event_handler), and it only wakes up by either pressing the reset button or button 2 which is set to wake it up.

    Best regards,

    Simon

Children
  • Hi Simonr

    Thank you for the response. The ble_app_blinky_c  example doesn't seem to have that implementation, the bsp_event_handler is something that I added to the app in an attempt to put it to sleep. Also, I removed sleep_mode_enter() out of main loop, and put it inside button_event_handler() after a button is pressed (basically when the button is pressed, it transmit the data and after the transmission is successful it goes back to sleep) but still that didn't work.

    I have also tried to do like how they are doing in Ble app template example, but that didn't help (that's where I took  bsp_event_handler).

Related