The use of the ESP8266 in the world of IoT

User avatar
By PeteW
#12724 Hello,

I'm having trouble configuring ESP8266 to work as encrypted SoftAP. I'm using following code

Code: Select allvoid user_init(void) {
   stdoutInit();
   static struct softap_config config;

   wifi_softap_get_config(&config);
   os_sprintf(config.password, "abc");
   config.authmode = AUTH_WPA_WPA2_PSK;

   os_printf("WIFI: SSID [%s]\n", config.ssid);
   os_printf("WIFI: Password [%s]\n", config.password);
   os_printf("WIFI: Mode [%d]\n", config.authmode);

   if (wifi_softap_set_config(&config)) {
      os_printf("SUCCESS: AP config set\n");
   } else {
      os_printf("WARNING: Failed to set AP config\n");
   }
}


I'm able to get SUCCESS message only when using AUTH_OPEN or AUTH_WEP.
Can you guys please give some advice what possibly is wrong.
User avatar
By PeteW
#12998 It looks like the problem is not in my piece of code.
Today I flashed the device with AT command set binary supplied with the 1.0.0 SDK and here is the result from my attempts to configure encrypted SoftAP

Code: Select allAT+CWSAP="ESP8266","abc",5,0
OK

AT+CWSAP="ESP8266","abc",5,1
ERROR

AT+CWSAP="ESP8266","abc",5,2
ERROR

AT+CWSAP="ESP8266","abc",5,3
ERROR

AT+CWSAP="ESP8266","abc",5,4
ERROR


As you can see only mode 0 is OK.

Does anyone manage to run SoftAP with encryption? Do I need to configure something else before trying to change mode to WPA?


Command description from AT Instruction Set follows:
Code: Select allSet configuration of softAP mode.
Command:
AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>

Note: This CMD is only available when softAP mode enable, and need to follow by AT+RST to make it works.
Param description:
<ssid> string, ESP8266 softAP’ SSID
<pwd> string, MAX: 64 bytes ASCII
<chl> channel id
<ecn> 0 OPEN
      2 WPA_PSK
      3 WPA2_PSK
      4 WPA_WPA2_PSK