ESP32 connects to Access Point but can't get IP address

User avatar
rayf15
Posts: 16
Joined: Fri Aug 23, 2019 6:52 am

ESP32 connects to Access Point but can't get IP address

Postby rayf15 » Fri Oct 25, 2019 8:54 pm

Hello ESP32 forum,
I'm developing an application using esp-idf_v3.1.1. ESP32 is configured in WIFI_MODE_APSTA mode, working at the same time as access point that accepts connections from WiFi clients and as station.
The system usually works as expected with most access points... but... there are a few access points that don't give IP address to ESP32 client.
In practice, looking at wifi stack logs we can verify that client side of ESP32 connects to this access point but there is no further step, i.e. the STA interface of ESP32 is formally connected to AP but can't do nothing anymore (IP address is missing). To be noted that this AP surely has IPV4 DHCP server running; AP authentication is WPA2-PSK-CCMP.
Technically speaking, we get SYSTEM_EVENT_STA_CONNECTED event but futher SYSTEM_EVENT_STA_GOT_IP event is never called.

Below there is some log lines produced by wifi stack:

...
I (6791) wifi: n:11 0, o:11 0, ap:11 0, sta:11 0, prof:11
I (6791) wifi: state: init -> auth (b0)
I (6796) wifi: state: auth -> assoc (0)
I (6797) wifi: state: assoc -> run (10)
I (6800) wifi: connected with M*****l, channel 11
I (6801) wifi: pm start, type: 0
...

I compared these lines with the log messages obtained when ESP32, trying to connect to another AP, can get IP address. The steps are exactly the same, but in the latter case we have the SYSTEM_EVENT_STA_GOT_IP event.

Any suggestion that could explain this weird behavior?

Thank you for your help!!!

rayf15

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 connects to Access Point but can't get IP address

Postby Ritesh » Sun Oct 27, 2019 11:54 am

rayf15 wrote:
Fri Oct 25, 2019 8:54 pm
Hello ESP32 forum,
I'm developing an application using esp-idf_v3.1.1. ESP32 is configured in WIFI_MODE_APSTA mode, working at the same time as access point that accepts connections from WiFi clients and as station.
The system usually works as expected with most access points... but... there are a few access points that don't give IP address to ESP32 client.
In practice, looking at wifi stack logs we can verify that client side of ESP32 connects to this access point but there is no further step, i.e. the STA interface of ESP32 is formally connected to AP but can't do nothing anymore (IP address is missing). To be noted that this AP surely has IPV4 DHCP server running; AP authentication is WPA2-PSK-CCMP.
Technically speaking, we get SYSTEM_EVENT_STA_CONNECTED event but futher SYSTEM_EVENT_STA_GOT_IP event is never called.

Below there is some log lines produced by wifi stack:

...
I (6791) wifi: n:11 0, o:11 0, ap:11 0, sta:11 0, prof:11
I (6791) wifi: state: init -> auth (b0)
I (6796) wifi: state: auth -> assoc (0)
I (6797) wifi: state: assoc -> run (10)
I (6800) wifi: connected with M*****l, channel 11
I (6801) wifi: pm start, type: 0
...

I compared these lines with the log messages obtained when ESP32, trying to connect to another AP, can get IP address. The steps are exactly the same, but in the latter case we have the SYSTEM_EVENT_STA_GOT_IP event.

Any suggestion that could explain this weird behavior?

Thank you for your help!!!

rayf15
Hello,

Did you try same router with your mobile in which are you getting IP address in which you are not getting IP with ESP32?

So that you can have idea to move further for this issue.
Regards,
Ritesh Prajapati

User avatar
rayf15
Posts: 16
Joined: Fri Aug 23, 2019 6:52 am

Re: ESP32 connects to Access Point but can't get IP address

Postby rayf15 » Sun Oct 27, 2019 2:41 pm

Hello,
Yes, sure, I tried with both a mobile phone and a laptop without any trouble...
I got maximum log verbosity from wifi stack but no help. Are there known issues regarding wifi chipsets incompatibile with ESP32?

rayf15

WiFive
Posts: 3529
Joined: Tue Dec 01, 2015 7:35 am

Re: ESP32 connects to Access Point but can't get IP address

Postby WiFive » Sun Oct 27, 2019 10:54 pm

