ESP-IDF 5.3.4, No Arduino, Win10.
I've loaded an official "station" example which demonstrates how to connect ESP32 to a home wifi access point. Made only 2 changes: .ssid and .password in the wifi_config:
wifi_config_t wifi_config = {
.sta = {
.ssid = "Jack's S22",
.password = "1234567899999",
.threshold.authmode = ESP_WIFI_SCAN_AUTH_MODE_THRESHOLD,
.sae_pwe_h2e = ESP_WIFI_SAE_MODE,
.sae_h2e_identifier = EXAMPLE_H2E_IDENTIFIER,
},
};
Everything compiled, flashed and ran nicely. BUT, problems began when I changed the .password from 1234567899999 to 11111111 and reflashed. ESP32 immediately crashes when it reaches the WIFI:
Guru Meditation Error: Core 0 panic'ed (LoadProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x401273eb PS : 0x00060e30 A0 : 0x80129a3e A1 : 0x3ffbfe90
--- 0x401273eb: pmksa_cache_flush at D:/ESP-IDF/v5.3.4/esp-idf/components/wpa_supplicant/src/rsn_supp/pmksa_cache.c:254
A2 : 0x00000000 A3 : 0x00000000 A4 : 0x00000000 A5 : 0x00000000
A6 : 0x00000000 A7 : 0x00000056 A8 : 0xc0000000 A9 : 0x3ffbfe90
A10 : 0x00000103 A11 : 0x00000003 A12 : 0x8008a5b5 A13 : 0x3ffb9e30
A14 : 0x00000003 A15 : 0x00000000 SAR : 0x00000018 EXCCAUSE: 0x0000001c
EXCVADDR: 0x00000000 LBEG : 0x400014fd LEND : 0x4000150d LCOUNT : 0xfffffffe
--- 0x400014fd: strlen in ROM
--- 0x4000150d: strlen in ROM
I ran some tests afterwards to figure out where (the likely) overflow occurs, and discovered that the ' symbol, surprisingly is the cause:
Experiment 1:
.ssid = "Jack's S22", .password = "1234567899999", Flashes and works, no crash.
Experiment 2, ran straight after Exp.1:
.ssid = "Jack's S22", .password = "11111111", Crash (LoadProhibited)
Experiment 3, ran straight after Exp.2. ' changed to a whitespace:
.ssid = "Jack s S22", .password = "11111111", Works perfectly
I tested some other variations of .ssid and .password combinations, and all the variations that contained the ' inevitably caused crashes when the new password was shorter than the old one. There is basically no information about this quirk on the internet, whether regarding ESP32 or general C/C++.
What may be the reason and how can I avoid this without having a "No ' in your SSID" requirement for the end-user?