Open jsmith1717 opened 5 years ago
If you are using old arduino-esp32 version then using esp_bt_controller_mem_release
should works, just remember to call it as very first line in setup (just in case). In new arduino-esp32 it will crash app.
My suggestion would be to try change order wifi and ble initialization.
Thank you. Unfortunately, changing the Wifi/Ble order didn't fix the problem. It still crashes on the first line of Bluetooth (BleInit). I tried the latest arduino-esp32 on a different machine and it also crashes on the BleInit.
I'm really perplexed because it seems like a lot of other people are running Bluetooth + Wifi. And I can't even get ifrew's simple example to work. Yet I am able to write large programs with Wifi, Https, Dns, Ssdp, and lots of other stuff that all plays great together...
I had trouble with this a bit in the past using the core from the same time frame. The problem was solved when I initialized WiFi first then put it in max power save mode with esp_wifi_set_ps(WIFI_PS_MAX_MODEM) then initialized BLE.
any update on this? did you figure it out?.. having the same issue.
BLE and WiFi init in my case, but I get unstable WiFi connection and BLE also drops. Several times I was able to control BLE devices while using WiFi, but it was unstable with HUGE delays. After some time ESP32 reboots because of an error:
esp32 freertos/queue.c:706 (xQueueCreateCountingSemaphore)- assert failed!
@jsmith1717 Have you fixed the issue?
@h2zero
The problem was solved when I initialized WiFi first then put it in max power save mode with esp_wifi_set_ps(WIFI_PS_MAX_MODEM) then initialized BLE.
It doesn't help in my case. I init WiFi first, then adjust the Wifi Power Saving features and then init BLE. Part of code below:
WiFi.begin(WIFI_SSID, WIFI_PASSWORD);
Serial.print("Connecting to ");
Serial.print(WIFI_SSID);
while (WiFi.status() != WL_CONNECTED) {
Serial.print(".");
delay(500);
}
esp_wifi_set_ps(WIFI_PS_MAX_MODEM);
Serial.println();
Serial.print("Connected to ");
Serial.println(WIFI_SSID);
Serial.print("IP Address is : ");
Serial.println(WiFi.localIP());
And then BLE:
BLEDevice::init("TestDevice");
BLEServer *pServer = BLEDevice::createServer();
pServer->setCallbacks(new MyServerCallbacks());
I'm having a basic problem getting BLE to work with WiFi. The example BLE server (ble_server.ino) works great by itself. I have a large app that runs wifi, http server, client, etc which also works great and never crashes. When I put the ble_server code into my app, it crashes on BLEDevice::init("..."), just like it did for ifrew in this thread [https://github.com/nkolban/esp32-snippets/issues/227].
Weirdly, it doesn't get a guru meditation error with a stackdump that I can trace. Instead, it only prints the reset code plus fatal exception:
I added
-Map=arduino.map
to our custom config.mk to generate a map file, so I could find out where it was crashing. It turns out thatepc1=0x40080342
is in the exception handler. So the error is no help in finding the problem. I only found out what line it crashes on by commenting out code til it stopped crashing.I then ran @ifrew's ble example.ino.
I had to make a new partition .csv and new board in board.txt with more app space to compile it. Weirdly, I did not have to do that to compile my large app with knolban's ble_server code in it. I don't understand how ifrew's small example can be larger than my app + Neil's BLE.
Anyway, I tried uncommenting the
esp_bt_controller_mem_release
in BleDevice.cpp. Still crashed. Then I commented it, and added the line tosetup()
per @chegewara 's instructions. Still crashed. Then I edited sdkconfig.h, even though the top of the file says autogenerated and "do not edit". Still crashes. I can't get it to run long enough to print the free heap space. On my big app with no BLE I have 162K.I downloaded the esp32 core for Arduino in August 2018. I'm reluctant to download the latest, because I have three big projects close to release that use the 2018 core.
I'd really appreciate some help in dealing with this. I'm about to release three products that all require Bluetooth. Everything else works great, and yet I'm stonewalled at the finish line.