esp8266 access point mode notes

The esp8266 is capable of running in a number of different WIFI configurations. Typically it runs in client mode, where it connects to your access point then acquires an address over DHCP. However 3 modes are supported STATION, SOFTAP or STATION+SOFTAP. These correspond to configurations of 0x1, 0x2 and 0x3 as passed to wifi_set_opmode. I’ve previous talked about station mode here.

This post contains my notes on “station+softap” mode. Which seems to be the best explored. I’ve not yet tried softap only mode. I’m also assuming SDK version v0.9.3_14_11_21 (with appropriate patches). Typically to enter station+softap mode you just call wifi_set_opmode(0x3). If you then do a scan you should see a new access point appear, my iwlist wlan0 scanning output looked like this:

Cell 12 - Address: 1A:FE:34:9C:9E:F6
          Frequency:2.412 GHz (Channel 1)
          Quality=70/70  Signal level=-16 dBm
          Encryption key:off
          Bit Rates:1 Mb/s; 2 Mb/s; 5.5 Mb/s; 11 Mb/s; 6 Mb/s
                    9 Mb/s; 12 Mb/s; 18 Mb/s
          Bit Rates:24 Mb/s; 36 Mb/s; 48 Mb/s; 54 Mb/s
          Extra: Last beacon: 6092ms ago
          IE: Unknown: 000A4553505F394339454636
          IE: Unknown: 010882848B960C121824
          IE: Unknown: 030101
          IE: Unknown: 32043048606C

As you can see the access point name is derived from the MAC address. From the symbols information it looks like it might be possible to change that. The esp8266 libs appear to contain a built in DHCP server (that’s not part of LwIP if I’ve understood correctly). On my device I received an IP address of The router IP was configured at (and the esp8266 would respond on that IP address). It also configured the following DNS servers, and Which look like junk. In particular the “192.168, 4.255” looks like it’s just some uninitialized memory which had the netmask in it. I had issue calling wifi_set_opmode(0x3) outside of user_init, after previously calling wifi_set_opmode(0x1). This should actually work in the current SDK, according to the docs, but doesn’t seem to. The esp8266 dhcp server seems to take some time to come up too. After boot, you may need to wait 30s+ to get an IP.

Aside from this, all other code remains the same between station and station+softap mode. Incoming TCP connections can be accepted as before (on both IPs I believe).

They seem to have done there best to make this SDK easy to use, at the cost of some flexibility (for example, at first glance it doesn’t appear possible to turn off the DHCP server). But seems straightforward to get things working.

This is a continuation of my notes on the esp8266 microcontroller, you can find a complete list of my esp8266 posts here