esp-idf: [Crash] [release/v4.4] LoadProhibited in esp_wifi/src/wifi_netif.c:110, when switching from STA to AP (IDFGH-7092)
ESP32-S3 ESP-IDF release/v4.4 (c29343eb94d2f2ca17b3a5b38c82452e556147f2) from a few days ago.
Been trying to get AP -> APSTA mode switching working. Hit a crash in ESP-IDF.
netif or esp_wifi does not appear to be cleaning up after itself correctly. See the logs. My Logs make it clear how I am calling ESP-IDF code.
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x42079352 PS : 0x00060830 A0 : 0x82078c11 A1 : 0x3fcb58b0
0x42079352: esp_wifi_get_if_mac at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_wifi/src/wifi_netif.c:110
A2 : 0x00000000 A3 : 0x3fcb58f6 A4 : 0x3fca5bbc A5 : 0x00060823
A6 : 0x00000001 A7 : 0x0000000c A8 : 0x1873e946 A9 : 0x1873e946
A10 : 0x00060823 A11 : 0x3fcb58f6 A12 : 0x00000001 A13 : 0x00060823
A14 : 0x00060023 A15 : 0x00000003 SAR : 0x00000017 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000008 LBEG : 0x40056f5c LEND : 0x40056f72 LCOUNT : 0x00000000
Backtrace:0x4207934f:0x3fcb58b00x42078c0e:0x3fcb58e0 0x42078d19:0x3fcb5920 0x420f8679:0x3fcb5950 0x420f8d57:0x3fcb5990 0x420f8e36:0x3fcb59e0 0x40385b9a:0x3fcb5a10
0x4207934f: esp_wifi_get_if_mac at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_wifi/src/wifi_netif.c:107
0x42078c0e: wifi_start at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_wifi/src/wifi_default.c:41
0x42078d19: wifi_default_action_sta_start at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_wifi/src/wifi_default.c:69
0x420f8679: handler_execute at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_event/esp_event.c:145
0x420f8d57: esp_event_loop_run at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_event/esp_event.c:598 (discriminator 3)
0x420f8e36: esp_event_loop_run_task at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/esp_event/esp_event.c:115 (discriminator 15)
0x40385b9a: vPortTaskWrapper at /Volumes/User/MBP-Google-Drive/jamcorder/firmware/esp-idf/components/freertos/port/xtensa/port.c:131
ELF file SHA256: 29e5e3aefec34919
I (7796) esp_core_dump_flash: Save core dump to flash...
I (7803) esp_core_dump_flash: Erase flash 36864 bytes @ 0xc000
I (8331) esp_core_dump_flash: Write end offset 0x87c4, check sum length 4
I (8331) esp_core_dump_flash: Core dump has been saved to flash.
CPU halted.
Logs:
I (61210) pd wifi: Entering STA Mode
I (2680) pd wifi: esp_netif_init()
I (2680) pd wifi: esp_event_loop_create_default()
I (2700) pd wifi: esp_netif_create_default_wifi_sta()
I (2700) pd wifi: esp_wifi_init()
I (2780) pd wifi: esp_event_handler_instance_register(ESP_EVENT_ANY_ID)
I (2790) pd wifi: esp_event_handler_instance_register(IP_EVENT_STA_GOT_IP)
I (2800) pd wifi: esp_wifi_set_mode(WIFI_MODE_STA)
I (2820) pd wifi: esp_wifi_set_config()
I (2820) pd wifi: esp_wifi_start()
I (61210) pd wifi: STA Mode Is Running
I (2910) pd wifi: Wifi Event: STA Mode - Start
I (2910) pd mdns: init
I (2930) pd api init: Starting HTTP Server
I (2950) pd wifi: Wifi Event: STA Mode - Connected
I (3680) pd wifi: IP Event: Station Mode - Got IP
I (3690) pd wifi: got ip: 192.168.0.180
I (61210) pd wifi: Stopping STA Mode
I (61220) pd wifi: esp_wifi_stop()
I (61220) pd wifi: Wifi Event: STA Mode - Disconnected
E (61220) pd wifi: Disconnect reason : (8) Assoc Leave
I (61240) pd wifi: Wifi Event: STA Mode - Stop
I (61260) pd wifi: esp_event_handler_instance_unregister(IP_EVENT_STA_GOT_IP)
I (61260) pd wifi: esp_event_handler_instance_unregister(ESP_EVENT_ANY_ID)
I (61270) pd wifi: esp_wifi_deinit()
I (61290) pd wifi: esp_netif_destroy(0x3fce2eb4)
I (61210) pd wifi: Entering AP Mode
I (61290) pd wifi: esp_netif_create_default_wifi_ap()
I (61300) pd wifi: esp_wifi_init()
I (61370) pd wifi: esp_event_handler_instance_register(ESP_EVENT_ANY_ID)
I (61370) pd wifi: esp_event_handler_instance_register(IP_EVENT_STA_GOT_IP)
I (61380) pd wifi: esp_wifi_set_mode(WIFI_MODE_APSTA)
I (61400) pd wifi: esp_wifi_set_config()
...crashed...
About this issue
- Original URL
- State: open
- Created 2 years ago
- Comments: 15 (11 by maintainers)
Appreciate all the information.
If not an example, perhaps a dedicated documentation page on Wifi Switching? I hate to think all this useful information will be hard to find! It would be especially useful for newer users =) Wifi switching should be made easy!
For the original crash this issue was filed for, feel free to close this issue if you don’t think there is enough to go on. I think with code inspection there might be enough info to find it. It looks like a null dereference here:
Again, appreciate you helping! Launching a product this year =)
Are you using esp_netif_new() when you’re switching ? They had a similar problem caused by esp_netif_init() when called mutliple times.