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

What's the good way to make a connected device to go to sleep mode when there is no data transmission for some time?

Hi, I'm using nrf52832 and SDK15.3. And I'm using the ble_app_uart example. The device will go to sleep mode if there is no connection for 3 mins. 

My questions are:

1, if the device is connected to a phone, should I first call the sd_ble_gap_disconnect() to disconnect the device, and wait for 3 mins for it to go to sleep? Or there are better ways to make the device sleep?

2, should I use app timer to do it if I want to know whether there is data transmission between the device and the phone within a certain amount of time(e.g. 2 mins)? Or there are better ways to do this?

Parents
  • Hi,

    You can call the sleep_mode_enter() function whenever you want the device to enter System OFF ("deep sleep") given that there are no ongoing DMA transfers at the time (System OFF mode). The application is responsible for ensuring that there are no UARTE TX and RX transfers ongoing while entering sleep. 

    1. Calling sd_ble_gap_disconnect() will ensure that the connecting is terminated faster. The link will time out otherwise. But is it the phone or nRF52 that should decide how long the connection is supposed to last?

    2. It can be a good way to do it. I guess you can disconnect from the phone as well?

Reply
  • Hi,

    You can call the sleep_mode_enter() function whenever you want the device to enter System OFF ("deep sleep") given that there are no ongoing DMA transfers at the time (System OFF mode). The application is responsible for ensuring that there are no UARTE TX and RX transfers ongoing while entering sleep. 

    1. Calling sd_ble_gap_disconnect() will ensure that the connecting is terminated faster. The link will time out otherwise. But is it the phone or nRF52 that should decide how long the connection is supposed to last?

    2. It can be a good way to do it. I guess you can disconnect from the phone as well?

Children
Related