Can't configure softap if authmode is set

yorknh
Posts: 3
Joined: Wed Feb 18, 2015 5:18 am

Can't configure softap if authmode is set

Postby yorknh » Sat Apr 18, 2015 3:30 am

I have tried looking at several examples of configuring the part to run in softap mode but I can't seem to get it to work if I set the authmode field of the softap_config struct.
In the function below, if I comment out apconfig.authmode = AUTH_WPA_WPA2_PSK, wifi_softap_setconfig() succeeds, and I can connect to the esp. If I uncomment that line, I see "ESP8266 not set softap config!" printed on the UART and no network is available.

Code: Select all

void ICACHE_FLASH_ATTR setup_wifi_softap_mode(void)
{
   struct softap_config apconfig;

   if(wifi_softap_get_config(&apconfig))
   {
//      wifi_softap_dhcps_stop();
      os_memset(apconfig.ssid, 0, sizeof(apconfig.ssid));
      os_memset(apconfig.password, 0, sizeof(apconfig.password));
      os_sprintf(apconfig.ssid, "%s", "john");
      os_sprintf(apconfig.password, "%s", "1234");
      apconfig.authmode = AUTH_WPA_WPA2_PSK;
      apconfig.ssid_len = 0;
      apconfig.max_connection = 4;
      if(!wifi_softap_set_config(&apconfig))
      {
         #ifdef PLATFORM_DEBUG
         ets_uart_printf("ESP8266 not set softap config!\n");
         #endif
      }
      wifi_set_opmode(SOFTAP_MODE);
//      wifi_softap_dhcps_start();
   }

   if(wifi_get_phy_mode() != PHY_MODE_11N)
      wifi_set_phy_mode(PHY_MODE_11N);

   #ifdef PLATFORM_DEBUG
   ets_uart_printf("ESP8266 in SoftAP mode configured.\n");
   #endif
}


I have tried AUTH_WPA_PSK, AUTH_WPA2_PSK, AUTH_WPA_WPA2_PSK and all behave the same. Anyone see anything obvious?

Anki
Posts: 25
Joined: Thu Apr 09, 2015 3:00 am

Re: Can't configure softap if authmode is set

Postby Anki » Sat Apr 18, 2015 6:33 am

Your password is too short. WPA passwords must be at least 8 characters long.

yorknh
Posts: 3
Joined: Wed Feb 18, 2015 5:18 am

Re: Can't configure softap if authmode is set

Postby yorknh » Mon Apr 20, 2015 8:19 pm

Thanks! That was the problem.

Who is online

Users browsing this forum: No registered users and 40 guests