Esp32+lvgl+wifi=crash

Device : ESP32 devkit (4 MB flash, chip revision 1, ESP32-D0WDQ6)

ESP-IDF version : 4.3

Code source : lv_port_esp32 (lv_demo_widget) with wifi station connect task

Problem :
The problem only happens when I integrate a task that connects the esp32 to a wifi access point. In fact, the task is not even executed yet that I get a “Panic Core dump (LoadStore Error)”.
So the error does not come from an error in the task itself.

Console terminal result :

I (26) boot: ESP-IDF v4.3.1-dirty 2nd stage bootloader
I (26) boot: compile time 16:37:41
I (27) boot: chip revision: 1
I (30) boot_comm: chip revision: 1, min. bootloader chip revision: 0
I (37) boot.esp32: SPI Speed : 80MHz
I (41) boot.esp32: SPI Mode : DIO
I (46) boot.esp32: SPI Flash Size : 4MB
I (51) boot: Enabling RNG early entropy source…
I (56) boot: Partition Table:
I (60) boot: ## Label Usage Type ST Offset Length
I (67) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (74) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (82) boot: 2 factory factory app 00 00 00010000 00100000
I (89) boot: End of partition table
I (93) boot_comm: chip revision: 1, min. application chip revision: 0
I (100) esp_image: segment 0: paddr=00010020 vaddr=3f400020 size=9c1b0h (639408) map
I (302) esp_image: segment 1: paddr=000ac1d8 vaddr=3ffb0000 size=02f3ch ( 12092) load
I (306) esp_image: segment 2: paddr=000af11c vaddr=40080000 size=00efch ( 3836) load
I (309) esp_image: segment 3: paddr=000b0020 vaddr=400d0020 size=4a088h (303240) map
I (408) esp_image: segment 4: paddr=000fa0b0 vaddr=40080efc size=0e2b4h ( 58036) load
I (428) esp_image: segment 5: paddr=0010836c vaddr=50000000 size=00010h ( 16) load
I (436) boot: Loaded app from partition at offset 0x10000
I (436) boot: Disabling RNG early entropy source…
I (449) cpu_start: Pro cpu up.
I (449) cpu_start: Starting app cpu, entry point is 0x400813ec
0x400813ec: call_start_cpu1 at C:/Users/Utilisateur/esp/esp-idf/components/esp_system/port/cpu_start.c:141

I (0) cpu_start: App cpu up.
I (463) cpu_start: Pro cpu start user code
I (463) cpu_start: cpu freq: 240000000
I (463) cpu_start: Application information:
I (467) cpu_start: Project name: lvgl-demo
I (473) cpu_start: App version: 2.1.0.0
I (478) cpu_start: Compile time: May 3 2022 08:59:31
I (484) cpu_start: ELF file SHA256: 6721320b3e46e617…
I (490) cpu_start: ESP-IDF: v4.3.1-dirty
I (495) heap_init: Initializing. RAM available for dynamic allocation:
I (502) heap_init: At 3FFAE6E0 len 00001920 (6 KiB): DRAM
I (508) heap_init: At 3FFB3FE8 len 0002C018 (176 KiB): DRAM
I (515) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (521) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (527) heap_init: At 4008F1B0 len 00010E50 (67 KiB): IRAM
I (534) spi_flash: detected chip: generic
I (538) spi_flash: flash io: dio
I (543) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (553) I2C: i2c_initialisation
I (553) I2C: mcp23008_initialisation
I (563) gpio: GPIO[0]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (573) gpio: GPIO[2]| InputEn: 0| OutputEn: 1| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:0
I (583) gpio: GPIO[32]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:3
I (593) gpio: GPIO[33]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:3
I (603) gpio: GPIO[39]| InputEn: 1| OutputEn: 0| OpenDrain: 0| Pullup: 0| Pulldown: 0| Intr:3
I (603) gpio: GPIO[0]| InputEn: 0| OutputEn: 0| OpenDrain: 0| Pullup: 1| Pulldown: 0| Intr:0

Opening Non-Volatile Storage (NVS) handle… Done
Reading restart counter from NVS …
intervalle_lavage= 100
The value is not initialized yet!
I (633) lvgl_helpers: Display buffer size: 53248
I (633) lvgl_helpers: Initializing SPI master for FT81X
I (643) lvgl_helpers: Configuring SPI host VSPI_HOST (2)
I (643) lvgl_helpers: MISO pin: 19, MOSI pin: 23, SCLK pin: 18, IO2/WP pin: 16, IO3/HD pin: 4
I (663) lvgl_helpers: Max transfer size: 212992 (bytes)
I (663) lvgl_helpers: Initializing SPI bus…
I (663) disp_spi: Adding SPI device
I (673) disp_spi: Clock speed: 23000000Hz, mode: 0, CS pin: 5
I (753) FT81X: Switching to QIO mode
I (773) FT81X: DummyReadBits = 2
I (1773) FT81X: CHIP ID (Display EVE3) = 124
REG_FREQUENCY = 72000000
Guru Meditation Error: Core 0 panic’ed (LoadStoreError). Exception was unhandled.

