Skip to content

Windows 10 PC can't access AP Mode. #2910

Closed
@GeorgeFlorian

Description

@GeorgeFlorian

Board: ESP32 DevKit V4 with Wrover-B
OS: Windows 10
platform = https://github.com/platformio/platform-espressif32.git

I'm having a peculiar issue here. I can't access the WebServer when I am connected to the ESP32 AP Mode using Windows 10. But I can access the WebServer when I am connected to the AP using my Galaxy Note 9.

#and

After the PC fails to access the WebServer , when trying to connect with the phone to the AP it doesn't work. It seems like I am limited to one connection to the AP. It just doesn't work. No debug message, no nothing. Not even the phone returns an error. Which is rather strange I'd say...

This is how I set up AP Mode.

//------------------------- logOutput(String)
void logOutput(String string1) {
	circle.push(string1);	
	Serial.println(string1);	
}

logOutput((String)"Starting AP ... ");
  logOutput(WiFi.softAP(ssidAP, passwordAP) ? "Ready" : "WiFi.softAP failed ! (Password must be at least 8 characters long )");
  delay(500);
  logOutput((String)"Setting AP configuration ... ");
  logOutput(WiFi.softAPConfig(local_IP_AP, local_IP_AP, subnetAP) ? "Ready" : "Failed!");
  delay(500);
  logOutput((String)"Soft-AP IP address: ");
  logOutput(WiFi.softAPIP().toString());

Nothing strange until now.
This is the -DCORE_DEBUG_LEVEL=5 aka Verbose :

