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

Examples for enabling/disabling of BLE SoftDevice

So far I haven't run across any code examples that will switch the BLE (S110) stack in and out. I'm looking to test enabling and disabling of the softdevice to see how that works with a separate protocol that uses the radio. So far simply calling sd_softdevice_enable after calling sd_softdevice_disable doesn't seem to completely re-enable the soft device.

Any suggestions?

Parents
  • I re-opened this because it seemed better than posting a new question on the same topic.

    Basically, I'm getting stuck because I don't fully appreciate or understand some subtleties of the ble_app_lbs demo and the usage of the scheduler. What I've done is to modify this to look a little bit more like ble_app_gzll. What I mean by that is I have added functions to start and stop ble, similar to the ble_app_gzll. I've also modified the startup in main to use ble_lbs_start. I modified buttons_init so that the wakeup_button is now tied into the button_event_handler and it is supposed to toggle the ble stack on or off with each press. I've attached the source files here if someone wants to take a stab at pointing out what I'm doing wrong.

    The device comes up just fine and can be connected to with the Master Control Panel. When I hit the wakeup button (button 0), the stack goes away but there is no GPIO toggle when I hit the button a second time. The event isn't getting to the handler.

    main.c

  • When I try to run this project, I get the error 0x02 from sd_app_event_wait() on line 594. This error code means that the softdevice is not enabled, and shows that you must implement the sleeping differently depending on whether or not the softdevice is enabled. The logic for doing this can be found in ble_app_gzll.

    When fixing this, things seems to be working nicely.

Reply Children
No Data
Related