Have I missed something in the de-init? Am I just running out of RAM? Is there a way to "pause" the btle stack - Stopping the radio and the tasks and but not deallocating or losing all the configuration?
Thanks in advance for your help.
Felix
Code: Select all
assert failed: block_locate_free tlsf.c:572 (block_size(block) >= size)
<snipped backtrace for brevity>
0x400821ca: panic_abort at C:/Users/felix/esp5/esp-idf/components/esp_system/panic.c:412
0x40093789: esp_system_abort at C:/Users/felix/esp5/esp-idf/components/esp_system/esp_system.c:135
0x40099eea: __assert_func at C:/Users/felix/esp5/esp-idf/components/newlib/assert.c:78
0x400990e0: block_locate_free at C:/Users/felix/esp5/esp-idf/components/heap/tlsf/tlsf.c:572
(inlined by) tlsf_malloc at C:/Users/felix/esp5/esp-idf/components/heap/tlsf/tlsf.c:934
0x40098c33: multi_heap_malloc_impl at C:/Users/felix/esp5/esp-idf/components/heap/multi_heap.c:217
0x400823cd: heap_caps_malloc_base at C:/Users/felix/esp5/esp-idf/components/heap/heap_caps.c:146
0x4008242b: heap_caps_malloc at C:/Users/felix/esp5/esp-idf/components/heap/heap_caps.c:166
0x4009528e: xTaskCreatePinnedToCore at C:/Users/felix/esp5/esp-idf/components/freertos/FreeRTOS-Kernel/tasks.c:876
0x400ec48d: esp_nimble_enable at C:/Users/felix/esp5/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c:41
0x400ec4b5: nimble_port_freertos_init at C:/Users/felix/esp5/esp-idf/components/bt/host/nimble/nimble/porting/npl/freertos/src/nimble_port_freertos.c:70
<my code below here - running in task context>
Code: Select all
void gl_ble_spp_server_init(void)
{
nimble_port_init();
/* Initialize the NimBLE host configuration. */
ble_hs_cfg.reset_cb = ble_spp_server_on_reset;
ble_hs_cfg.sync_cb = ble_spp_server_on_sync;
ble_hs_cfg.gatts_register_cb = gatt_svr_register_cb;
ble_hs_cfg.store_status_cb = ble_store_util_status_rr;
ble_hs_cfg.sm_io_cap = BLE_SM_IO_CAP_DISP_ONLY;
ble_hs_cfg.sm_bonding = 1;
ble_hs_cfg.sm_mitm = 1;
ble_hs_cfg.sm_sc = 1;
ble_hs_cfg.sm_our_key_dist = 1;
ble_hs_cfg.sm_their_key_dist = 1;
/* Register custom service */
int rc = gatt_svr_register();
assert(rc == 0);
/* Set the default device name. */
char name[] = "TestBLEspp";
rc = ble_svc_gap_device_name_set(name);
assert(rc == 0);
/* XXX Need to have template for store */
ble_store_config_init();
nimble_port_freertos_init(ble_spp_server_host_task);
}
void gl_ble_spp_server_deinit(void)
{
esp_err_t ret = ESP_ERROR_CHECK_WITHOUT_ABORT(nimble_port_stop());
if (ret == ESP_OK)
{
nimble_port_deinit();
ESP_ERROR_CHECK_WITHOUT_ABORT(esp_nimble_hci_deinit());
}
enabled = false;
}