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

nRF51-DK: Can't enter in sleep mode during connection

I'm running the HID Keyboard example from SDK 12.2.0 on nRF51-DK with SD 130.

When I long push Button1, it disconnects for a moment and connects again immediately.

Events in the function bsp_event_handler(bsp_event_t event) are generated only from button presses and holding Button1 during connetion generates BSP_EVENT_DISCONNECT. So I can add

sleep_mode_enter();

in the event case to eventually enter in sleep mode. But the device enters sleep mode only while I'm holding Button1. When I release it, it starts direct advertising and connects immediately again with the last bond (my laptop).

  1. How can I made it enter in sleep mode with long pressing Button 1?

  2. After waking from sleep mode, I want the device to start fast advertising without whitelist, how can I do that?

Thank you!

Parents
  • 1 . The reason the chip wake up when you release the button is that the wake up button is configured the same as the sleep button, so when you release the sleep button, it wake the chip up.

    If you change the wake up button to something else (inside bsp_btn_ble.c) you should be able to leave the chip sleeping until you press the wake up button.

    2 . If you don't want whitelist, you can remove whitelist in advertising_start(). If you don't want directed advertising you can edit the code inside advertising_init() to disable ble_adv_directed_enabled.

Reply
  • 1 . The reason the chip wake up when you release the button is that the wake up button is configured the same as the sleep button, so when you release the sleep button, it wake the chip up.

    If you change the wake up button to something else (inside bsp_btn_ble.c) you should be able to leave the chip sleeping until you press the wake up button.

    2 . If you don't want whitelist, you can remove whitelist in advertising_start(). If you don't want directed advertising you can edit the code inside advertising_init() to disable ble_adv_directed_enabled.

Children
No Data
Related