Try enabling dhcp debugging in lwip header files. Also consider trying newer versions of esp-idf.

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 connects to Access Point but can't get IP address

Postby Ritesh » Wed Oct 30, 2019 4:28 am

WiFive wrote:
Sun Oct 27, 2019 10:54 pm
Try enabling dhcp debugging in lwip header files. Also consider trying newer versions of esp-idf.
Yeah. That will be also helpful to find out exact issue.
Regards,
Ritesh Prajapati

User avatar
rayf15
Posts: 16
Joined: Fri Aug 23, 2019 6:52 am

Re: ESP32 connects to Access Point but can't get IP address

Postby rayf15 » Mon Nov 04, 2019 11:17 pm

Thank you WiFive and Ritesh for your precious hints...
Finally I could try to debug ESP32 DHCP client behavior and discovered that there was a problem with last ARP check during DHCP sequence... This seem to be a known issue with "enterprise" access points, like Cisco Aironet Enterprise AP. Therefore I disabled the lwIP option CONFIG_LWIP_DHCP_DOES_ARP_CHECK and at last my ESP32 could get and use the IP address received from DHCP server.


rayf15

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 connects to Access Point but can't get IP address

Postby Ritesh » Wed Nov 06, 2019 1:30 pm

rayf15 wrote:
Mon Nov 04, 2019 11:17 pm
Thank you WiFive and Ritesh for your precious hints...
Finally I could try to debug ESP32 DHCP client behavior and discovered that there was a problem with last ARP check during DHCP sequence... This seem to be a known issue with "enterprise" access points, like Cisco Aironet Enterprise AP. Therefore I disabled the lwIP option CONFIG_LWIP_DHCP_DOES_ARP_CHECK and at last my ESP32 could get and use the IP address received from DHCP server.


rayf15
Great. Thanks for update regarding same. Let us know if any issue into later stage.
Regards,
Ritesh Prajapati

Kunjan
Posts: 11
Joined: Tue May 25, 2021 4:41 pm

Re: ESP32 connects to Access Point but can't get IP address

Postby Kunjan » Tue May 25, 2021 4:55 pm

I am also facing the same issue. I can not find "CONFIG_LWIP_DHCP_DOES_ARP_CHECK " option in menuconfig as "rayf15" suggested. I am trying smartConfig Example with "WIFI_MODE_APSTA " Mode. I am able to provision ESP successfully and I can see ssid in mobile wifi list screen. but when I click on it then it showing "obtaining IP address...". can someone help me? Thanks
Attachments
wifi_issue.jpeg
wifi_issue.jpeg (24.6 KiB) Viewed 22830 times

Ritesh
Posts: 1365
Joined: Tue Sep 06, 2016 9:37 am
Location: India
Contact:

Re: ESP32 connects to Access Point but can't get IP address

Postby Ritesh » Thu Jul 08, 2021 7:54 pm

Kunjan wrote:
Tue May 25, 2021 4:55 pm
I am also facing the same issue. I can not find "CONFIG_LWIP_DHCP_DOES_ARP_CHECK " option in menuconfig as "rayf15" suggested. I am trying smartConfig Example with "WIFI_MODE_APSTA " Mode. I am able to provision ESP successfully and I can see ssid in mobile wifi list screen. but when I click on it then it showing "obtaining IP address...". can someone help me? Thanks
Is your issue has been resolved or still ongoing?
Regards,
Ritesh Prajapati

azizjiwani
Posts: 1
Joined: Thu Sep 22, 2022 4:09 am

Re: ESP32 connects to Access Point but can't get IP address

Postby azizjiwani » Thu Sep 22, 2022 4:23 am

Hi, we are also facing the same issue but for us some of the devices are getting IP and some aren't.

- In the router - MAC id whitelisting is done correctly, we have checked free ips are available.
- Enabled DHCP logs, discover request is being sent from the devices but not all of them is receiving response from DHCP server (router)
dhcp logs.jpg
dhcp logs.jpg (371.96 KiB) Viewed 17907 times
CONFIG_LWIP_DHCP_DOES_ARP_CHECK isn't enabled. Any ideas on how to resolve this.

Thanks in advance for your help.
Aziz

Who is online

Users browsing this forum: No registered users and 142 guests