4a-Esp8266 at Instruction Set en v1.5.4 0 ESP8266
4a-Esp8266 at Instruction Set en v1.5.4 0 ESP8266
Version 1.5.4
Chapter 6 Appendix List the AT commands which will save configuration into flash.
Release Notes
Date Version Release notes
Table of Contents
1. Preambles ...................................................................................................4
1.1. User-define AT commands ......................................................................4
1.2. Download AT firmware into Flash ............................................................5
1. 4Mbit Flash ............................................................................................... 5
2. 8Mbit Flash ............................................................................................... 5
3. 16Mbit Flash, map: 512KB + 512KB ........................................................5
4. 16Mbit Flash, map: 1024KB + 1024KB ....................................................6
5. 32Mbit Flash, map: 512KB + 512KB ........................................................6
6. 32Mbit Flash, map: 1024KB + 1024KB ....................................................6
6. Appendix....................................................................................................67
7. Q&A ............................................................................................................ 68
1. Preambles
AT commands set is divided into: Basic AT commands, WiFi related AT commands, TCP / IP AT
commands.
AT Command AT+TEST=?
AT Command AT+TEST?
AT Command AT+TEST
Copy all files in folder "at" to folder "app" in ESP8266_NONOS_SDK if users need to compile AT.
Introduction of compilation can refer to documentation "2A-ESP8266__IOT_SDK_User_Manual".
1. 4Mbit Flash
With the release of ESP8266_NONOS_SDK_V1.5.0, AT_V0.51, AT firmware needs 8Mbit or larger Flash
size. Please do not use 4Mbit Flash any more.
2. 8Mbit Flash
If the Flash size is 8Mbit or larger, users can use boot mode which support upgrade AT firmware
through WiFi by command "AT+CIUPDATE". Use Espressif Flash download tool and select Flash size :
8Mbit.
blank.bin 0x7E000 Initialize Flash user parameter area, more details in Appendix.
blank.bin 0x7E000 Initialize Flash user parameter area, more details in Appendix.
blank.bin 0xFE000 Initialize Flash user parameter area, more details in Appendix.
blank.bin 0x7E000 Initialize Flash user parameter area, more details in Appendix.
blank.bin 0xFE000 Initialize Flash user parameter area, more details in Appendix.
Notes:
• Please make sure that correct BIN (/ESP8266_NONOS_SDK/bin/at) is already in the chip (ESP8266)
before the AT commands listed in this documentation can be used.
• AT has already taken priority 0 and 1 of system_os_task , so only one task of priority 2 is allowed to
set up by user.
• AT returns messages below to show status of Wi-Fi connection of ESP8266 station
‣ WiFi CONNECTED - Wi-Fi connected
‣ WiFi GOT IP - ESP8266 station got IP from AP
‣ WiFi DISCONNECT - Wi-Fi disconnected
2. Command Description
Each Command set contains four types of AT commands.
Notes:
1. Not all AT Command has four commands.
2. [] = default value, not required or may not appear
3. String values require double quotation marks, for example:
AT+CWSAP="ESP756290", "21030826", 1, 4
4. Baudrate = 115200
5. AT Commands has to be capitalized, and end with "/r/n"
3. Basic AT Commands
3.1. Overview
The ESP8266 wireless WiFi modules can be driven via the serial interface using the standard AT
commands. Here is a list of some basic AT commands that can be used.
Basic
Command Description
AT Test AT startup
3.2. Commands
1. AT – Test AT startup
The type of this command is "executed". It's used to test the setup function of your wireless WiFi
module.
AT – Test AT startup
Response OK
Parameters null
Response OK
Parameters null
OK
AT+GSLP=<time>
<time>
Response
OK
Response OK
Response OK
Example AT+UART=115200, 8, 1, 0, 3
Response OK
5: 5 bits data
6: 6 bits data
<databits>
7: 7 bits data
8: 8 bits data
0: None
<parity> 1: Odd
2: EVEN
• This configuration will also store the baudrate as the default rate in the user
parameter area in the Flash for boot up.
Notes
• Flow control needs hardware support: MTCK is UART0 CTS and MTDO is
UART0 RTS.
Example AT+UART_CUR=115200, 8, 1, 0, 3
Response OK
5: 5 bits data
6: 6 bits data
<databits>
7: 7 bits data
8: 8 bits data
0: None
<parity> 1: Odd
2: EVEN
Example AT+UART_DEF=115200, 8, 1, 0, 3
Response OK
5: 5 bits data
6: 6 bits data
<databits>
7: 7 bits data
8: 8 bits data
0: None
<parity> 1: Odd
2: EVEN
• This configuration will be stored in user parameter area in the Flash for boot up.
Notes • Flow control needs hardware support: MTCK is UART0 CTS and MTDO is
UART0 RTS.
Command AT+SLEEP?
+SLEEP : <sleep mode>
Response
OK
<sleep mode>
0 : disable sleep mode
Parameters
1 : light-sleep mode
2 : modem-sleep mode
Response OK
Example AT+RFPOWER=50
Response OK
Command AT+RFVDD?
+RFVDD:<VDD33>
Response
OK
<VDD33> power voltage of ESP8266 VDD33, unit: 1/1024 V
Parameters
TOUT pin has to be suspended to measure VDD33.
Command AT+RFVDD=<VDD33>
Response OK
Command AT+RFVDD
Response OK
"AT+RFVDD" will automatically set RF TX power according to VDD33.
Note
TOUT pin has to be suspended.
Command Description
Wi-Fi mode(sta/AP/sta+AP)
AT+CWMODE_CUR
Won’t save to Flash
Command AT+CWMODE=?
+CWMODE:( value scope of <mode>)
Response
OK
Parameters Please refer to AT command settings.
Command AT+CWMODE?
+CWMODE:<mode>
Response
OK
Command AT+CWMODE=<mode>
Response OK
<mode>
1 : station mode
Parameters
2 : softAP mode
3 : softAP + station mode
This setting will be stored in the flash system parameter area. It won’t be erased
Notes
even when the power is off and restarted.
Command AT+CWMODE_CUR?
+CWMODE_CUR:<mode>
Response
OK
<mode>
1 : station mode
Parameters
2 : softAP mode
3 : softAP + station mode
Command AT+CWMODE_CUR=<mode>
Response OK
<mode>
1 : station mode
Parameters
2 : softAP mode
3 : softAP + station mode
Notes This configuration will NOT store in Flash.
AT+CWJAP – Connect to AP
[@deprecated]. Please use AT+CWJAP_CUR or AT+CWJAP_DEF instead.
• AT+CWJAP ="abc", "0123456789"
• If SSID is "ab\, c" and password is "0123456789"\"
Example AT+CWJAP ="ab\\\, c", "0123456789\"\\"
• If several APs have the same SSID as "abc", target AP can be found by bssid:
AT+CWJAP ="abc", "0123456789", "ca:d7:19:d8:a6:44"
Command AT+CWJAP?
+CWJAP:<ssid>, <bssid>, <channel>, <rssi>
Response
OK
Parameters <ssid> string, AP’s SSID
Command AT+CWJAP=<ssid>, <pwd>[, <bssid>]
OK
or
Response +CWJAP:<error code>
FAIL
<ssid> string, AP’s SSID
<pwd> string, MAX: 64 bytes ASCII
[<bssid>] string, AP’s MAC address, for several APs may have the same SSID
<error code> only for reference, it’s not reliable
<error code> 1 connecting timeout
<error code> 2 wrong password
Parameters <error code> 3 can not found target AP
<error code> 4 connect fail
FAIL
<ssid> string, AP’s SSID
<pwd> string, MAX: 64 bytes ASCII
[<bssid>] string, AP’s MAC address, for several APs may have the same SSID
<error code> only for reference, it’s not reliable
<error code> 1 connecting timeout
<error code> 2 wrong password
Parameters <error code> 3 can not found target AP
<error code> 4 connect fail
FAIL
<ssid> string, AP’s SSID
<pwd> string, MAX: 64 bytes ASCII
[<bssid>] string, AP’s bssid(MAC address), for several APs may have the same
SSID
<error code> only for reference, it’s not reliable
<error code> 1 connecting timeout
<error code> 2 wrong password
Parameters
<error code> 3 can not found target AP
<error code> 4 connect fail
Response
OK
ERROR
<ecn>
0 OPEN
1 WEP
2 WPA_PSK
3 WPA2_PSK
4 WPA_WPA2_PSK
Parameters
<ssid> string, SSID of AP
<rssi> signal strength
<mac> string, MAC address
<freq offset> frequency offset of AP, unit: KHz. The value of <freq offset> / 2.4
to get the value as ppm
<freq calibration> calibration for frequency offset
Command AT+CWLAP
+CWLAP:<ecn>, <ssid>, <rssi>, <mac>, <ch>, <freq offset>, <freq calibration>
Response
OK
ERROR
Parameters The same as above
AT+CWDHCPS_CUR – Set the IP address allocated by ESP8266 soft-AP DHCP, not be stored in
flash
AT+CWDHCPS_CUR=1, 3, "192.168.4.10", "192.168.4.15"
Example or
AT+CWDHCPS_CUR=0 // Disable the settings and use the default IP range.
Command AT+CWDHCPS_CUR?
Response +CWDHCPS_CUR=<lease time>, <start IP>, <end IP>
<enable> 0 : Disable the settings and use the default IP range.
1: Enable setting the IP range, parameters below have to be set.
<lease time> the unit of lease time is minute, range [1, 2880]
Parameters <start IP> start IP of the IP range that can be got from ESP8266 soft-AP
DHCP server
<end IP> end IP of the IP range that can be got from ESP8266 soft-AP
DHCP server
Command AT+CWDHCPS_CUR=<enable>, <lease time>, <start IP>, <end IP>
Response OK
Parameters The same as above.
AT+CWDHCPS_DEF – Set the IP address allocated by ESP8266 soft-AP DHCP, can be stored in
flash
AT+CWDHCPS_DEF=1, 3, "192.168.4.10", "192.168.4.15"
Example or
AT+CWDHCPS_DEF=0 // Disable the settings and use the default IP range.
Command AT+CWDHCPS_DEF?
Response +CWDHCPS_DEF=<lease time>, <start IP>, <end IP>
<enable> 0 : Disable the settings and use the default IP range.
1: Enable setting the IP range, parameters below have to be set.
<lease time> the unit of lease time is minute, range [1, 2880]
Parameters <start IP> start IP of the IP range that can be got from ESP8266 soft-AP
DHCP server
<end IP> end IP of the IP range that can be got from ESP8266 soft-AP
DHCP server
Command AT+CWDHCPS_DEF=<enable>, <lease time>, <start IP>, <end IP>
Response OK
Parameters The same as above.
AT+ CIPSTAMAC_CUR – Set MAC address of ESP8266 station, won’t save to Flash
Example AT+CIPSTAMAC_CUR="18:fe:35:98:d3:7b"
Command AT+CIPSTAMAC_CUR?
+CIPSTAMAC_CUR:<mac>
Response
OK
Parameters <mac> string, MAC address of ESP8266 station
Command AT+CIPSTAMAC_CUR=<mac>
Response OK
Parameters <mac> string, MAC address of ESP8266 station
Notes This configuration will NOT store in Flash.
34. AT+CWSTARTDISCOVER – Start the mode that ESP8266 can be found by WeChat
The parameter of this command needs to be got from Espressif Cloud. After connected to an AP and
got an IP address, ESP8266 can be found by WeChat which is in the same LAN.
WeChat : http://iot.weixin.qq.com
AT+CWSTARTDISCOVER
– Start the mode that ESP8266 can be found by WeChat which is in the same LAN
Example AT+CWSTARTDISCOVER="gh_9e2cff3dfa51", "122475", 10
Command AT+CWSTARTDISCOVER=<WeChat number>, <dev_type>, <time>
Response OK or ERROR
<WeChat number> got from WeChat
<dev_type> got from WeChat
<time>
Parameters time interval that ESP8266 sends packet, range: 0 ~ 24x3600, unit : second.
0 : ESP8266 will not send packet, waiting for WeChat's detection.
Otherwise, it is the time interval that ESP8266 sends packet, so the WeChat may
find it easier.
ESP8266 station need to connect to an AP and get an IP address first. Then use
Notes
this command so that WeChat can find this ESP8266 device.
35. AT+CWSTOPDISCOVER – Stop the mode that ESP8266 can be found by WeChat
AT+CWSTOPDISCOVER
– Stop the mode that ESP8266 can be found by WeChat which is in the same LAN
Command AT+CWSTOPDISCOVER
Response OK or ERROR
5.2. TCP/IP
1. AT+CIPSTATUS – Check network connection status
Note: [<UDP mode>] can only be used when [<UDP local port>] is set.
Command AT+CIPSEND
Wrap return ">" begins receiving of serial data, when data <length> is met,
send it; data more than <length> will be discarded, and returns "busy"
Response OK
OK
Response
Response If connection is not established or there are still TCP data wait for sending,
returns
ERROR
Response
OK
ERROR
<IP address>
Parameters IP address of ESP8266 softAP
IP address of ESP8266 station
Only after ESP8266 station connected to AP, station IP can be got and
Note
inquiried.
Response
If already connected, returns
Link is builded
Command AT+CIPMODE=<mode>
OK
Response If already connected, returns
Link is builded
<mode>0 normal mode
Parameters
<mode>1 UART-WiFi passthrough mode
Notes This configuration would NOT save into Flash.
Command AT+CIPSTO=<time>
Response OK
ESP8266 as TCP server, will disconnect to TCP client that didn’t communicate
Notes with it even if timeout.
If AT+CIPSTO=0, it will never timeout. We don’t recommend that.
Response OK
Or
ERROR // means ping fail
Param description
Parameters <IP> : string, host IP or domain name
<time> : response time of ping
AT+CIPDINFO – Show remote IP and port with "+IPD" ( received data from network )
Example AT+CIPDINFO=1
Command AT+CIPDINFO=<mode>
OK
Response Or
ERROR
Param description
Parameters <mode> 0: will not show remote IP and port with "+IPD"
<mode> 1: show remote IP and port with "+IPD"
6. Appendix
ESP8266 AT commands below will save configuration parameters into flash:
AT Command Example
AT+UART_DEF AT+UART_DEF=115200, 8, 1, 0, 3
AT+CWDHCP_DEF AT+CWDHCP_DEF=1, 1
AT+CIPSTAMAC_DEF AT+CIPSTAMAC_DEF="18:fe:35:98:d3:7b"
AT+CIPAPMAC_DEF AT+CIPAPMAC_DEF="1a:fe:36:97:d5:7b"
AT+CIPSTA_DEF AT+CIPSTA_DEF="192.168.6.100"
AT+CIPAP_DEF AT+CIPAP_DEF="192.168.5.1"
AT+CWMODE_DEF AT+CWMODE_DEF=3
AT+CWAUTOCONN AT+CWAUTOCONN=1
• Only if the configuration changes, we will write the new configuration into Flash.
• To 512KB+512KB Flash Map:
user parameter area is 0x7C000 ~ 0x80000, 16KB;
• To 1024KB+1024KB Flash Map:
user parameter area is 0xFC000 ~ 0x100000, 16KB;
• System parameter area is always the last 16KB of Flash.
7. Q&A
If you have any questions about AT Commands, please contact us ([email protected]) with
information as follows:
• Version info of AT : Using "AT+GMR" to get the version info.
Hardware Module info: example Ai-thinker ESP-01
• Screenshot or steps of the test steps, for example:
• Log:
ets Jan 8 2013, rst cause: 1, boot mode: (3, 3)