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

    Do you start scanning and connect to a peripheral at any point before this though? You can't disconnect if you're not connected already. You'll also get the conn_handle upon connecting to another device, as the conn_handle is in the initial message. You'll have to save and use this in calls that require it. I believe just about any of our examples using BLE saves the conn_handle upon connection though.

    On a somewhat unrelated note, I think you should put the disconnection and sleep events outside of the button_event_handler, and rather do these operations after the button_event_handler.

    Best regards,

    Simon

Reply
  • Hi David

    Do you start scanning and connect to a peripheral at any point before this though? You can't disconnect if you're not connected already. You'll also get the conn_handle upon connecting to another device, as the conn_handle is in the initial message. You'll have to save and use this in calls that require it. I believe just about any of our examples using BLE saves the conn_handle upon connection though.

    On a somewhat unrelated note, I think you should put the disconnection and sleep events outside of the button_event_handler, and rather do these operations after the button_event_handler.

    Best regards,

    Simon

Children
  • Hi Simon

    I was scanning and connecting to a peripheral before disconnecting, I was not saving the connection_handle in beginning.

    This time I tried to disconnect after data is sent in button_event_handler and put to sleep in BLE_GAP_EVT_DISCONNECTED case in ble_evt_handler , that didn't work either,it disconnect but , it doesn't go to sleep at all.

    Where outside of button_event_handler were you thinking?

Related