I’m back to this after useful advice from Peter. I’ve tried various different ESP32 modules including a M5Stack and my usual ESP32 Dev module. Also tried a different PC with a fresh Arduino install. Always the same issue: Every other re-boot fails to connect. My ESP8266 project works every time. I decided to analyse the pre-amble of both connections, but the 8266 WiFi setup seems very different to the '32. Even the debug settings are quite different, so comparison is next to impossible. I’m beginning to wonder if there’s a bug in the ESP32 WiFi library module - though it’s such an obvious problem, others would have seen it, surely?
I’m sure I can find a way around this, but I do like to fully understand what’s going on.
The sketch is an empty one, consisting of just basic Setup and Loop.
Here are the various debug outputs:
ESP32 Failed:
12:47:44.320 -> ets Jun 8 2016 00:22:57
12:47:44.367 ->
12:47:44.367 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:47:44.367 -> configsip: 0, SPIWP:0xee
12:47:44.367 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:47:44.367 -> mode:DIO, clock div:1
12:47:44.367 -> load:0x3fff0018,len:4
12:47:44.367 -> load:0x3fff001c,len:1216
12:47:44.367 -> ho 0 tail 12 room 4
12:47:44.367 -> load:0x40078000,len:9720
12:47:44.367 -> ho 0 tail 12 room 4
12:47:44.367 -> load:0x40080400,len:6352
12:47:44.367 -> entry 0x400806b8
12:47:44.601 -> [32] Connecting to DAVETT
12:47:44.695 -> [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 0 - WIFI_READY
12:47:44.695 -> [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 2 - STA_START
12:47:44.789 -> [D][WiFiGeneric.cpp:337] _eventCallback(): Event: 5 - STA_DISCONNECTED
12:47:44.789 -> [W][WiFiGeneric.cpp:353] _eventCallback(): Reason: 202 - AUTH_FAIL
ESP32 Success:
12:47:52.709 -> ets Jun 8 2016 00:22:57
12:47:52.709 ->
12:47:52.709 -> rst:0x1 (POWERON_RESET),boot:0x13 (SPI_FAST_FLASH_BOOT)
12:47:52.709 -> configsip: 0, SPIWP:0xee
12:47:52.709 -> clk_drv:0x00,q_drv:0x00,d_drv:0x00,cs0_drv:0x00,hd_drv:0x00,wp_drv:0x00
12:47:52.709 -> mode:DIO, clock div:1
12:47:52.709 -> load:0x3fff0018,len:4
12:47:52.709 -> load:0x3fff001c,len:1216
12:47:52.709 -> ho 0 tail 12 room 4
12:47:52.709 -> load:0x40078000,len:9720
12:47:52.709 -> ho 0 tail 12 room 4
12:47:52.709 -> load:0x40080400,len:6352
12:47:52.709 -> entry 0x400806b8
12:47:52.944 -> [32] Connecting to DAVETT
12:47:53.037 -> [D][WiFiGeneric.cpp:337] eventCallback(): Event: 0 - WIFI_READY
12:47:53.037 -> [D][WiFiGeneric.cpp:337] eventCallback(): Event: 2 - STA_START
12:47:53.225 -> [D][WiFiGeneric.cpp:337] eventCallback(): Event: 4 - STA_CONNECTED
12:47:53.271 -> [D][WiFiGeneric.cpp:337] eventCallback(): Event: 7 - STA_GOT_IP
12:47:53.271 -> [D][WiFiGeneric.cpp:381] eventCallback(): STA IP: 192.168.1.39, MASK: 255.255.255.0, GW: 192.168.1.1
12:47:53.553 -> [609] Connected to WiFi
12:47:53.553 -> [609] IP: 192.168.1.39
12:47:53.553 -> [609]
12:47:53.553 -> ___ __ __
12:47:53.553 -> / _ )/ / _____ / /
12:47:53.553 -> / _ / / // / _ / '/
12:47:53.553 -> ///_, /////_
12:47:53.553 -> /__/ v0.6.1 on ESP32
12:47:53.553 ->
12:47:53.553 -> [614] Connecting to blynk-cloud.com:80
12:47:53.600 -> [672] <[1D|00|01|00] UlmMOwmt5fGF_wxSS
12:47:53.647 -> [709] >[00|00|01|00|C8]
12:47:53.647 -> [710] Ready (ping: 37ms).
12:47:53.647 -> [710] >[14|00|01|00|08]
12:47:53.647 -> [710] >pm[00]0[00]out
12:47:53.693 -> [777] <[11|00|02|00]Fver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]ESP32[00]build[00]Feb 16 2021 15:56:49[00]
12:47:53.740 -> [811] >[00|00|02|00|C8]
12:48:03.718 -> [10780] <[06|00|03|00|00]
12:48:03.765 -> [10828] >[00|00|03|00|C8]
ESP8266 Always works:
12:48:55.994 -> scandone
12:48:55.994 -> state: 0 -> 2 (b0)
12:48:55.994 -> state: 2 -> 3 (0)
12:48:55.994 -> state: 3 -> 5 (10)
12:48:55.994 -> add 0
12:48:55.994 -> aid 4
12:48:55.994 -> cnt
12:48:56.272 ->
12:48:56.272 -> connected with DAVETT, channel 1
12:48:56.272 -> dhcp client start…
12:48:56.272 -> wifi evt: 0
12:48:58.217 -> ip:192.168.1.35,mask:255.255.255.0,gw:192.168.1.1
12:48:58.217 -> wifi evt: 3
12:48:58.639 -> [5570] Connected to WiFi
12:48:58.639 -> [5570] IP: 192.168.1.35
12:48:58.639 -> [5570]
12:48:58.639 -> ___ __ __
12:48:58.639 -> / _ )/ /_ _____ / /__
12:48:58.639 -> / _ / / // / _ / '/
12:48:58.639 -> ///_, /////_
12:48:58.639 -> /__/ v0.6.1 on NodeMCU
12:48:58.639 ->
12:48:58.639 -> [5580] Connecting to blynk-cloud.com:80
12:48:58.639 -> [hostByName] request IP for: blynk-cloud.com
12:48:58.727 -> [hostByName] Host: blynk-cloud.com IP: 139.59.206.133
12:48:58.727 -> [5670] <[1D|00|01|00] UlmMOwmt5fGF_wx
12:48:58.983 -> [5915] >[00|00|01|00|C8]
12:48:58.983 -> [5915] Ready (ping: 244ms).
12:48:58.983 -> [5915] Free RAM: 49408
12:48:58.983 -> [5915] >[14|00|01|00|08]
12:48:58.983 -> [5915] >pm[00]0[00]out
12:48:59.063 -> [5982] <[11|00|02|00]Hver[00]0.6.1[00]h-beat[00]10[00]buff-in[00]1024[00]dev[00]NodeMCU[00]build[00]Feb 16 2021 17:57:18[00]
12:48:59.063 -> [6012] >[00|00|02|00|C8]
12:49:05.959 -> pm open,type:2 0
12:49:09.000 -> [15984] <[06|00|03|00|00]
12:49:09.047 -> [16013] >[00|00|03|00|C8]