Open xiaodingding opened 6 years ago
Use this to decode backtrace: https://github.com/me-no-dev/EspExceptionDecoder
I found similar phenomenon with "The library source for the ESP32 BLE support for Arduino". But I cannot find root cause.
abort() was called at PC 0x401a8ccb on core 0
Backtrace: 0x40094ec8:0x3ffecb70 0x400950cb:0x3ffecb90 0x401a8ccb:0x3ffecbb0 0x401a8d12:0x3ffecbd0 0x40196827:0x3ffecbf0 0x40196a4e:0x3ffecc10 0x400d5a5b:0x3ffecc30 0x400d5da1:0x3ffecc60 0x400d501d:0x3ffecdb0 0x400e4d69:0x3ffece00 0x400e2956:0x3ffece20
decoded backtrace is here.
/Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c:649 /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/esp32/panic.c:649 /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112 /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_terminate.cc:112 /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/eh_throw.cc:87 /builds/idf/crosstool-NG/.build/src/gcc-5.2.0/libstdc++-v3/libsupc++/new_op.cc:54 c:\users\foo\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\ext/new_allocator.h:104 c:\users\foo\appdata\local\arduino15\packages\esp32\tools\xtensa-esp32-elf-gcc\1.22.0-80-g6c4433a-5.2.0\xtensa-esp32-elf\include\c++\5.2.0\bits/stl_vector.h:923 C:\Users\foo\AppData\Local\Arduino15\packages\esp32\hardware\esp32\1.0.0\libraries\BLE\src/BLEDevice.cpp:536 /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/profile/std/gap/btc_gap_ble.c:956 /Users/ficeto/Desktop/ESP32/ESP32/esp-idf-public/components/bt/bluedroid/btc/core/btc_task.c:110
Its hard to say. Could you paste logs before app crash?
I modify BLEscan sample.
I guess below code may crush.
BLEScanResults foundDevices = pBLEScan->start(scanTime);
I could see below output on serial monitor.
Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
However, this code cannot output below message.
Serial.println("\nScan done!");
code is here.
`#include
int scanTime = 1; double data_C_int; int data_D_int;
struct data_element { int data_A; int data_B; double data_C; int data_D; };
struct data_element data_table[256]; int data_max_value; const uint8_t cs_SD = 5;
void initial_data_table(){ for(int i = 0; i < 256; i++) { data_table[i].data_A = 0; data_table[i].data_B = 0; data_table[i].data_C = 0; data_table[i].data_D = 0; } data_C_int=0; data_D_int=0; data_max_value = 0; }
class MyAdvertisedDeviceCallbacks: public BLEAdvertisedDeviceCallbacks { void onResult(BLEAdvertisedDevice advertisedDevice) {
Serial.printf("Advertised Device: %s \n", advertisedDevice.toString().c_str());
} };
void setup() {
Serial.begin(115200);
Serial.flush(); Serial.write('\n');
SD.begin(cs_SD,SPI, 24000000, "/sd");
char ssid = "XXXXX"; char password = "XXXXX";
Serial.println("connect Wifi"); WiFi.mode(WIFI_STA); WiFi.begin(ssid,password);
delay(1000);
while(WiFi.status() == WL_CONNECTED){ WiFi.disconnect(); delay(2000); }
Serial.println("disconnected");
WiFi.mode(WIFI_OFF);
Serial.println("WiFi OFF");
delay(2000);
data_C_int=0; data_D_int=0;
}
void loop() { initial_data_table();
Serial.println("init"); BLEDevice::init("");
Serial.println("getScan"); BLEScan* pBLEScan = BLEDevice::getScan();
Serial.println("setAdvertisedDeviceCallbacks"); pBLEScan->setAdvertisedDeviceCallbacks(new MyAdvertisedDeviceCallbacks());
Serial.println("setActiveScan"); pBLEScan->setActiveScan(true);
Serial.println(esp_get_free_heap_size());
Serial.println("pBLEScan->start()"); BLEScanResults foundDevices = pBLEScan->start(scanTime);
Serial.println("\nScan done!");
} `
Try to comment this line, i think its bug in esp-idf:
WiFi.mode(WIFI_OFF);
My envionment changes to ESP-IDF. This phnomenon disappeared. https://github.com/espressif/arduino-esp32/blob/master/docs/esp-idf_component.md
You have to remember that arduino-esp32 is few commits behind esp-idf master.
lib: ESP32_BLE Backtrace: 0x40090c38:0x3ffd1dc0 0x40090e3b:0x3ffd1de0 0x4018315f:0x3ffd1e00 0x401831a6:0x3ffd1e20 0x40170bd3:0x3ffd1e40 0x400d4ebd:0x3ffd1e60 0x400d1a9d:0x3ffd1ec0 0x400d1b86:0x3ffd1f10 0x400d1d5f:0x3ffd1f70
device connect to ble server ,esp32 will reboot.