ESP take turns between BLE and Wi-Fi? esp-idf

phantomBlurrr
Posts: 19
Joined: Mon Jun 10, 2019 4:01 pm

ESP take turns between BLE and Wi-Fi? esp-idf

Postby phantomBlurrr » Wed Jun 19, 2019 3:30 pm

Hello,
I am working on a project in which I want to do some operations over BLE with a gatt client (smart phone). At some point in operation, the ESP can be sent a command to switch to Wi-Fi so it connects to an AP. While it's connected to the AP, the BLE functionality would be disabled. So I am wondering, what is a good method to do this? I do not want to use Blufi, Arduino, nor Kolban c++ since I want to learn how to do it using esp-idf. At this point in the project I have the BLE functionality set up, but when I try to switch to Wi-Fi, I send the command which disables the bt controller and up to that point everything works. But as soon as I add any mention of the Wi-Fi initialization, literally anywhere in the code editor (I was trying to add that right after I disable the bt controller) the esp can be flashed but I check the monitor and it's going crazy rebooting over and over.

If I want to use Wi-Fi, would I have to completely deinitialize, disable, nuke, ect. the bluetooth??

My code is pretty much the gatt server + gatt security server + service table examples all mashed together
I was trying to add wifi station example, except that it was triggered by "connect to AP" command (which is coming in through BLE characteristic write)
Any help is appreciated!

Weijian-Espressif
Posts: 29
Joined: Wed Aug 09, 2017 6:16 am

Re: ESP take turns between BLE and Wi-Fi? esp-idf

Postby Weijian-Espressif » Thu Jun 20, 2019 2:42 am

Hi :
ESP32 supports Bluetooth and WIFI coexistence. You can init Bluetooth and WIFI at the same time. When WIFI connected to the AP, you can disconnect BLE. if you do not use BLE anymore, you can release Bluetooth:

esp_bluedroid_disable();
esp_bluedroid_deinit();
esp_bt_controller_disable();
esp_bt_controller_deinit();

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP take turns between BLE and Wi-Fi? esp-idf

Postby Ritesh » Thu Jun 20, 2019 3:50 am

Weijian-Espressif wrote:
Thu Jun 20, 2019 2:42 am
Hi :
ESP32 supports Bluetooth and WIFI coexistence. You can init Bluetooth and WIFI at the same time. When WIFI connected to the AP, you can disconnect BLE. if you do not use BLE anymore, you can release Bluetooth:

esp_bluedroid_disable();
esp_bluedroid_deinit();
esp_bt_controller_disable();
esp_bt_controller_deinit();
Yes. You are correct as we have also used same methods to disable Bluetooth into our project.

Would you please let me know that will it create any issue if we use BLE and WiFi together either into AP or STA or AP+STA mode? because i believe that WiFi and Bluetooth are working on single radio so that will it create any issue while working together?

Hope question is different but just want to know that if you have any idea regarding that.
Regards,
Ritesh Prajapati

Weijian-Espressif
Posts: 29
Joined: Wed Aug 09, 2017 6:16 am

Re: ESP take turns between BLE and Wi-Fi? esp-idf

Postby Weijian-Espressif » Thu Jun 20, 2019 4:00 am

Hi :
WiFi and Bluetooth are working on single radio, So the performance of Bluetooth and wifi will be affected. If you are no longer using Bluetooth, please release Bluetooth.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP take turns between BLE and Wi-Fi? esp-idf

Postby Ritesh » Thu Jun 20, 2019 5:13 am

Weijian-Espressif wrote:
Thu Jun 20, 2019 4:00 am
Hi :
WiFi and Bluetooth are working on single radio, So the performance of Bluetooth and wifi will be affected. If you are no longer using Bluetooth, please release Bluetooth.
Yeah. That is right now we are doing into one of our project for that.

Thanks for your suggestion for same.
Regards,
Ritesh Prajapati

Who is online

Users browsing this forum: No registered users and 125 guests