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

SD110 disable sleep

Hi all,

I would like to know that is there a method to disable sleep mode in run time and reenable it when I use SD110? You know when the device starts it starts advertising for a while then goes to sleep mode. Now I wanted to wake up if in sleep mode and avoid this if my device connected to the computer directly. I have a GPIO signal for detecting the connection. I saw in the example I can wake up by GPIOTE but how to disable to sleep and how to reenable it when the device disonnected from cable?

Thank you! Syrius

Parents
  • Hi Syrius

    In your GPIOTE interrupt handler, you can stop advertising with calling sd_ble_gap_adv_stop, reconfigure your advertising parameters, and then start advertising again with sd_ble_gap_adv_start. Set the advertising parameters like done in advertising_init() and/or advertising_start() functions in any of the BLE example codes in the nRF51 SDK. If you set the m_adv_params.timeout = 0, then the advertising will never time out.

    Initially, you configure your GPIOTE interrupt to be triggered either on high signal or on low signal. When you connect your PC, the interrupt will trigger and the GPIOTE interrupt handler is executed. In your GPIOTE interrupt handler, you could reconfigure your GPIOTE so that the GPIOTE interrupt is triggered on the opposite signal, then the GPIOTE interrupt will be triggered again when you unplug your PC from the nRF51 device, enabling you to reconfigure your advertising parameters to the original state.

Reply
  • Hi Syrius

    In your GPIOTE interrupt handler, you can stop advertising with calling sd_ble_gap_adv_stop, reconfigure your advertising parameters, and then start advertising again with sd_ble_gap_adv_start. Set the advertising parameters like done in advertising_init() and/or advertising_start() functions in any of the BLE example codes in the nRF51 SDK. If you set the m_adv_params.timeout = 0, then the advertising will never time out.

    Initially, you configure your GPIOTE interrupt to be triggered either on high signal or on low signal. When you connect your PC, the interrupt will trigger and the GPIOTE interrupt handler is executed. In your GPIOTE interrupt handler, you could reconfigure your GPIOTE so that the GPIOTE interrupt is triggered on the opposite signal, then the GPIOTE interrupt will be triggered again when you unplug your PC from the nRF51 device, enabling you to reconfigure your advertising parameters to the original state.

Children
No Data
Related