Core 0 register dump:
PC : 0x40118fc0 PS : 0x00060f30 A0 : 0x800e0d4c A1 : 0x3ffbace0
0x40118fc0: lv_style_get_prop_inlined at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/misc/lv_style.h:373
(inlined by) lv_style_get_prop at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/misc/lv_style.c:214

A2 : 0x3f4867b8 A3 : 0x00001032 A4 : 0x3ffbad00 A5 : 0x00000000
A6 : 0x00000010 A7 : 0x00000001 A8 : 0x00000100 A9 : 0x00000000
A10 : 0x400f43d8 A11 : 0x400f43d8 A12 : 0x400f42d8 A13 : 0x00000040
0x400f43d8: lv_disp_draw_buf_init at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/hal/lv_hal_disp.c:108

0x400f43d8: lv_disp_draw_buf_init at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/hal/lv_hal_disp.c:108

0x400f42d8: lv_font_get_glyph_dsc_fmt_txt at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/font/lv_font_fmt_txt.c:150

A14 : 0x00001001 A15 : 0x00000000 SAR : 0x0000001d EXCCAUSE: 0x00000003
EXCVADDR: 0x400f43d8 LBEG : 0x400013f9 LEND : 0x4000140d LCOUNT : 0xfffffffa
0x400f43d8: lv_disp_draw_buf_init at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/hal/lv_hal_disp.c:108

Backtrace:0x40118fbd:0x3ffbace0 0x400e0d49:0x3ffbad00 0x400e0dac:0x3ffbad50 0x400de437:0x3ffbad80 0x400fb929:0x3ffbada0 0x400fc42e:0x3ffbae40 0x40117bb9:0x3ffbae80 0x400da9a3:0x3f
0x400e115d:0x3ffbaf20 0x400d82ae:0x3ffbaf40 0x400d979b:0x3ffbb050 0x400d987b:0x3ffbb070 0x400d6d37:0x3ffbb090 0x400d6df3:0x3ffbb0b0 0x4008afbd:0x3ffbb140
0x40118fbd: lv_style_get_prop_inlined at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/misc/lv_style.h:373
(inlined by) lv_style_get_prop at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/misc/lv_style.c:214

0x400e0d49: get_prop_core at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_style.c:587

0x400e0dac: lv_obj_get_style_prop at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_style.c:220

0x400de437: lv_obj_get_style_border_width at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_style_gen.h:298
(inlined by) lv_obj_get_content_coords at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_pos.c:573

0x400fb929: lv_label_refr_text at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/widgets/lv_label.c:891

0x400fc42e: lv_label_event at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/widgets/lv_label.c:758

0x40117bb9: lv_obj_event_base at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_event.c:96

0x400da9a3: event_send_core at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_event.c:414

0x400daa52: lv_event_send at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_event.c:73

0x400e103d: lv_obj_refresh_style at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_style.c:182

0x400e115d: lv_obj_add_style at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lvgl/src/core/lv_obj_style.c:103

0x400d82ae: infos_create at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lv_examples/lv_examples/src/lv_confortum/lv_confortum.c:370

0x400d979b: main_page at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lv_examples/lv_examples/src/lv_confortum/lv_confortum.c:222

0x400d987b: lv_confortum at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/components/lv_examples/lv_examples/src/lv_confortum/lv_confortum.c:192

0x400d6d37: create_demo_application at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/main/main.c:552

0x400d6df3: guiTask at C:\Users\Utilisateur\esp\esp-idf\lv_port_esp32_9\build/…/main/main.c:526 (discriminator 2)

0x4008afbd: vPortTaskWrapper at C:/Users/Utilisateur/esp/esp-idf/components/freertos/port/xtensa/port.c:168

ELF file SHA256: 6721320b3e46e617

Rebooting…

I know this is old but it needs to have an answer.

This is because of the pin configuration of the ESP32. The WiFi portion when in use has issues with specific pins.

ADC1 is recommended over ADC2 as the latter cannot be used when Wi-Fi function is enabled.

https://www.espressif.com/sites/default/files/documentation/esp32_hardware_design_guidelines_en.pdf#10