Page 1 of 1

Bluetooth shutdown issues

Posted: Wed Sep 06, 2017 6:14 pm
by fleaplus
Hello, I have a custom service implemented that provides characteristics to view and update settings on our device. The service will optionally be enabled when the device comes out of deep sleep. I would like to shut down the bluetooth stack and deallocate any resources being used after a successful configuration is received, but I have had trouble getting the esp_bluedroid_disable() function to work.

I am currently doing the following things after a successful configuration has been received:
  • Call esp_ble_gatts_stop_service() with the service handle
  • Respond to ESP_GATTS_STOP_EVT, calling esp_ble_gatts_delete_service() with the service handle
  • Respond to ESP_GATTS_DELETE_EVT, calling esp_ble_gatts_app_unregister() with the gatts interface
  • Respond to ESP_GATTS_UNREG_EVT, calling esp_bluedroid_disable()
esp_bluedroid_disable() never returns or errors. I set the trace on the gatt library to 6 as suggested in a few other posts but didn't get any additional debugging output. I haven't seen in any examples the process of disabling bluetooth, so I am not sure if I am missing a step. I did find that calling esp_bluedroid_disable() immediately after esp_bluedroid_enable() did succeed. I took a look at the SDK code but it doesn't seem like an unimplemented function or such. Any help is appreciated!

Re: Bluetooth shutdown issues

Posted: Tue Dec 05, 2017 4:58 am
by quanvuee
I have same issue.
When I call esp_bluedroid_disable(), i have no idea what happen. It not return and code affter this don't run.
How can I disable BLE?