Closed jaggil closed 4 years ago
You are not doing anything wrong. Default task in arduino is looperTask, which is created by arduino implementation. It has 8kB stack, which seems to be too few in your case, thats why you get this error:
Stack smashing protect failure!
You can create new task, let say at the very beginning of setup and use it instead of loop, in the next line you could just destroy default task to reclaim memory from task stack with vTaskDelete(NULL)
. Since now setup and loop no longer exist.
Thank you for your suggestion @chegewara. Before trying to create another task, I thought about monitoring the changes taking place in the stack. This is why I have introduced the "uxTaskGetStackHighWaterMark (NULL)" function before and after the BLE write commands. As you can see, the unused stack size is 6068, which seems quite large. The problem persists, but now the message is associated with "core 0" which surprises me. Does the BLE library run on "core 0"? Now we have some information in the Exception Decoder in the ArduinoIDE about "btagattc" It appears that there are some stored BLE write commands that are pending execution. Is there an easy way in the BLE library to check that the write function has been fully executed?
what's your opinion about it? Thanks in advance
void loop()
{
//currentMillis = millis();
currentMillis = micros();
looptime = currentMillis;
UBaseType_t uxHighWaterMark;
if (!connectionSuccessful){ Serial.println("Reconectar...."); connectSensor(); Serial.println("Reconectado y registrado"); }
else
{
if(Nueva_Notificacion==true)
{
Nueva_Notificacion=false;
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL);Serial.println( uxHighWaterMark);
pRemoteCharacteristic_THB->getDescriptor(BLEUUID((uint16_t)0x2902))->writeValue((uint8_t*)notificationOff, 2, true);
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );Serial.println( uxHighWaterMark);
Serial.printf("temp= %.2f ºC : humidity= %.2f \% : bat= %.3f v : TempRocio= %.2f ºC \n", temp, humi, bat, dewPointC(temp, humi));
Serial.print("Notifications turned off ->"); Serial.printf("esp_get_free_heap_size: %d \n\n", esp_get_free_heap_size());
}
else
if ( ((currentMillis - previousMillis) > interval) )
{
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );
Serial.printf("Notifications turned on ->esp_get_free_heap_size: %d : %d \n", esp_get_free_heap_size(), uxHighWaterMark);
pRemoteCharacteristic_THB->getDescriptor(BLEUUID((uint16_t)0x2902))->writeValue((uint8_t*)notificationOn, 2, true);
uxHighWaterMark = uxTaskGetStackHighWaterMark( NULL );Serial.println( uxHighWaterMark);
previousMillis = currentMillis;
Serial.println( micros());
}
}
//looptime = millis() - looptime;
looptime = micros() - looptime;
if (looptime > looptimeMax){ looptimeMax= looptime;Serial.printf("LooptimeMax: %d \n", looptimeMax);}
if (looptime < looptimeMin){ looptimeMin= looptime;Serial.printf("LooptimeMin: %d \n", looptimeMin);}
//if (looptime >= 1000){ Serial.printf("Looptime > 1s: %d \n", looptime);} //Indica si el "loop" dura mas de 1 s.
if (looptime >= 1000000){ Serial.printf("Looptime > 1s: %d \n", looptime);} //Indica si el "loop" dura mas de 1 s.
}
01:11:52.672 ->
01:12:47.180 -> Notifications turned on ->esp_get_free_heap_size: 108292 : 6068
01:12:47.180 -> 6068
01:12:47.180 -> 1562100982
01:12:48.662 -> T= 0xca 0x7 : H= 0x45 : BatmV= 0xcf 0xb
01:12:48.662 -> 6068
01:12:48.662 -> 6068
01:12:48.662 -> temp= 19.94 ºC : humidity= 69.00 : bat= 3.023 v : TempRocio= 14.10 ºC
01:12:48.662 -> Notifications turned off ->esp_get_free_heap_size: 107456
01:12:48.696 ->
01:12:56.678 -> T= 0xc9 0x7 : H= 0x45 : BatmV= 0xcf 0xb
01:12:56.678 -> 6068
01:12:56.678 -> 6068
01:12:56.678 -> temp= 19.93 ºC : humidity= 69.00 : bat= 3.023 v : TempRocio= 14.09 ºC
01:12:56.678 -> Notifications turned off ->esp_get_free_heap_size: 107380
01:12:56.678 ->
01:13:03.656 -> T= 0xcb 0x7 : H= 0x45 : BatmV= 0xcf 0xb
01:13:03.656 -> 6068
01:13:03.656 -> 6068
01:13:03.656 -> temp= 19.95 ºC : humidity= 69.00 : bat= 3.023 v : TempRocio= 14.11 ºC
01:13:03.689 -> Notifications turned off ->esp_get_free_heap_size: 107304
01:13:03.689 ->
01:13:11.146 -> T= 0xcc 0x7 : H= 0x45 : BatmV= 0xcf 0xb
01:13:11.179 -> 6068
01:13:11.179 -> 6068
01:13:11.179 -> temp= 19.96 ºC : humidity= 69.00 : bat= 3.023 v : TempRocio= 14.12 ºC
01:13:11.179 -> Notifications turned off ->esp_get_free_heap_size: 107228
01:13:11.179 ->
01:13:17.176 -> /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c:3091 (xTaskRemoveFromEventList)- assert failed!
01:13:17.176 -> abort() was called at PC 0x4008fa5a on core 0
01:13:17.176 ->
01:13:17.176 -> Backtrace: 0x4009165c:0x3ffbe210 0x4009188d:0x3ffbe230 0x4008fa5a:0x3ffbe250 0x4008dcbd:0x3ffbe270 0x4008500d:0x3ffbe290 0x4008c3ea:0x3ffbe2b0 0x40088174:0x3ffbe2e0 0x4001792e:0x3ffbe300 0x4008c190:0x3ffbe320 0x4008bd5a:0x3ffbe340 0x4008c4af:0x3ffbe360 0x40084785:0x3ffbe380 0x4011c3c9:0x3ffc9820 0x4013cab5:0x3ffc9840 0x4013a102:0x3ffc9ad0 0x4013b899:0x3ffc9af0 0x4013cac7:0x3ffc9d80 0x4013a102:0x3ffca010 0x4013b899:0x3ffca030 0x4013cac7:0x3ffca2c0 0x4013a102:0x3ffca550 0x4013b899:0x3ffca570 0x4013cac7:0x3ffca800 0x4013a102:0x3ffcaa90 0x4013b899:0x3ffcaab0 0x4013cac7:0x3ffcad40 0x4013a102:0x3ffcafd0 0x4013b899:0x3ffcaff0 0x4013cac7:0x3ffcb280 0x4013a102:0x3ffcb510 0x4013b899:0x3ffcb530 0x4013cac7:0x3ffcb7c0 0x4013a102:0x3ffcba50 0x4013b899:0x3ffcba70 0x4013cac7:0x3ffcbd00 0x4013a102:0x3ffcbf90 0x4013b899:0x3ffcbfb0 0x4013cac7:0x3ffcc240 0x4013a102:0x3ffcc4d0 0x4013b899:0x3ffcc4f0 0x4013cac7:0x3ffcc780 0x4013a102:0x3ffcca10 0x4013b899:0x3ffcca30 0x4013cac7:0x3ffcccc0 0x4013a102:0x3ffccf50 0x4013b899:0x3ffccf70 0x4013cac7:0x3ffcd200 0x4013a102:0x3ffcd490 0x4013b899:0x3ffcd4b0 0x4013cac7:0x3ffcd740 0x4013a102:0x3ffcd9d0
01:13:17.277 ->
01:13:17.277 -> Rebooting...
Decoding stack results
0x4009165c: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
0x4009188d: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
0x4008fa5a: xTaskRemoveFromEventList at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c line 3091
0x4008dcbd: xQueueGiveFromISR at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1367
0x4008500d: semphr_give_from_isr_wrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bt.c line 528
0x4011c3c9: GATTC_Write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/stack/gatt/gatt_api.c line 1005
0x4013cab5: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1163
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
0x4013b899: bta_gattc_pop_command_to_send at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1519
0x4013cac7: bta_gattc_write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_act.c line 1170
0x4013a102: bta_gattc_sm_execute at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/bta/gatt/bta_gattc_main.c line 288
Thank you for your suggestion @chegewara. Before trying to create another task, I thought about monitoring the changes taking place in the stack. This is why I have introduced the "uxTaskGetStackHighWaterMark (NULL)" function before and after the BLE write commands. As you can see, the unused stack size is 6068, which seems quite large. The problem persists, but now the message is associated with "core 0" which surprises me. Does the BLE library run on "core 0"? Now we have some information in the Exception Decoder in the ArduinoIDE about "btagattc" It appears that there are some stored BLE write commands that are pending execution. Is there an easy way in the BLE library to check that the write function has been fully executed?
what's your opinion about it? Thanks in advance
That was really good idea, because i just assumed the problem is in main loop, but in fact stack smashing could be triggered by other task.
From backtrace i can tell that something bad and unusual i think happen in esp-idf bluetooth stack:
Decoding stack results
0x4009165c: invoke_abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 155
0x4009188d: abort at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/esp32/panic.c line 170
0x4008fa5a: xTaskRemoveFromEventList at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/tasks.c line 3091
0x4008dcbd: xQueueGiveFromISR at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/freertos/queue.c line 1367
0x4008500d: semphr_give_from_isr_wrapper at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bt.c line 528
0x4011c3c9: GATTC_Write at /home/runner/work/esp32-arduino-lib-builder/esp32-arduino-lib-builder/esp-idf/components/bt/bluedroid/stack/gatt/gatt_api.c line 1005
If its reproducible then i suggest to report it on esp-idf repo with code that can be used to reproduce it if possible. In fact maybe @me-no-dev can pass it to bluetooth team and ask for opinion.
I think it is reproducible, although it is random and sometimes you have to wait hours. On the other hand, to be sure to reproduce it 100%, perhaps you need to have the Xiaomi-Mijia-LYWSD03MMC device. MijiaTemp2_Util_test.txt
I've run your Arduino sketch on an ESP32 and it has run without the error continuously for about 9 hours.
I attach the output log (I've slightly edited your sketch to use English) and the only issue was a disconnection when I moved the LYWSD03MMC, which resulted in losing the connection briefly.
I don't know if this helps, but I could not reproduce the error over this period of 9 hours.
Hello @hampshire-al , First of all, thanks a lot for testing my code. Sorry I haven't answered you before, but I've had the project abandoned for several weeks. Yesterday I recompiled my code and after 16 hours the problem remains the same. Please, could you try it for a longer time, for example one or two days? On the other hand, I would like to know how you have integrated the LYWSD03MMC sensors in your system, and how you access the information. I would also like to know how fast is the consumption of the sensor battery.
Thanks in advance, regards
Hi @jaggil, I've finally picked this up again briefly...
I've moved the code to PlatformIO in Visual Studio Code, which requires a couple of small tweaks, but gives a slightly different log, which may help?
I attach the log: 20200623 Log file.txt
It seems that while the LYWSD03MMC was further away it had a few issues including a Stack Smashing failure, but it all settled down when the ESP32 and the LYWSD03MMC moved closer together. This may have just been a coincidence.
I am also attaching a text file with my PlatformIO version of the code: 20200623 Mijia Temp - VSC Platformio Code.txt
Sorry, haven't had time to run it longer, but maybe this helps a little?
[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.
@jaggil hi, do you have any progress?
I tried your code, but it crash:
ets Jun 8 2016 00:22:57
rst:0xc (SW_CPU_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:1
load:0x3fff0018,len:4
load:0x3fff001c,len:1216
ho 0 tail 12 room 4
load:0x40078000,len:9720
ho 0 tail 12 room 4
load:0x40080400,len:6352
entry 0x400806b8
C++ version: 201103
SDK_version: v3.2.3-14-gd3e562907
XTENSA_PORT_VERSION: 1.4.2
tskKERNEL_VERSION_NUMBER: V8.2.0
ESP32_ChipRevision: 1
chip_serial: 886F24286F24
24:6F:28:24:6F:88
ESP32_GetCpuFreqMHz(): 240
ESP32_Total heap size: 300036
ESP32_Available heap: 274268
ESP32_Lowest level of free heap since boot: 268968
ESP32_Largest block of heap that can be allocated at once: 113792
ESP32_FlashChipSize: 4194304
ESP32_FlashChipSpeed: 80000000
ESP32_SketchSize: 1117024
ESP32_SketchMD5: 1073518336
ESP32_FreeSketchSpace: 1310720
Starting Mijia client...
Reconectar....
Connected
BLE_address= a4:c1:38:16:92:57 ->Rssi= -72
Stack smashing protect failure!
abort() was called at PC 0x400dbb6c on core 1
Backtrace: 0x4009165c:0x3ffc9550 0x4009188d:0x3ffc9570 0x400dbb6c:0x3ffc9590 0x400d5e6f:0x3ffc95b0 0x400d5e96:0x3ffc9670 0x400d2227:0x0c8a1a6f
Rebooting...
Hello @tuxmartin , I have not had any progress yet, the program crashes randomly after several hours, I don't know what to do to move forward in any way.
I have stopped my project to integrate several LYWSD03MMC in Blynk
To help others. I resolved this issue by using the ArduinoBLE lib instead of the ESP32_BLE one I was using.
Hardware:
Board: ESP32 Dev Module Core Installation version: esp32-1.0.4 BLE lib : Included in the Arduino ESP32 core 1.0.4 IDE name: Arduino IDE Flash Frequency: 40Mhz PSRAM enabled: no Upload Speed: 115200 Computer OS: Windows 10
Description:
My program aims to test the Xiaomi-Mijia-LYWSD03MMC humidity and temperature sensor. This device can only be read through notifications. To try to save battery, I want to turn notifications on and off from time to time, for example every minute, but keeping the BLE connection with the device. The program basically works, but every so often and randomly, the error "Stack smashing protect failure!" Occurs. I have done several tests and introduced some modifications after reading many posts, but there have been no results. There is always a sequence when the error occurs, which is that the "Notifications turned on" command stops appearing on the serial port, and after receiving four reads / notifications the error occurs and the ESP32 automatically restarts.
Other tests carried out are the following: 1.- Cancel the on / off commands of the loop (), canceling the two programming lines // pRemoteCharacteristic_THB-> getDescriptor (BLEUUID ((uint16_t) 0x2902)) -> writeValue ((uint8_t ) notificationOff, 2, true); and the // pRemoteCharacteristic_THB-> getDescriptor (BLEUUID ((uint16_t) 0x2902)) -> writeValue ((uint8_t ) notificationOn, 2, true); In this case, and after several days, NO error occurs. 2.- Cancel only the loop () off command, canceling the programming line // pRemoteCharacteristic_THB-> getDescriptor (BLEUUID ((uint16_t) 0x2902)) -> writeValue ((uint8_t *) notificationOff, 2, true); In this case, and after several days, no error occurs either.
Therefore, the error occurs when both commands are used in loop ().
By the way, no additional information of the origin of the problem is obtained if I copy the error message in the Exception Decoder in the ArduinoIDE If I activate the Core Debug Level option in Verbose mode, the messages are not enlightening either
Please can you give me some idea to locate my fault. Am I using the BLE library commands correctly? Thanks in advance
Sketch:
Debug Messages: