StoreProhibited when trying to set callback for BLE
Posted: Tue Sep 17, 2019 2:05 pm
Hi,
I have been searching for some days now, but cannot seem to find my mistake. The error happens when I try to set a callback in the BLE class. I checked whether the callback is NULL, but it isn't.
Here is my stack trace:
Here is the code snippet Connected.cpp:102
where callback is a static variable of type BLECharacteristicCallbacks defined in Advertising.h, which is included in Connected.h.
The line 560 is as follows:
Could it be that m_pCallbacks was not initialized since the address EXCVADDR is so close to zero (0x00000050)?
Any help would be appreciated!
I have been searching for some days now, but cannot seem to find my mistake. The error happens when I try to set a callback in the BLE class. I checked whether the callback is NULL, but it isn't.
Here is my stack trace:
Code: Select all
D (13343) BLECharacteristic: >> setCallbacks: 0x3ffdba58
Guru Meditation Error: Core 0 panic'ed (StoreProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x4012c41c PS : 0x00060030 A0 : 0x80122868 A1 : 0x3ffbc320
0x4012c41c: BLECharacteristic::setCallbacks(BLECharacteristicCallbacks*) at /home/julian/Documents/chaze-esp32/components/arduino/libraries/BLE/src/BLECharacteristic.cpp:560
A2 : 0x00000000 A3 : 0x3ffdba58 A4 : 0x3f4149c0 A5 : 0x0000000c
A6 : 0x00000000 A7 : 0x00000005 A8 : 0x8012c41c A9 : 0x3ffbc2d0
A10 : 0x401149b4 A11 : 0x3ffcdb00 A12 : 0x3f4149d4 A13 : 0x0000001f
0x401149b4: vprintf at /Users/ivan/e/newlib_xtensa-2.2.0-bin/newlib_xtensa-2.2.0/xtensa-esp32-elf/newlib/libc/stdio/../../../.././newlib/libc/stdio/vprintf.c:35
A14 : 0x00000001 A15 : 0x00000005 SAR : 0x00000004 EXCCAUSE: 0x0000001d
EXCVADDR: 0x00000050 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffb
ELF file SHA256: a87f7e18600a99461bae758a7fde3b6055f194a08e8a16ba4c24a67ab7ca11aa
Backtrace: 0x4012c41c:0x3ffbc320 0x40122865:0x3ffbc340 0x4010803c:0x3ffbc360 0x400d0b5a:0x3ffbc380 0x400949a1:0x3ffbc3a0
0x4012c41c: BLECharacteristic::setCallbacks(BLECharacteristicCallbacks*) at /home/julian/Documents/chaze-esp32/components/arduino/libraries/BLE/src/BLECharacteristic.cpp:560
0x40122865: connected() at /home/julian/Documents/chaze-esp32/components/Chaze_Connected/Chaze_Connected.cpp:102
0x4010803c: app_main at /home/julian/Documents/chaze-esp32/main/main.cpp:44 (discriminator 8)
0x400d0b5a: main_task at /home/julian/esp/esp-idf/components/esp32/cpu_start.c:542 (discriminator 2)
0x400949a1: vPortTaskWrapper at /home/julian/esp/esp-idf/components/freertos/port.c:143
Code: Select all
void connected()
{
CONNECTED_STATE = IDLE;
callback = new ConnectedCallbacks();
if(callback != NULL)
ble.pRxCharacteristic->setCallbacks(callback); [Error happens here]
else
ESP_LOGE(TAG_Con, "Callback is NULL."); config.STATE = DEEPSLEEP; return;
...
}
The line 560 is as follows:
Code: Select all
/**
* @brief Set the callback handlers for this characteristic.
* @param [in] pCallbacks An instance of a callbacks structure used to define any callbacks for the characteristic.
*/
void BLECharacteristic::setCallbacks(BLECharacteristicCallbacks* pCallbacks) {
ESP_LOGD(LOG_TAG, ">> setCallbacks: 0x%x", (uint32_t)pCallbacks);
m_pCallbacks = pCallbacks;
ESP_LOGD(LOG_TAG, "<< setCallbacks");
} // setCallbacks
Any help would be appreciated!