[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 15 - AP_STACONNECTED
dhcps: send_offer>>udp_sendto result 0
[D][WiFiGeneric.cpp:336] _eventCallback(): Event: 17 - AP_STAIPASSIGNED

See the dhcps: send_offer>>udp_sendto result 0 ?
I don't get that when I use the phone first and try to access the AP.

And that is all. No other verbose message.

EDIT: I have tried with another Windows 10 Laptop PC and it still does not work.

Activity

Nathan-ma

Nathan-ma commented on Jun 21, 2019

@Nathan-ma

Same here, Ap mode seems to be broken!!

dhcps: send_nak>>udp_sendto result 0

Ap mode seems to broken, I already tried normal webserver and AsyncWebServer, both are not working properly, they just stop working from about 90 seconds after you connect with AP.

I can connect with my phone no problem, but after 90 seconds, AP just breaks and I have to disconnect and reconnect the WiFI.

GeorgeFlorian

GeorgeFlorian commented on Jun 21, 2019

@GeorgeFlorian
Author

That's just great !
Is there any other way to start/use AP ?

EDIT: I have tried with another Windows 10 Laptop PC and it still does not work.

atanisoft

atanisoft commented on Jun 21, 2019

@atanisoft
Collaborator

Could this be related to #2899?

Nathan-ma

Nathan-ma commented on Jun 21, 2019

@Nathan-ma

@atanisoft , well I did the test with heap memory and I can confirm the free heap memory size drops when the problem starts like mentioned on the issue you commented!

So Yes I do believe its related...

So the solution might be just change the sdkconfigs on esp-idf , build and replace the libesp32.a to make it work?

atanisoft

atanisoft commented on Jun 21, 2019

@atanisoft
Collaborator

@DarvosBR yes, that should work to test. I suspect there may be a few other LwIP settings which would be useful to adjust slightly to increase stability in the arduino-esp32 builds.

GeorgeFlorian

GeorgeFlorian commented on Jun 21, 2019

@GeorgeFlorian
Author

Could this be related to #2899?

Probably.

So you are saying that this should be a work-around:

Actually, you don't need to re-compile the arduino-esp32 core to change the buffer values.

All you need to do is:

  • Edit \tools\sdk\include\config\sdkconfig.h and adjust the values to match sdkconfig.default from the iperf example folder.
  • Force a full rebuild when compiling your project (not sure how to do this directly from the UI, but changing the flash frequency or upload speed is usually enough to force it).

This applies to the arduino environment. I have no experience with PiO, so can't help you there.

You should see a 13-14kB drop in free heap (as compared to arduino-esp32 defaults). If you don't see this drop, then the changes are not active, and you need to check what you did wrong

On a side note: The buffer values from the iperf config are rather extreme, so later you should probably have a go at it and adjust them to best match your specific application needs.

Also, I've seen you mentioning a possible solution to the AsyncTCP freeze. That would be something extraordinary indeed.

atanisoft

atanisoft commented on Jun 21, 2019

@atanisoft
Collaborator

@GeorgeFlorian I haven't tested the proposed rebuild but I don't think the steps outlined above will work since this is all pre-compiled into libesp32.a. The only solution I know of is to setup an esp-idf build (cmake or similar) with the arduino-esp32 sdkconfig, build and copy the libs over to the tools/sdk tree where they are today.

I'm not certain it will fix the async code but there may be a small chance that they are related.

GeorgeFlorian

GeorgeFlorian commented on Jun 21, 2019

@GeorgeFlorian
Author

@GeorgeFlorian I haven't tested the proposed rebuild but I don't think the steps outlined above will work since this is all pre-compiled into libesp32.a. The only solution I know of is to setup an esp-idf build (cmake or similar) with the arduino-esp32 sdkconfig, build and copy the libs over to the tools/sdk tree where they are today.

I'm not certain it will fix the async code but there may be a small chance that they are related.

That sounds like nothing I have done. I've never used esp-idf and it sounds tricky to use.

As I am now, my best bet is to wait for a stable arduino-core 1.03 in which hopefully somebody will fix have fixed this issue.

Nathan-ma

Nathan-ma commented on Jun 21, 2019

@Nathan-ma

@GeorgeFlorin Don't worry, I'm gonna try both solutions and have a return for you, independent of which solution works (if any do), I will tell you how and event provide file if needed!

I got your back George!

r1dd1ck

r1dd1ck commented on Jun 21, 2019

@r1dd1ck

@atanisoft

I haven't tested the proposed rebuild but I don't think the steps outlined above will work

so you have nothing to back your opinion up with, but you "think" it's garbage.. OK 😁

I can only say that it worked for me - fixing the stack freeze issue #2899 (with empirical evidence to back that up).

Those buffer parameters are not a fixed part of the pre-compiled core. You can easily check it by increasing the static buffer values and watch your free heap drop as a result.

And to also say something on-topic of #2910 - I don't see how it could be directly related, but who knows.

Easy enough to try, right? 😜

atanisoft

atanisoft commented on Jun 21, 2019

@atanisoft
Collaborator

so you have nothing to back your opinion up with, but you "think" it's garbage.. OK

Just experience from how the build process works in the environments I've used. Anything that is part of IDF is precompiled before any of the arduino-esp32 stack is compiled. Changes to sdkconfig (or sdkconfig.h) will usually require a recompilation of the IDF pieces for the changes to take effect. This is not an issue if you are using arduino as an IDF component though.

Those buffer parameters are not a fixed part of the pre-compiled core. You can easily check it by increasing the static buffer values and watch your free heap drop as a result.

How is this possible, these are used only on the IDF side and IDF code is not recompiled inside Arduino IDE or in PIO when using the arduino framework option.

GeorgeFlorian

GeorgeFlorian commented on Jun 21, 2019

@GeorgeFlorian
Author

@GeorgeFlorin Don't worry, I'm gonna try both solutions and have a return for you, independent of which solution works (if any do), I will tell you how and event provide file if needed!

I got your back George!

That is great to hear, man ! Thank you @DarvosBR !

But I don't think that #2899 is related. You and me both experience issues when trying to connect to the ESP while it's in AP Mode and that is all. We aren't sending large enough UDP Packets, if we send any at all, so that the Network Stack should crash.

Also, my ESP can stay in AP Mode indefinitely if I made a stable connection or no connection at all. I can connect and disconnect using my phone all day long and it will still work. It will "block" connections only when a failed connection happens. So if I try to connect using my PC and it doesn't work, this will make the ESP not able to accept further connection. The strange thing is that the PC says that it is connected to the respective AP Network, but the server is inaccessible.

r1dd1ck

r1dd1ck commented on Jun 21, 2019

@r1dd1ck

@atanisoft

How is this possible, these are used only on the IDF side and IDF code is not recompiled inside Arduino IDE or in PIO when using the arduino framework option.

🙄
Too many words, too little effort to find out yourself..

@GeorgeFlorian

The strange thing is that the PC says that it is connected to the respective AP Network, but the server is inaccessible.

Have you checked whether the DHCP gives you a correct IP address/subnet etc. when that happens?

Nathan-ma

Nathan-ma commented on Jun 21, 2019

@Nathan-ma

@r1dd1ck unfortunately the sdkconfig.h solution did not work. I'm gonna try the esp-idf, but I do agree this method should work.

@GeorgeFlorian The whole code works just fine when I access the board by the STA IP.
But on AP the code just freezes after a while (the board keeps working, the STA keeps working, but AP just frezzes.

atanisoft

atanisoft commented on Jun 21, 2019

@atanisoft
Collaborator

Too many words, too little effort to find out yourself..

There is no need to be rude about this. In all other cases of IDF sdkconfig it will require a recompilation of the IDF code for the config change to take effect.

This however is one case where a recompilation is not necessary ONLY because the WiFi lib is calling esp_wifi_init with a locally created wifi_init_config_t (https://github.com/lbernstone/arduino-esp32/blob/master/libraries/WiFi/src/WiFiGeneric.cpp#L114) which the WIFI_INIT_CONFIG_DEFAULT expands to use the sdkconfig.h entries (https://github.com/espressif/esp-idf/blob/e7f85f1987aa9479c2dbab638ca83bcaef99be00/components/esp_wifi/include/esp_wifi.h#L193-L213). This is not typically the case.

@GeorgeFlorian give it a shot and see if it fixes it, if it does then #2912 should fix your issues when it has been merged and included in the next release.

27 remaining items

Loading
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Status: StaleIssue is stale stage (outdated/stuck)

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions

      Windows 10 PC can't access AP Mode. · Issue #2910 · espressif/arduino-esp32