Closed SarahDDSp closed 3 years ago
btc_gap_ble_arg_deep_copy at
To me it looks like short on memory, at least i think it is.
BTW very precise counting to 29
Thanks to your comment I was able to find similar topics about this issue : first, second , third. Did this memory leak was solved or is it still happening ?
Concerning the 29, it is happening with a surprising regularity. I guess the number will depend of the available memory on the board depending of each project.
Is there a way to not have to deinit BLE each time I want to go to light sleep, as technically memory, thus connection infos, is preserved in this sleep mode ? I have LoraWan running in parallel without issues.
Thank you for your time
I have no knowledge about memory leak in ble library in init/deinit sequence, i didnt investigate it. I just remember that deep copy error may be related to short on memory.
I am wondering if you really need to deinit and init ble all the time. Did you try to stop advertising and not using ble scan? When radio is not used then should not drain power. Im not saying it is better than fixing eventual memory leak, but maybe worth to consider.
I achieved this time to make this start/stop advertising work. For that I needed to create a stop advertising function working as the start advertising function of BLEDevice Class from BLE arduino library for esp32, which means :
void stopAdvertising()
{
BLEDevice::getAdvertising()->stop();
}
Maybe it will help someone in the future. I placed stopAdvertising where deinit stands and start advertising where init stands
I will test it on a longer period to see if some issues appears.
[STALE_SET] This issue has been automatically marked as stale because it has not had recent activity. It will be closed in 14 days if no further activity occurs. Thank you for your contributions.
[STALE_DEL] This stale issue has been automatically closed. Thank you for your contributions.
Hardware:
Board: TTGO-LORA32-V1
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/ttgo-lora32-v1.html PLATFORM: Espressif 32 (2.1.0) > TTGO LoRa32-OLED V1 HARDWARE: ESP32 240MHz, 320KB RAM, 4MB Flash (ESP32-D0WDQ6 (revision 1)) Core Installation version: 2.1.0, (ESP32 BLE Arduino 1.0.1) IDE name: Platform.io Flash Frequency: 40Mhz PSRAM enabled: no Upload Speed: automatic one Computer OS: Ubuntu
Description:
I am currently working on an iOT project. My goal is to save as much power as possible so my product can run as long as possible on battery. Thus I would like to make my system sleep for 7 to 10 sec and then wake up for the same amount of time. But after 29 wake up, the BLE is crashing when calling startAdvertising. The bug I am reporting happens either the board is powered through USB or a 1S Li-ion battery (with TL1963A LPO). I am not even connecting to the BLE in the meanwhile so I am not doing anything than putting the board to sleep and waking it up. I am using properly the whole disable deinit process and init enable one.
My BLEsetup funtion is using the BLEDevice::init() function and then define Server, Services, and characteristics as in the setup loop of arduino example for BLE. It ends with BLEDevice::startAdvertising();. According to the back trace, it is where it fails at the 29th wake up.
I try to just let more time (a cycle of wake up/sleep without connecting) after the 28th so that it won't fail, but it had no effect.
I really have no idea of how to solve this issue.
Sketch:
Debug Messages:
I hope my demand is sufficiently clear and furnished. Thanks in advance for any help you could provide about it.