Skip to content

Issue with re initializing BLE device in esp32 #1155

@DharmikEC

Description

@DharmikEC

I am using ESP32 and arduino 2.0.4 IDE. My goal is to stop BLE for http request and than re initiate BLE again. I am performing these both in single task separate from loop.
I have gone through several posts on this topic but could not find solution. Also those posts are quiet old.

From what I have gathered,
I can not call BLEDevice::deinit(true); because it will erase memory and then BLEDevice::init(); also wont work after this. Is this still correct ? or there is an update in library ?
If I call BLEDevice::deinit(false); then it will not clear the memory and I will be able to use BLE again with BLEDevice::init();. However, doing this multiple time also result in error in http request. After few attempt it will reboot the esp32. From what I have read, others faced this issue too. (They used word "memory leak" which I do not understand.)

15:48:05.821 -> [613636][E][ssl_client.cpp:37] _handle_error(): [start_ssl_client():267]: (-32512) SSL - Memory allocation failed
15:48:05.821 -> [613637][E][WiFiClientSecure.cpp:135] connect(): start_ssl_client: -32512

I have tried this with only BLE in code. I had loop running with enabling and disabling BLE after every one second delay. And I also get error there too, not surprisingly after lot of attempts than in task. So it is a memory issue after all.

Guru Meditation Error: Core  0 panic'ed (StoreProhibited). Exception was unhandled.

Now again my question is, How can I re initiate BLE device after clearing memory ? Is there literally no way for doing this ?
Is there any other way to do what I am trying to do ?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions