WiFi.softAP different behavior... Password not accepted.

DeivisSajermann
Posts: 4
Joined: Fri Dec 18, 2020 8:52 am

WiFi.softAP different behavior... Password not accepted.

Postby DeivisSajermann » Fri Dec 18, 2020 9:33 am

Hello guys, I am new here in the forum... (Not new, I always search here, but now I need kind of a help).
I developed a product (IoT Device, with ESP-WROOM-32) and it is working fine ! The software in the ESP32 works very well. I use the Microsoft Azure platform to collect the data and connect my devices (As well to give back the data to my customers).
All the development of the OS to my boards, were made in the Arduino IDE (I started the business using ATMEGA processors and ESP8266, but now our products received an upgrade to ESP32, and I am very happy with it :D ).

I am having an Issue, with the WiFi.softAP, and I do not know what can be the problem. :roll:

When I finish the production of the PCB with the processor, I make the download of the OS in the device (directly using the bin file, as I do not need to modify it) and I make a test run before send it out to customers.
So, the product out of the box, is in WebServer mode, so the customers can configure the device to work properly in their WiFi network, so they need to connect via a SSID and Password to my device and perform the configuration.
The problem is that round about 10% of the ESP32 processors I face the same problem: In softAP (WebServer), when I try to connect using my standard password, the answer is that the password is incorrect and I cannot connect. For 90% of the processors I have no problem, they accept the password, they connect and work perfectly. Those with problems, if I set no password to connect, they also works without problem, but due to Safety request from my customers it must be Password protected. (OK the problematic ones, are still with me, because they work and I hope to find a solution).

I assembled 230 devices last month, and 19 of them presented this problem described. So I am not sure if this is a hardware problem (perhaps my soldering team are doing something wrong), quality problem from the Processor, or something I can improve in the software.

The part of the software that manage the softAP part is here:
  1. #define selfssid "MYSSID.LOCAL" //SSID WEB SERVER
  2. #define selfpassword "TheBestSecret2020"  //PASSWORD WEBSERVER
  3.  
  4.  
  5. #include <WiFi.h>
  6. #include <WebServer.h>
  7. #define WIFI_EVENT_STA_CONNECTED      SYSTEM_EVENT_STA_CONNECTED
  8. #define WIFI_EVENT_STA_DISCONNECTED   SYSTEM_EVENT_STA_DISCONNECTED
  9. #define WIFI_EVENT_AP_STACONNECTED    SYSTEM_EVENT_AP_STACONNECTED
  10. #define WIFI_EVENT_AP_STADISCONNECTED SYSTEM_EVENT_AP_STADISCONNECTED
  11. #define WIFI_EVENT_ALL                SYSTEM_EVENT_MAX
  12.  
  13.  
  14.  
  15.  
  16. //############################ Global Variables #################################
  17.  
  18. /* Standard IP During programming WEB Server Mode */
  19. IPAddress local_ip(192, 168, 4, 1);
  20. IPAddress gateway(192, 168, 1, 1);
  21. IPAddress subnet(255, 255, 255, 0);
  22.  
  23.  
  24.  
  25. //Setup Web Server mode (Config Mode).
  26.  
  27. void setupWEBServer() {
  28.   if (WiFi.getMode()!=3){ //In case wifi is not in mode softAP, forces it to disconnect.
  29.   WiFi.disconnect(true);
  30.   FinishAPConnection(); //Subroutine to disconnect all active connections if existent ones...
  31.   delay (3000);}
  32.   Serial.println("SETUP WEB SERVER !!!!!");
  33.   // Prepare HTML page
  34.   SetupWebServerPages(); //Call routine to prepare the HTML pages at WebServer mode.
  35.  
  36.   // Start WiFi soft AP.
  37.   WiFi.mode(WIFI_AP); //Set mode of the Wifi
  38.   WiFi.softAP(selfssid, selfpassword);
  39.   WiFi.softAPConfig(local_ip, gateway, subnet);
  40.   delay(800);
  41.  
  42. //Other stuff, etc...
So, perhaps I am doing something wrong, or can be improved... (I do not know, specially because the problem affects a small amount of devices... something weird)

Thank a lot.
DeivisSajermann
Last edited by DeivisSajermann on Fri Dec 18, 2020 8:04 pm, edited 1 time in total.

felmue
Posts: 70
Joined: Mon Nov 16, 2020 2:55 pm

Re: WiFi.softAP different behavior... Password not accepted.

Postby felmue » Fri Dec 18, 2020 4:51 pm

Hello DeivisSajermann

any particular reason you're setting the WiFi mode to station just before setting up the soft AP?

Code: Select all

WiFi.mode(WIFI_STA); //Set mode of the Wifi
WiFi.softAP(selfssid, selfpassword);
I have no idea if that is the issue, but I would have expected WIFI_AP mode instead.

Thanks
Felix

DeivisSajermann
Posts: 4
Joined: Fri Dec 18, 2020 8:52 am

Re: WiFi.softAP different behavior... Password not accepted.

Postby DeivisSajermann » Fri Dec 18, 2020 8:19 pm

Hi Felix, thank a lot for the reply.
Yes, you are completelly right, the correct is "WIFI_AP". I corrected the post.
(It was my mistake in copying and removing part of the code, I let the part when it goes to normal operation).
I was checking the Datasheet as well, and looking for some "Signals" that lock, or enable this feature, but I didn´t find aanything. (SO I do not think that is "Hardware" problem.
Also I tried to download this little part of the programm and the problem still occurs. (So, no one extra function, only the mode AP).
I have a development board that I can connect the ESP32-WROOM directly and program it... So the next processors I will also test before assembly and final soldering all the components... (So at least I can keep those processors for other model of device that I do not need WiFi.softAP ;)

DeivisSajermann

DeivisSajermann
Posts: 4
Joined: Fri Dec 18, 2020 8:52 am

Re: WiFi.softAP different behavior... Password not accepted.

Postby DeivisSajermann » Tue Dec 22, 2020 8:54 am

Hello Colleagues,

I managed to solve this problem. (Actually, I do not know the root cause, but I guess, the microcontroller needs some "time" in between the changing modes of the WiFi :idea: ).
I added some delays and now works perfectly. :D
  1.  
  2. WiFi.mode(WIFI_AP); //Set mode of the Wifi
  3. delay(250); // <-------Included
  4.   WiFi.softAP(selfssid, selfpassword);
  5. delay(250); // <-------Included
  6.   WiFi.softAPConfig(local_ip, gateway, subnet);
Now, even the microprocessors that were not working, accept the code and my standard password (Connecting using PC or a cellphone).

veniceinventors
Posts: 2
Joined: Tue Sep 24, 2024 10:17 am

Re: WiFi.softAP different behavior... Password not accepted.

Postby veniceinventors » Tue Sep 24, 2024 10:38 am

I encountered a similar issue, but the solution didn't work for me, even with the delays none of my devices could connect, both of the esp32s3 I tried would not accept the password.

The solution which worked for me was to use a longer password. The ones with 8 or 9 characters didn't work but the string "this is a long password" worked. I haven't tried to find the shortest length that still works, but it's a starting point.

On a side note, I was able to remove all the delays and even 'WIFI.mode(WIFI_AP)' and it still works.
So I reverted all the changes and went back to the stock ESP32 example 'WiFi/WiFiAccessPoint.ino' but with the long password.

Maybe the WPA2/PSK implementation in my 2.17 arduino_esp32 SDK is not fully compatible with the standard used by my phone and laptop?

Who is online

Users browsing this forum: No registered users and 30 guests