Re: Can't connect WiFi after restart
Posted: Fri Apr 10, 2020 7:14 pm
I am having a very similiar issue. After I restarted my ESP32 I am no longer avle to connect to my WiFi. I have power cycled the ESP32 and also power cycled my WiFi and still no luck.
I tried using the example script. NOTE: I do not have my network secured with a WiFi password. I am connecting to an actual AP and not a router. There is no DHCP server on the AP. I am using a dedicated DHCP server.
here is the log of me trying to connect
Everything was working without issue. then all of a sudden after a restart I am not able to connect no matter what I do. I have not flashed the ESP32 again. I will be trying this. The problem is 100% with MicroPython/ESP32 and is not my AP or my DHCP. I know this because I do not have a single log entry for even an attempt to connect.
This section of the log from my AP shows me connecting with my cell phone. You can see the entries. I had the ESP32 trying to connect while I connected with my cell phone. but yet you see no attempt to connect from the ESP.
the MAC address for the ESP32 is 4c:11:ae:cc:0c:e4
I disconnected my cell phone from the 5ghz side of my AP and connected it to the 2.4 GHZ that is why you see the disconnect then the reconnect
ath8 = 5ghz
ath0 = 2.4ghz
The ESP32 is not even trying to make the connection so I am not exactly sure where it is coming up with WIFI_REASON_AUTH_EXPIRE as a failure reason when it hasn't even tried to connect.
I just tried enabling security on my AP and adding the password to the connect script and still no luck. It still spits out the same error.
I tried using the example script. NOTE: I do not have my network secured with a WiFi password. I am connecting to an actual AP and not a router. There is no DHCP server on the AP. I am using a dedicated DHCP server.
Code: Select all
def connect():
import network
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print('connecting to network...')
sta_if.active(True)
sta_if.connect('SSID')
while not sta_if.isconnected():
pass
print('network config:', sta_if.ifconfig())
here is the log of me trying to connect
Code: Select all
ets Jun 8 2016 00:22:57
rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
configsip: 0, SPIWP:0xee
clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
mode:DIO, clock div:2
load:0x3fff0018,len:4
load:0x3fff001c,len:5008
ho 0 tail 12 room 4
load:0x40078000,len:10600
ho 0 tail 12 room 4
load:0x40080400,len:5684
entry 0x400806bc
I (533) cpu_start: Pro cpu up.
I (533) cpu_start: Application information:
I (533) cpu_start: Compile time: Apr 10 2020 00:39:52
I (536) cpu_start: ELF file SHA256: 0000000000000000...
I (542) cpu_start: ESP-IDF: v3.3.1
I (547) cpu_start: Starting app cpu, entry point is 0x4008363c
I (0) cpu_start: App cpu up.
I (558) heap_init: Initializing. RAM available for dynamic allocation:
I (564) heap_init: At 3FFAFF10 len 000000F0 (0 KiB): DRAM
I (570) heap_init: At 3FFB6388 len 00001C78 (7 KiB): DRAM
I (576) heap_init: At 3FFB9A20 len 00004108 (16 KiB): DRAM
I (583) heap_init: At 3FFBDB5C len 00000004 (0 KiB): DRAM
I (589) heap_init: At 3FFCC818 len 000137E8 (77 KiB): DRAM
I (595) heap_init: At 3FFE0440 len 00003AE0 (14 KiB): D/IRAM
I (601) heap_init: At 3FFE4350 len 0001BCB0 (111 KiB): D/IRAM
I (608) heap_init: At 400999CC len 00006634 (25 KiB): IRAM
I (614) cpu_start: Pro cpu start user code
I (297) cpu_start: Starting scheduler on PRO CPU.
I (0) cpu_start: Starting scheduler on APP CPU.
I (130) modsocket: Initializing
I (130) pm_esp32: Frequency switching config: CPU_MAX: 240, APB_MAX: 240, APB_MIN: 240, Light sleep: DISABLED
240000000
MicroPython v1.12-357-g740946736 on 2020-04-10; ESP32 module with ESP32
Type "help()" for more information.
>>> import boot
I (5040) pm_esp32: Frequency switching config: CPU_MAX: 240, APB_MAX: 240, APB_MIN: 240, Light sleep: DISABLED
240000000
>>> boot.connect()
I (10620) wifi: wifi driver task: 3ffd2ea0, prio:23, stack:3584, core=0
I (21393) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (21393) system_api: Base MAC address is not set, read default base MAC address from BLK0 of EFUSE
I (21423) wifi: wifi firmware version: ac331d7
I (21423) wifi: config NVS flash: enabled
I (21423) wifi: config nano formating: disabled
I (21423) wifi: Init dynamic tx buffer num: 32
I (21423) wifi: Init data frame dynamic rx buffer num: 32
I (21433) wifi: Init management frame dynamic rx buffer num: 32
I (21443) wifi: Init management short buffer num: 32
I (21443) wifi: Init static rx buffer size: 1600
I (21443) wifi: Init static rx buffer num: 10
I (21453) wifi: Init dynamic rx buffer num: 32
connecting to network...
I (21553) phy: phy_version: 4102, 2fa7a43, Jul 15 2019, 13:06:06, 0, 0
I (21553) wifi: mode : sta (4c:11:ae:cc:0c:e4)
I (21553) wifi: STA_START
I (22403) wifi: new:<8,0>, old:<1,0>, ap:<255,255>, sta:<8,0>, prof:1
I (22403) wifi: state: init -> auth (b0)
I (23403) wifi: state: auth -> init (200)
I (23403) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (23403) wifi: STA_DISCONNECTED, reason:2
I (25463) wifi: STA_DISCONNECTED, reason:205
I (25583) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (25583) wifi: state: init -> auth (b0)
I (26583) wifi: state: auth -> init (200)
I (26583) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (26583) wifi: STA_DISCONNECTED, reason:2
I (28643) wifi: STA_DISCONNECTED, reason:205
I (28763) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (28763) wifi: state: init -> auth (b0)
I (29763) wifi: state: auth -> init (200)
I (29763) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (29763) wifi: STA_DISCONNECTED, reason:2
I (31823) wifi: STA_DISCONNECTED, reason:205
I (31943) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (31943) wifi: state: init -> auth (b0)
I (32943) wifi: state: auth -> init (200)
I (32943) wifi: new:<8,0>, old:<8,0>, ap:<255,255>, sta:<8,0>, prof:1
I (32943) wifi: STA_DISCONNECTED, reason:2
This section of the log from my AP shows me connecting with my cell phone. You can see the entries. I had the ESP32 trying to connect while I connected with my cell phone. but yet you see no attempt to connect from the ESP.
the MAC address for the ESP32 is 4c:11:ae:cc:0c:e4
I disconnected my cell phone from the 5ghz side of my AP and connected it to the 2.4 GHZ that is why you see the disconnect then the reconnect
ath8 = 5ghz
ath0 = 2.4ghz
Code: Select all
1 2020 April-10 11:31:40 Station has associated. Interface: ath8, MAC: c0:ee:fb:6c:4e:99
2 2020 April-10 11:31:40 starting accounting session 00000027-00000001 Interface: ath8, MAC: c0:ee:fb:6c:4e:99
3 2020 April-10 11:31:47 Station has disassociated. Interface: ath8, MAC: c0:ee:fb:6c:4e:99
4 2020 April-10 11:31:48 Station has associated. Interface: ath0, MAC: 46:25:34:15:5f:66
5 2020 April-10 11:31:48 starting accounting session 00000027-00000003 Interface: ath0, MAC: 46:25:34:15:5f:66
6 2020 April-10 11:31:59 web login successful
I just tried enabling security on my AP and adding the password to the connect script and still no luck. It still spits out the same error.