I am running a simple BLE datalogger client, which runs indefinetly trying to pick up a signal from the server and datalog it. For my BLE I am using the NimBLE library.
I have added the possibility of turning this experiment off by pressing a button, which trigger that sets a flag, such that this loop is executed:
Code: Select all
else{
//log_e("Experiment off");
digitalWrite(XPERIMENT_ON_PIN,HIGH);
doConnect = false;
if(NimBLEDevice::getScan()->isScanning())
{
//We add delays, so that the GATT server has time to either startup- or shutdown before th button can pressed again
vTaskDelay(1000/portTICK_PERIOD_MS);
NimBLEDevice::getScan()->stop();
vTaskDelay(1000/portTICK_PERIOD_MS);
}
state = STATE_IDLE;
}
Code: Select all
if(xperiment_on)
{
digitalWrite(XPERIMENT_ON_PIN,LOW);
switch(state)
{
case STATE_IDLE:
log_e("%i",xperiment_on);
log_e("State: Idle");
if(!print_on)
{
NimBLEDevice::getScan()->start(scanTime,scanEndedCB);
state = STATE_LISTENING;
}
break;
case STATE_LISTENING:
//If we can connect to our server
if(doConnect)
{
connectToServer();
doConnect = false;
digitalWrite(BLE_FLASH_PIN,HIGH);
vTaskDelay(100/portTICK_PERIOD_MS);
digitalWrite(BLE_FLASH_PIN,LOW);
if(xperiment_on){
insert_at_carriage_return_and_save(TIMESTEP_VALUE_ARRAY_PATH,(time_last_read-time_start),SIZE_OF_TIMESTAMP_AFTER_FORMATTING,TIMESTEP_VALUE_ARRAY_SIZE,timestep_count*SIZE_OF_TIMESTAMP_AFTER_FORMATTING,×tep_count);
insert_at_carriage_return_and_save(SWC_VALUE_ARRAY_PATH,SWC_read,SIZE_OF_SWC_AFTER_FORMATTING,SWC_VALUE_ARRAY_SIZE,SWC_counter*SIZE_OF_SWC_AFTER_FORMATTING,&SWC_counter);
state = STATE_VALUE_RECEIVED;}
}
break;
With #8 being the call to esp_ble_scan_dupilcate_list_flush(). I cannot find any documentation on either CONFIG_BTDM_CTRL_PINNED_TO_CORE or the esp_ble_scan_dupilcate_list_flush(), beyond the header description of the latter.assert failed: interrupt_hlevel_disable bt.c:513 (xPortGetCoreID() == CONFIG_BTDM_CTRL_PINNED_TO_CORE)
Backtrace: 0x40083a71:0x3ffc8df0 0x40092c25:0x3ffc8e10 0x400986f9:0x3ffc8e30 0x400853b4:0x3ffc8f60 0x4008c7c5:0x3ffc8f80 0x4001a05d:0x3ffc8fa0 0x4004bbf1:0x3ffc8fd0 0x400f9bc1:0x3ffc8ff0 0x400f80dd:0x3ffc9010 0x400d48d3:0x3ffc9030 0x400d4986:0x3ffc9050 0x400d218d:0x3ffc9070 0x400ea785:0x3ffc9090
#0 0x40083a71:0x3ffc8df0 in panic_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/panic.c:408
#1 0x40092c25:0x3ffc8e10 in esp_system_abort at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/esp_system/esp_system.c:137
#2 0x400986f9:0x3ffc8e30 in __assert_func at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/newlib/assert.c:85
#3 0x400853b4:0x3ffc8f60 in interrupt_hlevel_disable at /Users/ficeto/Desktop/ESP32/E09opSP32S2/esp-idf-public/components/bt/controller/esp32/bt.c:513
(inlined by) interrupt_hlevel_disable at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/controller/esp32/bt.c:511
#4 0x4008c7c5:0x3ffc8f80 in r_global_int_disable at ??:?
#5 0x4001a05d:0x3ffc8fa0 in ?? ??:0
#6 0x4004bbf1:0x3ffc8fd0 in ?? ??:0
#7 0x400f9bc1:0x3ffc8ff0 in btdm_controller_scan_duplicate_list_clear at ??:?
#8 0x400f80dd:0x3ffc9010 in esp_ble_scan_dupilcate_list_flush at /Users/ficeto/Desktop/ESP32/ESP32S2/esp-idf-public/components/bt/controller/esp32/bt.c:1856
#9 0x400d48d3:0x3ffc9030 in NimBLEScan::clearDuplicateCache() at .pio/libdeps/esp32dev/NimBLE-Arduino/src/NimBLEScan.cpp:456
#10 0x400d4986:0x3ffc9050 in NimBLEScan::start(unsigned int, void (*)(NimBLEScanResults), bool) at .pio/libdeps/esp32dev/NimBLE-Arduino/src/NimBLEScan.cpp:363