I am running a fairly vanilla setup where I try to connect to my home router (SilverShark). A lot of the time, I will get a valid IP address very quickly. However, sometimes I don't. I had the following console dump on one of these occasions. It looks like everything is fine. The wifi module said it connected, but no IP.
I (346) wifi: wifi firmware version: 407bb27
I (348) wifi: config NVS flash: enabled
I (351) wifi: config nano formating: disabled
I (361) wifi: Init dynamic tx buffer num: 32
I (361) wifi: Init dynamic rx buffer num: 32
I (361) wifi: wifi driver task: 3ffc3dfc, prio:23, stack:4096
I (363) wifi: Init static rx buffer num: 10
I (367) wifi: Init dynamic rx buffer num: 32
I (371) wifi: Init rx ampdu len mblock:7
I (375) wifi: Init lldesc rx ampdu entry mblock:4
I (379) wifi: wifi power manager task: 0x3ffc937c prio: 21 stack: 2560
I (489) wifi: wifi timer task: 3ffca474, prio:22, stack:3584
I (517) wifi: mode : sta (30:ae:a4:80:76:9c)
I (639) wifi: n:1 0, o:1 0, ap:255 255, sta:1 0, prof:1
I (1297) wifi: state: init -> auth (b0)
I (1302) wifi: state: auth -> assoc (0)
I (1314) wifi: state: assoc -> run (10)
I (1533) wifi: connected with SilverShark, channel 1
I (11315) wifi: pm start, type:0
The log looks exactly the same (minus the last line) when I get an IP. When I do get an IP, it is very quickly after the "connected with SilverShark" line.
Any help on this would be great:
1. Any clues as to why this is intermittently working/not working?
2. I have tried tcpip_adapter_down, then tcpip_adapter_up functions after a reasonable timeout. No luck. I've similarly tried an esp_wifi_stop() / then calling esp_wifi_set_mode, esp_wifi_setconfig, esp_wifi_start, esp_wifi_connect. That didn't help either. Is there any way to force a re-start after a timeout? With some stacks, shutting down an interface and restarting it - kicking off DHCP again - works to get things unhung.
Rob
Can't get IP (intermittent)
Re: Can't get IP (intermittent)
Rob,
As a test, can you try connecting to another access point? When forming a WiFi network connection, it is a game of two halves. Your ESP32 is one half and the access point is another. Most access points are actually small computers themselves and maybe have logs and diagnostics. If you are failing to either connect or get an IP allocated, maybe check the access point logs to see if it is failing or at least generating other diagnostics.
As a test, can you try connecting to another access point? When forming a WiFi network connection, it is a game of two halves. Your ESP32 is one half and the access point is another. Most access points are actually small computers themselves and maybe have logs and diagnostics. If you are failing to either connect or get an IP allocated, maybe check the access point logs to see if it is failing or at least generating other diagnostics.
Free book on ESP32 available here: https://leanpub.com/kolban-ESP32
Re: Can't get IP (intermittent)
Kolban,
Things did work fine on another network. On the original network on a different computer, I received a "multiple computers having the same IP address" message. I cleaned out some of the DHCP entries on my router, then it worked fine. Thanks for the help!
Things did work fine on another network. On the original network on a different computer, I received a "multiple computers having the same IP address" message. I cleaned out some of the DHCP entries on my router, then it worked fine. Thanks for the help!
Re: Can't get IP (intermittent)
Note for future finders of this topic:
I was also facing a very similar problem, where one of my units was not getting the GOT_IP event after connecting to wifi. After some investigation we found out our DHCP server in my company was working erratically, not giving IP to some specific MAC addresses, but working ok with the vast majority. No idea why. We have Windows Server 2012, we removed the option of DHCP redundancy and restarted the service and everything seems to be working OK again.
Conclusion: if you are not getting IP event, DHCP in the wifi network may be the cause.
I was also facing a very similar problem, where one of my units was not getting the GOT_IP event after connecting to wifi. After some investigation we found out our DHCP server in my company was working erratically, not giving IP to some specific MAC addresses, but working ok with the vast majority. No idea why. We have Windows Server 2012, we removed the option of DHCP redundancy and restarted the service and everything seems to be working OK again.
Conclusion: if you are not getting IP event, DHCP in the wifi network may be the cause.
Who is online
Users browsing this forum: Bing [Bot] and 96 guests