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

Deep sleep mode.

Hi,

We have created an application with BLE multi peripheral where I have to put my chip into deep sleep mode by long pressing the tactile button & also I have to wake it up by long pressing the same tactile button. could you please guide me to achieve this by listing out the procedures to follow. kindly, do the needful. Thanks in advance.

Warm regards,

Roshan.

  • Hi Roshan, 

    How familiar you are with our nRF5 SDK ? 
    In the SDK we provide you a bsp library that can handle button press. 

    For example if you have a look at the ble_app_hrs example, you can find the bsp_event_handler() where if you quick press button 0 (on the nRF52 DK) the device will enter sleep mode (deep sleep). 
    and if you long press the same button it will do Disconnection if it's in a connection. 

    You can modify that handle so that when you long press a button it enter deep sleep mode instead. 

    Regarding waking up, you can find in sleep_mode_enter() how it's prepared before enter sleep mode so that you can wake the chip up with a button. However it always wakes up with an interrupt (button press) doesn't matter if it's long press or short press. You would need to implement in your code so that if it wakes up from a button press, it would start a timer and if the button is released before a period of time (short press) the chip will enter sleep mode again. And if it's longer than a certain time, it will boot up normally. This we don't have yet and you would need to implement.  

  • Hi Hung Bui,

    Thank you for the reply. I will do check on the examples which you have mentioned. If any other further queries I will post in the same case. 

  • Hi Hung Bui,

    I have explored the ble_app_hrs example. But thing is I am trying to achieve the sleep and wake up in our Custom board (application used - ble_app_multiperipheral) which is having only one tactile button. I want to implement the deep sleep mode in my custom board by long pressing the tactile button and again I want to wake up the chip using same tactile button. please suggest me the best way to achieve this. 

    Thank you.

  • Have you checked the function bsp_event_handler() ? 

  • Hi,

    Yes I have checked the bsp_event_handler() function and I have found the function for deep sleep. But, thing is I am struggling to achieve the long press button event and also I can't able to find this long press event in bsp_event_handler(). Thing is I have already used the app_button_init() along with debounce time to achieve the long push for different button but i guess the app_button_init() can be used only once in our application. am i right? I am not sure about this. please, help me to achieve the long press button event to call the deep sleep function and Thank you for your previous inputs.

Related