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

  • Hi Simon

    Yes, I want it to go to sleep after data transfer.But the issue is disconnecting within BLE_GAP_EVT_CONNECTED case. Here is the flow......Assuming we have a logic to check if data has been sent to the peripheral in BLE_GAP_EVT_CONNECTED case(Which I have to yet figure out how i am going to do that). The central board connects to the peripheral for the first time,it checks if data has been sent in BLE_GAP_EVT_CONNECTED case, if True then we  disconnect and put it to sleep, but in this case, since it is the first time, it is false so it will stay connected,and even if I push the button again,data will be sent but BLE_GAP_EVT_CONNECTED case won't be triggered again, because the connection is still active. Unless I misunderstood something from your previous post.

  • Hi David

    You're correct, calling the disconnect in the CONNECTED event might not be the best idea. Sorry about that.

    In order to check when an event has been received, I think the easiest way would be to create a service on the peripheral side that can be discovered and read by the central. We have a guide on creating your own custom BLE services here, which is great for learning purposes as well. You can check out the bas_c_evt_handler() in the ble_app_hrs_c to see how that function confirms receiving data from the battery service for reference on the central side (The battery level service can be found in the ble_app_hrs peripheral example). Note that the ble_app_blinky_c (and ble_app_blinky peripheral example) uses a service as well in the LED Button service.

    You could also set your central device to disconnect whenever the data from this service has been received by the central by calling the disconnect function after, for example, the "Battery Level received" print in the ble_app_hrs_c example project.

    Best regards,

    Simon

  • Hi Simon

    I just wanted to update you that I am still trying to get this to work, I will let you know the results either way.

    Thank you.

Related