Initial Setup to AP and reInit to STA does not work properly
Posted: Sun Oct 10, 2021 9:32 am
I have created a small test example that esp wifi starts as AP if there are not credentials for ssid and pass in nvs.
Then from html you can set the ssid and pass to login and wifi is reinitialized to switch from AP to STA.
I a using esp-idf v4.4
As process the issues are:
After erase_flash ,flash and monitor the esp start to setup as AP.
At that moment before wifi_start i try to get wifi mode and the netif_config_t and i get
After wifi start esp is AP but the ssid is not the same from what set in config. ssid of AP is ESP_C845D5 while in program was EspSSID , password works and i can login.
One more thing here i do not like the way wifi_ap_config_t is created but i can not use .ssid cause i get
After this normal login of laptop to esp happens and also normally with form i am passing the ssid and the pass to setup the wifi connection. Then wifi init happens again.
At this time esp goes to setup as STA, i destroy previous netif and create default of STA.
Then the same log happens after the end of sta setup for the wifi mode and the netif. Wifi mode is still null but netif is changed but wifi mode when esp starts on the last row is again softAP and not STA
Next is a guru error crash and a restart
After reboot esp tries to setup as STA credentials still exist in nvs but, netif can not be identified either as STA either as AP
Of course after these i get wifi mode null and no netif log cause it is null
I am giving you the complete log and these 3 functions with the wifi init and the two setups for sta and ap.
As you see something is completely wrong. Can someone show me the proper fixes?
Thanx
Then from html you can set the ssid and pass to login and wifi is reinitialized to switch from AP to STA.
I a using esp-idf v4.4
As process the issues are:
After erase_flash ,flash and monitor the esp start to setup as AP.
At that moment before wifi_start i try to get wifi mode and the netif_config_t and i get
Code: Select all
W (660) WIFI_INIT: After reInit of mode
W (670) WIFI_INIT: wifi mode is null
W (670) WIFI_INIT: desc: ap
W (680) WIFI_INIT: key: WIFI_AP_DEF
One more thing here i do not like the way wifi_ap_config_t is created but i can not use .ssid cause i get
so i put it immediately as you will see in code. And in order not to set all the params i set authmode outside."message": "C99 designator 'ssid' outside aggregate initializer"
After this normal login of laptop to esp happens and also normally with form i am passing the ssid and the pass to setup the wifi connection. Then wifi init happens again.
Code: Select all
I (850) CONNECTION: Processing...
I (860) SERVER: Starting server...
I (860) CONNECTION: Registered Endpoints...
I (11710) wifi:new:<1,0>, old:<1,1>, ap:<1,1>, sta:<255,255>, prof:1
I (11710) wifi:station: f4:5c:89:c8:e2:77 join, AID=1, bgn, 20
W (11760) wifi:<ba-add>idx:4 (ifx:1, f4:5c:89:c8:e2:77), tid:6, ssn:0, winSize:64
I (11780) esp_netif_lwip: DHCP server assigned IP to a station, IP is: 192.168.4.2
Code: Select all
I (54950) wifi:flush txq
I (54950) wifi:stop sw txq
I (54950) wifi:lmac stop hw txq
W (54950) ON STA INIT: inside STA
W (54950) ON STA INIT: CRED ssid: MyWeb24, pwd: ComeAndGetIt
W (54950) ON STA INIT: netif is AP and we reset
W (54960) ON STA INIT: in config ssid: MyWeb24, pass: ComeAndGetIt
Code: Select all
W (55000) WIFI_INIT: After reInit of mode
W (55010) WIFI_INIT: wifi mode is null
W (55010) WIFI_INIT: desc: sta
W (55020) WIFI_INIT: key: WIFI_STA_DEF
I (55020) wifi:mode : softAP (f0:08:d1:c8:45:d5)
Code: Select all
Guru Meditation Error: Core 0 panic'ed (InstrFetchProhibited). Exception was unhandled.
Core 0 register dump:
PC : 0x00000000 PS : 0x00060830 A0 : 0x800e6154 A1 : 0x3ffc2210
A2 : 0x3ffbfe78 A3 : 0x3ffcae44 A4 : 0x0000002a A5 : 0x3ffcadb8
A6 : 0x000000a5 A7 : 0x40084df0 A8 : 0x80149e1c A9 : 0x3ffb23a8
0x40084df0: task_yield_from_isr_wrapper at /Users/kyrpav/esp/esp-idf/components/esp_wifi/esp32/esp_adapter.c:243
A10 : 0x00000000 A11 : 0x3ffcae44 A12 : 0x0000002a A13 : 0x3ffcadb8
A14 : 0x3ffb3a98 A15 : 0x3ffb0b30 SAR : 0x00000010 EXCCAUSE: 0x00000014
EXCVADDR: 0x00000000 LBEG : 0x4000c2e0 LEND : 0x4000c2f6 LCOUNT : 0xffffffff
Backtrace:0xfffffffd:0x3ffc22100x400e6151:0x3ffc2230 0x4010671d:0x3ffc2250 0x4010720b:0x3ffc2350 0x40092d9d:0x3ffc2370 0x40090be4:0x3ffc2390 0x4008b991:0x3ffc23c0
0x400e6151: wifi_ap_receive at /Users/kyrpav/esp/esp-idf/components/esp_wifi/src/wifi_netif.c:52
0x4010671d: hostap_input at ??:?
0x4010720b: ap_rx_cb at ??:?
0x40092d9d: ppRxPkt at ??:?
0x40090be4: ppTask at ??:?
0x4008b991: vPortTaskWrapper at /Users/kyrpav/esp/esp-idf/components/freertos/port/xtensa/port.c:159
Code: Select all
W (20) ON STA INIT: inside STA
W (20) ON STA INIT: CRED ssid: MyWeb24, pwd: ComeAndGetIt
W (20) ON STA INIT: netif is not AP
W (30) ON STA INIT: netif is not STA also
W (30) ON STA INIT: in config ssid: MyWeb24, pass: ComeAndGetIt
Code: Select all
W (699) WIFI_INIT: After reInit of mode
W (699) WIFI_INIT: wifi mode is null
I (709) phy_init: phy_version 4670,719f9f6,Feb 18 2021,17:07:07
I (809) wifi:mode : softAP (f0:08:d1:c8:45:d5)
As you see something is completely wrong. Can someone show me the proper fixes?
Thanx