std-training
std-training copied to clipboard
Panic when SSID exceeds 32 characters
Hi,
I just noticed that using an SSID that exceeds 32 characters leads to a panic. I had one that has 33 characters. So magically this works with the C implementation I assume it only uses the first 32 characters or some null termination magic. I actually just noticed that the 2.4Ghz SSID exceeds 32 characters, Android, RPI ... happily accepted that.
WiFi router: Ubiquiti U6-LR now running the latest firmware 6.0.15.
Chip type: ESP32-C3 (revision 3)
Crystal frequency: 40MHz
Flash size: 4MB
Features: WiFi
MAC address: 7c:df:a1:da:76:5c
[00:00:01] ######################################## 12/12 segment 0x0
[00:00:00] ######################################## 1/1 segment 0x8000
[00:00:44] ######################################## 411/411 segment 0x10000
Flashing has completed!
Commands:
CTRL+R Reset chip
CTRL+C Exit
�
�ESP-ROM:esp32c3-api1-20210207
Build:Feb 7 2021
rst:0x1 (POWERON),boot:0xc (SPI_FAST_FLASH_BOOT)
SPIWP:0xee
mode:DIO, clock div:1
load:0x3fcd6100,len:0x172c
load:0x403ce000 [_coredump_iram_start:??:??],len:0x928
load:0x403d0000 [_coredump_iram_start:??:??],len:0x2ce0
entry 0x403ce000 [_coredump_iram_start:??:??]
I (30) boot: ESP-IDF v4.4-dev-2825-gb63ec47238 2nd stage bootloader
I (30) boot: compile time 12:10:40
I (30) boot: chip revision: 3
I (33) boot_comm: chip revision: 3, min. bootloader chip revision: 0
I (43) boot.esp32c3: SPI Speed : 80MHz
I (45) boot.esp32c3: SPI Mode : DIO
I (50) boot.esp32c3: SPI Flash Size : 4MB
I (55) boot: Enabling RNG early entropy source...
I (60) boot: Partition Table:
I (64) boot: ## Label Usage Type ST Offset Length
I (71) boot: 0 nvs WiFi data 01 02 00009000 00006000
I (78) boot: 1 phy_init RF data 01 01 0000f000 00001000
I (86) boot: 2 factory factory app 00 00 00010000 003f0000
I (93) boot: End of partition table
I (98) boot_comm: chip revision: 3, min. application chip revision: 0
I (105) esp_image: segment 0: paddr=00010020 vaddr=3c090020 size=18428h ( 99368) map
I (128) esp_image: segment 1: paddr=00028450 vaddr=3fc8ea00 size=02cb8h ( 11448) load
I (131) esp_image: segment 2: paddr=0002b110 vaddr=40380000 size=04f08h ( 20232) load
I (138) esp_image: segment 3: paddr=00030020 vaddr=42000020 size=82f18h (536344) map
I (223) esp_image: segment 4: paddr=000b2f40 vaddr=40384f08 size=099bch ( 39356) load
I (230) esp_image: segment 5: paddr=000bc904 vaddr=50000010 size=00010h ( 16) load
I (235) boot: Loaded app from partition at offset 0x10000
I (235) boot: Disabling RNG early entropy source...
I (251) cpu_start: Pro cpu up.
I (259) cpu_start: Pro cpu start user code
I (260) cpu_start: cpu freq: 160000000
I (260) cpu_start: Application information:
I (262) cpu_start: Project name: libespidf
I (267) cpu_start: App version: 1
I (272) cpu_start: Compile time: May 5 2022 20:25:58
I (278) cpu_start: ELF file SHA256: 0000000000000000...
I (284) cpu_start: ESP-IDF: 36823b4
I (289) heap_init: Initializing. RAM available for dynamic allocation:
I (296) heap_init: At 3FC956B0 len 0002A950 (170 KiB): DRAM
I (302) heap_init: At 3FCC0000 len 0001F060 (124 KiB): STACK/DRAM
I (309) heap_init: At 50000020 len 00001FE0 (7 KiB): RTCRAM
I (316) spi_flash: detected chip: generic
I (320) spi_flash: flash io: dio
I (324) sleep: Configure to isolate all GPIO pins in sleep state
I (331) sleep: Enable automatic switching of GPIO sleep configuration
I (338) cpu_start: Starting scheduler.
Hello, world!
I (344) pp: pp rom version: 9387209
I (344) net80211: net80211 rom version: 9387209
I (364) wifi:wifi driver task: 3fc9f7d4, prio:23, stack:6656, core=0
I (364) system_api: Base MAC address is not set
I (364) system_api: read default base MAC address from EFUSE
I (374) wifi:wifi firmware version: 63017e0
I (374) wifi:wifi certification version: v7.0
I (374) wifi:config NVS flash: enabled
I (374) wifi:config nano formating: disabled
I (384) wifi:Init data frame dynamic rx buffer num: 32
I (384) wifi:Init management frame dynamic rx buffer num: 32
I (394) wifi:Init management short buffer num: 32
I (394) wifi:Init dynamic tx buffer num: 32
I (404) wifi:Init static tx FG buffer num: 2
I (404) wifi:Init static rx buffer size: 1600
I (414) wifi:Init static rx buffer num: 10
I (414) wifi:Init dynamic rx buffer num: 32
I (414) wifi_init: rx ba win: 6
I (424) wifi_init: tcpip mbox: 32
I (424) wifi_init: udp mbox: 6
I (424) wifi_init: tcp mbox: 6
I (434) wifi_init: tcp tx win: 5744
I (434) wifi_init: tcp rx win: 5744
I (444) wifi_init: tcp mss: 1440
I (444) wifi_init: WiFi IRAM OP enabled
I (454) wifi_init: WiFi RX IRAM OP enabled
I (454) phy_init: phy_version 909,aa05aec,Apr 16 2022,13:42:08
I (544) wifi:mode : sta (7c:df:a1:da:76:5c)
I (544) wifi:enable tsf
I (2644) wifi:flush txq
I (2644) wifi:stop sw txq
I (2644) wifi:lmac stop hw txq
Guru Meditation Error: Core 0 panic'ed (Illegal instruction). Exception was unhandled.
Core 0 register dump:
MEPC : 0x420043d0 [_ZN11esp_idf_svc7private4cstr7set_str17h93acd3ac098d6da3E.llvm.10345667518865182924:??:??] RA : 0x42004216 [_ZN11esp_idf_svc4wifi186_$LT$impl$u20$core..convert..From$LT$$RF$embedded_svc..wifi..ClientConfiguration$GT$$u20$for$u20$esp_idf_svc..private..common..Newtype$LT$esp_idf_sys..bindings..wifi_sta_config_t$GT$$GT$4from17h094a9f9fa8246963E:??:??] SP : 0x3fc98e00 GP : 0x3fc8f200
TP : 0x3fc81974 T0 : 0x4005890e [chip726_phyrom_version_num:??:??] T1 : 0x0000000f T2 : 0x3fca5244
....
If you need the entire trace let me know. I'm not sure whether there are credentials in the remaining dump. Anyway I think this is really an edge case and I can not even reproduce it anymore since after upgrading my router firmware I can no longer set the SSID beyond 32 characters. So mostly leaving it here so people who encounter this can find this. Fix was basically changing the SSID to < 32 characters.
Btw. I also updated all dependencies and the one of esp32-c3-dkc02-bsc when I ran into the issue. So basically this still exists in the latest published versions. This issue also persists when changing to the pio feature.
Cargo.toml hwcheck after dependency update:
[features]
default = ["native"]
native = ["esp-idf-sys/native"]
[dependencies]
esp-idf-sys = { version = "=0.31.5", features = ["binstart"] }
esp32-c3-dkc02-bsc = { path = "../../common/lib/esp32-c3-dkc02-bsc" }
log = "0.4"
anyhow = "1"
toml-cfg = "0.1"
[build-dependencies]
embuild = "0.29"
anyhow = "1"
[patch.crates-io]
riscv = { git = "https://github.com/rust-embedded/riscv", version = "0.8"}
This https://serverfault.com/questions/45439/what-is-the-maximum-length-of-a-wifi-access-points-ssid#45509 indicates that the standard limits WI-FI SSIDs to 32 characters.