Setting up AP mode with sdk v1.1.2

paritosharya007
Posts: 10
Joined: Sat May 23, 2015 1:24 pm

Setting up AP mode with sdk v1.1.2

Postby paritosharya007 » Wed Jun 17, 2015 6:15 pm

Hi,

I am trying to setup my ESP in SOFTAP mode and setting its SSID and password and also starting dhcp server. The code starts the ESP in SOFTAP mode and broadcasts its SSID, but when I try to connect to it, it does not connect to ESP. Am I missing something? Any pointers or fix to my code to make it working, so my phone can connect to the ESP in AP mode will be much appreciated.

Code: Select all

void ICACHE_FLASH_ATTR
user_single_led_init(void)
{
   
   struct softap_config config;
   char ssid[32] = "MyESPinC";
   char password[33] = "AppleMBA";
   char macaddr[6];

   wifi_softap_get_config(&config);
   wifi_get_macaddr(SOFTAP_IF, macaddr);

   os_memset(config.ssid, 0, 32);
   os_memcpy(config.ssid, ssid, 32);
   os_memset(config.password, 0, sizeof(config.password));
   os_memcpy(config.password, password, os_strlen(password));
   config.authmode = AUTH_WPA_WPA2_PSK;

   wifi_softap_set_config(&config);

   wifi_set_opmode(STATIONAP_MODE);

   wifi_softap_dhcps_start();
}

ESP_Faye
Posts: 1646
Joined: Mon Oct 27, 2014 11:08 am

Re: Setting up AP mode with sdk v1.1.2

Postby ESP_Faye » Thu Jun 18, 2015 11:35 am

Hi,

Thanks for your interest in ESP8266 !

Please refer to softAP configuration demo here http://bbs.espressif.com/viewtopic.php?f=21&t=227&p=834

Notice:

Code: Select all

wifi_softap_get_config(&softap_config); // Get config first

is recommended to be called first.
Or you have to set value for every parameter in softap_config, for example, softap_config.beacon_interval and softap_config.ssid_len, otherwise they will be random value which may make ESP8266 softAP hardly to be connected.

Who is online

Users browsing this forum: No registered users and 104 guests