Wi-Fi Provisioning
Posted: Fri May 23, 2025 2:08 pm
ESP-IDF Ver: v5.3.2
Devkit: ESP32 S3 N8R8
Requirements
My handler code
Fixes applied by me for resolving these problem
Devkit: ESP32 S3 N8R8
Requirements
- Trying to start the Wi-Fi provisioning again after getting Wi-Fi provisioning fail event
- It should be able to start provisioning everytime after receiving incorrect credentials, unavailability of Wi-Fi network
- It should be able to provision multiple times in runtime without restarting the device
Code: Select all
assert failed: insert_free_block tlsf.c:358 (current && "free list cannot have a null entry")
HINT: CORRUPT HEAP: heap metadata corrupted resulting in TLSF malfunction.
Make sure you are not making out of bound writing on the memory you allocate in your application.
Make sure you are not writing on freed memory.
For more information run 'idf.py docs -sp api-reference/system/heap_debug.html'.
Backtrace: 0x40375c5a:0x3fcb50b0 0x403817a5:0x3fcb50d0 0x40389d41:0x3fcb50f0 0x40387a7b:0x3fcb5210 0x40387590:0x3fcb5230 0x403765e6:0x3fcb5250 0x40389d71:0x3fcb5270 0x42020931:0x3fcb5290 0x4201d323:0x3fcb52b0 0x4201d855:0x3fcb52e0 0x420ed63d:0x3fcb5310 0x420ecff1:0x3fcb5340 0x420ed0b1:0x3fcb5380 0x40382389:0x3fcb53a0
--- 0x40375c5a: panic_abort at /home/mayank/esp/esp-idf/components/esp_system/panic.c:463
--- 0x403817a5: esp_system_abort at /home/mayank/esp/esp-idf/components/esp_system/port/esp_system_chip.c:87
--- 0x40389d41: __assert_func at /home/mayank/esp/esp-idf/components/newlib/assert.c:80
--- 0x40387a7b: insert_free_block at /home/mayank/esp/esp-idf/components/heap/tlsf/tlsf.c:358 (discriminator 1)
--- (inlined by) block_insert at /home/mayank/esp/esp-idf/components/heap/tlsf/tlsf.c:388 (discriminator 1)
--- (inlined by) tlsf_free at /home/mayank/esp/esp-idf/components/heap/tlsf/tlsf.c:1205 (discriminator 1)
--- 0x40387590: multi_heap_free_impl at /home/mayank/esp/esp-idf/components/heap/multi_heap.c:235
--- 0x403765e6: heap_caps_free at /home/mayank/esp/esp-idf/components/heap/heap_caps_base.c:75
--- 0x40389d71: free at /home/mayank/esp/esp-idf/components/newlib/heap.c:39
--- 0x42020931: protocomm_delete at /home/mayank/esp/esp-idf/components/protocomm/src/common/protocomm.c:50
--- 0x4201d323: prov_stop_and_notify at /home/mayank/esp/esp-idf/components/wifi_provisioning/src/manager.c:586
--- 0x4201d855: wifi_prov_mgr_event_handler_internal at /home/mayank/esp/esp-idf/components/wifi_provisioning/src/manager.c:1001
--- 0x420ed63d: handler_execute at /home/mayank/esp/esp-idf/components/esp_event/esp_event.c:136
--- 0x420ecff1: esp_event_loop_run at /home/mayank/esp/esp-idf/components/esp_event/esp_event.c:696
--- 0x420ed0b1: esp_event_loop_run_task at /home/mayank/esp/esp-idf/components/esp_event/esp_event.c:106
--- 0x40382389: vPortTaskWrapper at /home/mayank/esp/esp-idf/components/freertos/FreeRTOS-Kernel/portable/xtensa/port.c:139Code: Select all
case WIFI_PROV_FAILED_EVENT:
ESP_LOGE(CONN_MNGR_TAG, "Provisioning failed");
if(wifi_prov_check_for_provisioning_enabled())
{
ESP_LOGI(CONN_MNGR_TAG, "Provisioning is enabled");
wifi_prov_stop_provisioning(); // wifi_prov_check_for_provisioning_enabled is assigned with false in this function
vTaskDelay(1000 / portTICK_PERIOD_MS);
}
if(ESP_OK != wifi_prov_start_provisioning()) // wifi_prov_check_for_provisioning_enabled is assigned with true in this function
{
ESP_LOGE(CONN_MNGR_TAG,"Error in wifi_prov_start_provisioning()");
}
wifi_prov_start_provisioning_timer();
break;- Calling Wi-Fi provisioning stop function everytime before Wi-Fi provisioning start function also added a delay of 1 sec to allow safe release of release before starting provisioning service again
- Increased stack of the task handling these process from 4 kb to 8kb
- Used wifi_prov_mgr_reset_sm_state_on_failure() function for reprovisioning purpose but still getting the same error
- Verified use of stop provisioning function twice in row