I’ve got dozens of boards based on different ESP chips out there and so don’t consider myself a newbie but this is really got me stymied. Yesterday morning they came to replace an older Arris router/modem that was randomly restarting all the time and knocking us off wifi. As he left I went back to working on the ESP device I was working on and I couldn’t get it to connect. It feels like it’s not really on the right subnet, the symptoms are very strange.
If I run even the simplest example code to get an address via DHCP it will hang there printing periods for several minutes and then finally claim to be connected but with a self assigned IP address in the 169.254.x.x. If I manually assign it an IP address then it connects to the wifi apparently normally and thinks it’s assigned itself that IP address but it can not send or receive any TCP traffic. It can however send UDP packets and UDP broadcast packets. It cannot receive a UDP packet directly addressed to it, but it can receive a UDP broadcast packet.
The router sees it on the wifi network and can even tell me it’s RSSI via it’s connected device page. So it’s not a matter of a different authentication for the wifi layer itself or anything like that. That part seems to be working. But something is different about routing traffic to it.
I also tried a brand new ESP-12e that had never been on the old network and the behavior is exactly the same so it’s not something weird stuck in the flash of the first one I was using. Even so I did an upload with erase all flash turned on as well as trying it with just erasing the program and saved wifi data to no avail.
I’ve searched the internet and turned off everything on the router itself that I could see that might have anything to do with it. Even going so far as to disable their built in firewall completely and turning off “WMM” as there were posts elsewhere that suggested that caused problems for some people in the past. It made no difference here though. I’ve tried forcing it to just 20mhz channels instead of it’s 20/40 default. I even changed the DHCP timeout from the default of 1 hour to 1 day which is what the old one was in case it didn’t like that setting for some reason.
The ESP shows up in the connected devices list via it’s Mac address, but it does not see that it has an IP address even though it does show the IP address of other devices I have connected with static IP’s outside the DHCP range. I’m going to have to put this whole modem into bridge mode and go get another wifi router that I know will work!
It’s very alarming to me that everything all of us have based on the wonderful ESP chips can be completely broken by just having your router replaced in such a way that no configuration or other advice can help. Any suggestions for other things I should try or any similar experiences would be greatly appreciated. It’s not just that I can’t work on them here right now, the greatest problem is that this could happen to any of them I’ve setup for anyone or any of the rest of you have built into products or projects!
I rebuilt with debug output for wifi turned on and got the following output, I can’t quite see if anything is obviously wrong there. The wifi portion seems to connect OK but nothing but UDP broadcasts work after that:
SDK:3.0.0-dev(c0f7b44)/Core:2.5.0=20500000/lwIP:STABLE-2_1_2_RELEASE/glue:1.1/BearSSL:6778687
wifi evt: 7
bcn 0
del if1
usl
mode : sta(5c:cf:7f:1b:f0:16)
add if0
del if0
usl
mode : null
mode : sta(5c:cf:7f:1b:f0:16)
add if0
// this is a debug line from my code, prior to calling WiFi.begin and WiFi.configure
looking for wifi (xxxxx) pass:(xxxxx) setting static ip=192.168.0.189 router=192.168.0.1 subnet=255.255.255.0
wifi evt: 8
wifi evt: 8
wifi evt: 8
...............wifi evt: 2
.............scandone // I think the term "scandone" comes from another debug line from my code that just outputs any changes to the WiFi.status() while waiting to be connected
state: 0 -> 2 (b0)
.state: 2 -> 3 (0)
state: 3 -> 5 (10)
add 0
aid 1
cnt
connected with xxxxx, channel 11 // channel 11 is the channel the router says it's running on
ip:192.168.0.189,mask:255.255.255.0,gw:192.168.0.1
ip:192.168.0.189,mask:255.255.255.0,gw:192.168.0.1
wifi evt: 0
wifi evt: 3
.
wifi connected!
localip=192.168.0.189