AT Commands PDF
AT Commands PDF
AT Instruction Set
                                    Version 3.0.1
                                    Espressif Systems
                                    Copyright © 2019
                www.espressif.com
                                                            About This Guide
             This document provides AT commands list based on ESP8266_NONOS_SDK.
Release Notes
2017.05 V2.1.0 Updated Section 3.2, Section 4.1 and Section 5.2.
Certifications
             Please download the product certification(s) here.
                                                                                          Table of Contents
1. Overview ................................................................................................................................................1
    1.1.     Customize AT Firmware	.............................................................................................................................. 1
4.2.1. AT+CWMODE_CUR—Sets the Current Wi-Fi mode; Configuration Not Saved in the Flash ...... 21
4.2.2. AT+CWMODE_DEF—Sets the Default Wi-Fi mode; Configuration Saved in the Flash ..............21
4.2.8. AT+CWSAP_CUR—Configures the ESP8266 SoftAP; Configuration Not Saved in the Flash .... 26
4.2.9. AT+CWSAP_DEF—Configures the ESP8266 SoftAP; Configuration Saved in the Flash ...........27
            4.2.16. AT+CIPSTAMAC_CUR—Sets the MAC Address of the ESP8266 Station; Configuration Not
           Saved in the Flash	.......................................................................................................................................30
             4.2.17. AT+CIPSTAMAC_DEF—Sets the MAC Address of the ESP8266 Station; Configuration Saved in
           the Flash	......................................................................................................................................................31
            4.2.18. AT+CIPAPMAC_CUR—Sets the MAC Address of the ESP8266 SoftAP; Configuration Not
           Saved in the Flash	.......................................................................................................................................31
             4.2.19. AT+CIPAPMAC_DEF—Sets the MAC Address of the ESP8266 SoftAP; Configuration Saved in
           Flash	............................................................................................................................................................31
            4.2.20. AT+CIPSTA_CUR—Sets the Current IP Address of the ESP8266 Station; Configuration Not
           Saved in the Flash	.......................................................................................................................................32
             4.2.21. AT+CIPSTA_DEF—Sets the Default IP Address of the ESP8266 Station; Configuration Saved in
           the Flash	......................................................................................................................................................32
             4.2.22. AT+CIPAP_CUR—Sets the IP Address of the ESP8266 SoftAP; Configuration Not Saved in the
           Flash	............................................................................................................................................................33
             4.2.23. AT+CIPAP_DEF—Sets the Default IP Address of the ESP8266 SoftAP; Configuration Saved in
           the Flash	......................................................................................................................................................34
4.2.26. AT+CWSTARTDISCOVER—Enables the Mode that ESP8266 can be Found by WeChat ..........35
4.2.27. AT+CWSTOPDISCOVER—Disables the Mode that ESP8266 can be Found by WeChat ..........36
             4.2.31. AT+CWCOUNTRY_CUR—Set ESP8266 WiFi Country Code; Configuration Not Saved in the
           Flash	............................................................................................................................................................37
             4.2.32. AT+CWCOUNTRY_DEF—Set the default WiFi Country Code of ESP8266; Configuration Saved
           in the Flash	..................................................................................................................................................38
5.2.30. AT+CIPDNS_CUR—Sets User-defined DNS Servers; Configuration Not Saved in the Flash .... 57
5.2.31. AT+CIPDNS_DEF—Sets User-defined DNS Servers; Configuration Saved in the Flash ............58
A. Appendix A ..........................................................................................................................................59
B. Appendix B ..........................................................................................................................................60
C. Q&A ......................................................................................................................................................61
                                                                                                                                      1. Overview
!
    1.                                                                                                         Overview
                 ESP8266 AT Firmware, officially launched by Espressif, is available for download and can be used
                 directly. Also, users may find AT Project that Espressif specially created for users to customize AT
                 firmware.
                 This document introduces how to customize AT firmware and download AT firmware into flash. It also
                 provides detailed information about the AT instruction set.
⚠ Notes:
                          • Please make sure that correct BIN (/ESP8266_NONOS_SDK/bin/at) is already in the ESP8266 module before
                            using the AT commands listed in this document.
                          • AT firmware uses priority levels 0 and 1 of system_os_task, so only one task of priority 2 is allowed to be set up by
                            the user application.
• OTA:
                      -     The official AT firmware launched by Espressif supports the command AT+CIUPDATE by default,
                            which helps update AT firmware to the latest version from Espressif Cloud.
                      -     For the customized AT firmware, users have to implement this function by themselves to update
                            the firmware from their own cloud. Please refer to the OTA example that Espressif introduced in
                            at_upgrade.c.
• SmartConfig:
Espressif                                                               ! /!62
                                                                         1                                                                2019.02
                                                                                                                      1. Overview
!
AT Command AT+TEST=?
AT Command AT+TEST?
AT Command AT+TEST
Espressif                                                   ! /!62
                                                             2                                                            2019.02
                                                                                                                            1. Overview
!
blank.bin 0xFE000 Initializes Flash user parameter area, more details in Appendix.
blank.bin 0xFE000 Initializes Flash user parameter area, more details in Appendix.
Espressif                                                   ! /!62
                                                             3                                                                  2019.02
                                                                                                                            1. Overview
!
                                                                     Initializes the flash user parameter area; for more details please
                             blank.bin           0x7A000
                                                                     see Appendix.
                                                                     Initializes the flash user parameter area; for more details please
                             blank.bin           0x7E000
                                                                     see Appendix.
Espressif                                                   ! /!62
                                                             4                                                                  2019.02
                                                                                                                           1. Overview
!
blank.bin 0x7E000 Initializes Flash user parameter area, more details in Appendix.
blank.bin 0x7E000 Initializes Flash user parameter area, more details in Appendix.
Espressif                                                  ! /!62
                                                            5                                                                  2019.02
                                                                                                             2. Command Description
!
    2.                                            Command Description
            Each command set contains four types of AT commands.
⚠ Notice:
• Square brackets [ ] designate the default value; it is either not required or may not appear.
               • String values need to be included in double quotation marks, for example: AT+CWSAP="ESP756290","21030826",
                  1,4.
• AT commands have to be capitalized, and must end with a new line (CR LF).
Espressif                                                    ! /!62
                                                              6                                                            2019.02
                                                                                            3. Basic AT Commands
!
    3.                                   Basic AT Commands
3.1.        Overview
                         Commands                                         Description
AT Tests AT startup.
Espressif                                  ! /!62
                                            7                                                           2019.02
                                                                                                        3. Basic AT Commands
!
3.2.        Commands
3.2.1.      AT—Tests AT Startup
Execute Command AT
Response OK
Parameters -
Response OK
Parameters -
OK
<time>
                       Response
                                          OK
                                          A minor adjustment has to be made before the module enter the Deep-sleep mode, i.e.,
                         Note
                                          connecting XPD_DCDC to EXT_RSTB via a 0-ohm resistor.
Espressif                                                  ! /!62
                                                            8                                                             2019.02
                                                                                                        3. Basic AT Commands
!
Response OK
                                      This command ATE is used to trigger command echo. It means that entered commands
                                      can be echoed back to the sender when ATE command is used. Two parameters are
                         Note
                                      possible. The command returns OK in normal cases and ERROR when a parameter other
                                      than 0 or 1 was specified.
Response OK
                                      The execution of this command will reset all parameters saved in flash, and restore the
                         Note         factory default settings of the module. The chip will be restarted when this command is
                                      executed.
                                                                                  Set Command:
                                      Query Command:
                       Command
                                                                                  AT+UART_CUR=<baudrate>,<databits>,<stop
                                      AT+UART_CUR?
                                                                                  bits>,<parity>,<flow	control>
                                      +UART_CUR:<baudrate>,<databits>,<stop
                       Response       bits>,<parity>,<flow	control>
              OK
                                      OK
Espressif                                               ! /!62
                                                         9                                                               2019.02
                                                                                        3. Basic AT Commands
!
                            ‣   5: 5-bit data
                            ‣   6: 6-bit data
                            ‣   7: 7-bit data
                            ‣   8: 8-bit data
                         • <stopbits>: stop bits
                            ‣ 0: None
                            ‣ 1: Odd
                            ‣ 2: Even
                         • <flow	control>: flow control
Example AT+UART_CUR=115200,8,1,0,3
Espressif                                   ! /! 62
                                             10                                                     2019.02
                                                                                                                  3. Basic AT Commands
!
                                                                                      Set Command:
                              Query Command:
                  Command
                                                                                      AT+UART_DEF=<baudrate>,<databits>,<stopbits>
                              AT+UART_DEF?
                                                                                      ,<parity>,<flow	control>
                              +UART_DEF:<baudrate>,<databits>,<stopbits>,<
                  Response    parity>,<flow	control>
                                 OK
                              OK
                                   ‣   5: 5-bit data
                                   ‣   6: 6-bit data
                                   ‣   7: 7-bit data
                                   ‣   8: 8-bit data
                              • <stopbits>: stop bits
                                   ‣ 0: None
                                   ‣ 1: Odd
                                   ‣ 2: Even
                              • <flow	control>: flow control
                              1. The configuration changes will be saved in the user parameter area in the flash, and will still be valid
                                 when the chip is powered on again.
                              2. The use of flow control requires the support of hardware:
                    Notes
                                   ‣ MTCK is UART0 CTS
                                   ‣ MTDO is UART0 RTS
                              3. The range of baud rates supported: 110~115200*40.
Example AT+UART_DEF=115200,8,1,0,3
Espressif                                                        ! /! 62
                                                                  11                                                               2019.02
                                                                                                       3. Basic AT Commands
!
+SLEEP:<sleep mode>
                    Response                                                  OK
                                OK
<sleep mode>:
Notes This command can only be used in Station mode. Modem-sleep is the default sleep mode.
Example AT+SLEEP=0
Command AT+WAKEUPGPIO=<enable>,<trigger_GPIO>,<trigger_level>[,<awake_GPIO>,<awake_level>]
Response OK
• <enable>
• <trigger_GPIO>
                                     ‣ Sets the GPIO to wake ESP8266 up; range of value: [0, 15].
                                • <trigger_level>
                                     ‣ Optional; this parameter is used to set a GPIO as a flag of ESP8266’s being awoken form
                                       Light-sleep; range of value: [0, 15].
                                • [<awake_level>]
‣ Optional;
Espressif                                               ! /! 62
                                                         12                                                             2019.02
                                                                                                       3. Basic AT Commands
!
                             •    Since the system needs some time to wake up from light sleep, it is suggested that wait at
                                  least 5ms before sending next AT command.
                             •    The value of <trigger_GPIO> and <awake_GPIO> in the command should not be the same.
                 Notes       •    After being woken up by <trigger_GPIO> from Light-sleep, when the ESP8266 attempts to
                                  sleep again, it will check the status of the <trigger_GPIO>:
                                  ‣   if it is still in the wakeup status, the EP8266 will enter Modem-sleep mode instead;
                                  ‣   if it is NOT in the wakeup status, the ESP8266 will enter Light-sleep mode.
AT+WAKEUPGPIO=1,0,0
                             • Set ESP8266 to be woken from Light-sleep, when GPIO0 is on high level. After the waking-
                Example           up, GPIO13 is set to high level.
AT+WAKEUPGPIO=1,0,1,13,1
• Disable the function that ESP8266 can be woken up from Light-sleep by a GPIO.
AT+WAKEUPGPIO=0
Response OK
Parameter <TX Power>: the maximum value of RF TX power; range: [0, 82]; unit: 0.25 dBm.
                             This command sets the maximum value of ESP8266 RF TX power; it is not precise. The actual
                 Note
                             value could be smaller than the set value.
Example AT+RFPOWER=50
                            Query Command:
                                                         Set Command:                   Execute Command:
                            AT+RFVDD?
               Command                                   AT+RFVDD=<VDD33>
              AT+RFVDD
                            +RFVDD:<VDD33>
               Response                                  OK                             OK
                            OK
Espressif                                             ! /! 62
                                                       13                                                                2019.02
                                                                                                   3. Basic AT Commands
!
Example AT+RFVDD=2800
                              +SYSADC:<ADC>
               Response
                              OK
Response OK
Note Please refer to ESP8266 Pin List for uses of AT+SYSIO-related commands.
Espressif                                              ! /! 62
                                                        14                                                        2019.02
                                                                                                  3. Basic AT Commands
!
                             +SYSIOGETCFG:<pin>,<mode>,<pull-up>
                Response
                             OK
Note Please refer to ESP8266 Pin List for uses of AT+SYSIO-related commands.
OK
Response • If the IO pin is not in GPIO mode, the command will return:
ERROR
• <dir>:
                Parameter
                                  ‣ 0: sets the GPIO as an input
Note Please refer to ESP8266 Pin List for uses of AT+SYSGPIO-related commands.
                 Example
                             AT+SYSGPIODIR=12,0		//Set	GPIO12	to	work	as	an	input
OK
Response • If the IO pin is not in output mode, the command will return:
NOT OUTPUT!
ERROR
• <level>:
                Parameter
                                  ‣ 0: low level
‣ 1: high level
Espressif                                             ! /! 62
                                                       15                                                     2019.02
                                                                                                3. Basic AT Commands
!
Note Please refer to ESP8266 Pin List for uses of AT+SYSGPIO-related commands.
+SYSGPIOREAD:<pin>,<dir>,<level>
OK
               Response
                            • If the IO pin is not in GPIO mode, the command will return:
ERROR
• <dir>:
• <level>:
‣ 0: low level
‣ 1: high level
Note Please refer to ESP8266 Pin List for uses of AT+SYSGPIO-related commands.
AT+SYSGPIOREAD=12
Response OK
Espressif                                           ! /! 62
                                                     16                                                     2019.02
                                                                                                3. Basic AT Commands
!
<n>:
                           ‣ if the bit0 is 1, when quitting WiFi-UART passthrough transmission, it will prompt the
                             message +QUITT // Quit transparent transmission
            Parameter
                           ‣ if the bit1 is 0, when a network connection is established, it will prompt the message
                             <Link_ID>,CONNECT; default is 0
                           ‣ if the bit1 is 1, when establishing a network connection, it will prompt the message
                             +LINK_CONN:<status_type>,<link_id>,"UDP/TCP/SSL",<c/s>,<remote_ip>,	
                             <remote_port>,<local_port>;
Example AT+SYSMSG_CUR=3
Espressif                                      ! /! 62
                                                17                                                                  2019.02
                                                                                                      3. Basic AT Commands
!
Response OK
<n>:
                                 ‣ if the bit0 is 1, when quitting WiFi-UART passthrough transmission, it will prompt the
                                   message +QUITT // Quit transparent transmission
               Parameter         ‣ if the bit1 is 0, when a network connection is established, it will prompt the message
                                   <Link_ID>,CONNECT; default is 0
                                 ‣ if the bit1 is 1, when establishing a network connection, it will prompt the message
                                   +LINK_CONN:<status_type>,<link_id>,"UDP/TCP/SSL",<c/s>,<remote_ip>,	
                                   <remote_port>,<local_port>;
Note The configuration changes will be saved in the flash user parameter area.
Example AT+SYSMSG_DEF=3
Espressif                                            ! /! 62
                                                      18                                                                  2019.02
                                                                                                       4. Wi-Fi AT Commands
!
    4.                                             Wi-Fi AT Commands
4.1.        Overview
                    Commands                                                Description
AT+CWMODE_CUR Sets the Wi-Fi mode (Station/AP/Station+AP); configuration not saved in the flash.
AT+CWMODE_DEF Sets the default Wi-Fi mode (Station/AP/Station+AP); configuration saved in the flash.
AT+CWSAP_CUR Sets the current configuration of the ESP8266 SoftAP; configuration not saved in the flash.
AT+CWSAP_DEF Sets the configuration of the ESP8266 SoftAP; configuration saved in the flash.
AT+CWDHCPS_CUR Sets the IP range of the DHCP server; configuration not saved in the flash.
AT+CWDHCPS_DEF Sets the IP range of the DHCP server; configuration saved in the flash.
AT+CIPSTAMAC_CUR Sets the MAC address of the ESP8266 Station; configuration not saved in the flash.
AT+CIPSTAMAC_DEF Sets the MAC address of ESP8266 station; configuration saved in the flash.
AT+CIPAPMAC_CUR Sets the MAC address of the ESP8266 SoftAP; configuration not saved in the flash.
AT+CIPAPMAC_DEF Sets the MAC address of the ESP8266 SoftAP; configuration saved in the flash.
AT+CIPSTA_CUR Sets the IP address of the ESP8266 Station; configuration not saved in the flash.
AT+CIPSTA_DEF Sets the IP address of the ESP8266 Station; configuration saved in the flash.
AT+CIPAP_CUR Sets the IP address of ESP8266 SoftAP; configuration not saved in the flash.
Espressif                                             ! /! 62
                                                       19                                                                2019.02
                                                                                                   4. Wi-Fi AT Commands
!
AT+CIPAP_DEF Sets the IP address of ESP8266 SoftAP; configuration saved in the flash.
Espressif                                         ! /! 62
                                                   20                                                          2019.02
                                                                                                                   4. Wi-Fi AT Commands
!
4.2.        Commands
4.2.1.      AT+CWMODE_CUR—Sets the Current Wi-Fi mode; Configuration Not Saved in the Flash
                 Commands
                              AT+CWMODE_CUR=?               Function: to query the current Wi-Fi   Function: to set the current Wi-Fi
                                                            mode of ESP8266.                       mode of ESP8266.
+CWMODE_CUR:<mode> +CWMODE_CUR:<mode>
                  Response                                                                         OK
                              OK                            OK
<mode>:
Example AT+CWMODE_CUR=3
4.2.2. AT+CWMODE_DEF—Sets the Default Wi-Fi mode; Configuration Saved in the Flash
                 Commands
                              AT+CWMODE_DEF=?               Function: to query the current Wi-Fi   Function: to set the current Wi-Fi
                                                            mode of ESP8266.                       mode of ESP8266.
+CWMODE_DEF:<mode> +CWMODE_DEF:<mode>
                  Response                                                                         OK
                              OK                            OK
<mode>:
Note The configuration changes will be saved in the system parameter area in the flash.
Example AT+CWMODE_DEF=3
Espressif                                                        ! /! 62
                                                                  21                                                              2019.02
                                                                                                                  4. Wi-Fi AT Commands
!
                                                                                  Set Command:
                               Query Command:
                                                                                  AT+CWJAP_CUR=<ssid>,<pwd>,[<bssid>]
                  Commands     AT+CWJAP_CUR?
                                                                                  [,<pci_en>]
                               Function: to query the AP to which the ESP8266
                                                                                  Function: to set the AP to which the ESP8266
                               Station is already connected.
                                                                                  Station needs to be connected.
                                                                                  OK
                               +CWJAP_CUR:<ssid>,<bssid>,<channel>,<rssi>
 or
                  Response
                               OK                                                 +CWJAP_CUR:<error	code>
                                                                                  FAIL
AT+CWJAP_CUR="abc","0123456789"
                               For example, if the target AP’s SSID is "ab\,c" and the password is "0123456789"\", the command is	
                               as follows:
                  Examples
                               AT+CWJAP_CUR="ab\\\,c","0123456789\"\\"
If multiple APs have the same SSID as "abc", the target AP can be found by BSSID:
AT+CWJAP_CUR="abc","0123456789","ca:d7:19:d8:a6:44"
Espressif                                                     ! /! 62
                                                               22                                                             2019.02
                                                                                                                   4. Wi-Fi AT Commands
!
                                                                                   Set Command:
                               Query Command:
                                                                                   AT+CWJAP_DEF=<ssid>,<pwd>,[<bssid>]
                  Commands     AT+CWJAP_DEF?
                                                                                   [,<pci_en>]
                               Function: to query the AP to which the ESP8266
                                                                                   Function: to set the AP to which the ESP8266
                               Station is already connected.
                                                                                   Station needs to be connected.
                                                                                   OK
                               +CWJAP_DEF:<ssid>,<bssid>,<channel>,<rssi>
 or
                  Response
                               OK                                                  +CWJAP_DEF:<error	code>
                                                                                   FAIL
Note The configuration changes will be saved in the system parameter area in the flash.
AT+CWJAP_DEF="abc","0123456789"
                               For example, if the target AP’s SSID is "ab\,c" and the password is "0123456789"\", the command is	
                               as follows:
                  Examples
                               AT+CWJAP_DEF="ab\\\,c","0123456789\"\\"
If multiple APs have the same SSID as "abc", the target AP can be found by BSSID:
AT+CWJAP_DEF="abc","0123456789","ca:d7:19:d8:a6:44"
Espressif                                                     ! /! 62
                                                               23                                                              2019.02
                                                                                                                4. Wi-Fi AT Commands
!
                                OK
                   Response     or
ERROR
                                • <sort_enable>: determines whether the result of command AT+CWLAP will be listed according to
                                     RSSI:
                                     ‣ 0: the result is ordered according to RSSI.
                                     ‣ 1: the result is not ordered according to RSSI.
                                • <mask>: determines the parameters shown in the result of AT+CWLAP; 0 means not showing the
                                     parameter corresponding to the bit, and 1 means showing it.
                                     ‣   bit	0: determines whether <ecn> will be shown in the result of AT+CWLAP.
                   Parameters        ‣   bit	1: determines whether <ssid> will be shown in the result of AT+CWLAP.
                                     ‣   bit	2: determines whether <rssi> will be shown in the result of AT+CWLAP.
                                     ‣   bit	3: determines whether <mac> will be shown in the result of AT+CWLAP.
                                     ‣   bit	4: determines whether <ch> will be shown in the result of AT+CWLAP.
                                     ‣   bit	5: determines whether <freq	offset> will be shown in the result of AT+CWLAP.
                                     ‣   bit	6: determines whether <freq	calibration> will be shown in the result of AT+CWLAP.
                                     ‣   bit	7: determines whether <pairwise_cipher> will be shown in the result of AT+CWLAP.
‣ bit 10: determines whether <wps> will be shown in the result of AT+CWLAP.
AT+CWLAPOPT=1,2047
                                The first parameter is 1, meaning that the result of the command AT+CWLAP will be ordered
                    Example     according to RSSI;
                                The second parameter is 2047, namely 0x7FF, meaning that the corresponding bits of <mask> are
                                set to 1. All parameters will be shown in the result of AT+CWLAP.
                                Set Command:
                                                                                  Execute Command:
                                AT+CWLAP[=<ssid>,<mac>,<channel>,<scan_
                   Commands     type>,<scan_time_min>,<scan_time_max>]            AT+CWLAP
                                Function: to query the APs with specific SSID     Function: to list all available APs.
                                and MAC on a specific channel.
                                +CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<chann
                                                                                  +CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<channel>,<
                                el>,<freq	offset>,<freq	
                                                                                  freq	offset>,	<freq	cali>,<pairwise_cipher>,	
                   Response     cali>,<pairwise_cipher>,	
                                                                                  <group_cipher>,<bgn>,<wps>
<group_cipher>,<bgn>,<wps>
                                                                                  OK
                                OK
Espressif                                                    ! /! 62
                                                              24                                                            2019.02
                                                                                                       4. Wi-Fi AT Commands
!
‣ 1: passive scan
                           ‣   0: OPEN
                           ‣   1: WEP
                           ‣   2: WPA_PSK
                           ‣   3: WPA2_PSK
                           ‣   4: WPA_WPA2_PSK
                           ‣   5: WPA2_Enterprise (AT can NOT connect to WPA2_Enterprise AP for now.)
                         • <ssid>: string parameter, SSID of the AP.
• <freq offset>: frequency offset of AP; unit: KHz. The value of ppm is <freq offset>/2.4.
                         • <pairwise_cipher>:
                           ‣ 0:CIPHER_NONE
                           ‣ 1:CIPHER_WEP40
                           ‣ 2:CIPHER_WEP104
                           ‣ 3:CIPHER_TKIP
                           ‣ 4:CIPHER_CCMP
                           ‣ 5:CIPHER_TKIP_CCMP
                           ‣ 6:CIPHER_UNKNOWN
                         • <group_cipher>: definitions of cipher types are same as <pairwise_cipher>
                         • <bgn>:
                            ‣ bit0 is for 802.11b mode; bit1 is for 802.11g mode; bit2 is for 802.11n mode;
                            ‣ if the value of the bit is 1, the corresponding 802.11 mode is enabled; if the bit value is 0, the
                                mode is disabled.
                         • <wps>:0, WPS is disabled; 1, WPS is enabled
AT+CWLAP="Wi-Fi","ca:d7:19:d8:a6:44",6
Examples AT+CWLAP="Wi-Fi"
Espressif                                             ! /! 62
                                                       25                                                                2019.02
                                                                                                       4. Wi-Fi AT Commands
!
Response OK
Parameters -
4.2.8. AT+CWSAP_CUR—Configures the ESP8266 SoftAP; Configuration Not Saved in the Flash
OK
                                     +CWSAP_CUR:<ssid>,<pwd>,<chl>,<ecn>,<m
                      Response                                                     or
                                     ax	conn>,<ssid	hidden>
                                                                                   ERROR
Example AT+CWSAP_CUR="ESP8266","1234567890",5,3
Espressif                                                ! /! 62
                                                          26                                                           2019.02
                                                                                                        4. Wi-Fi AT Commands
!
OK
                                     +CWSAP_DEF:<ssid>,<pwd>,<chl>,<ecn>,<m
                      Response                                                     or
                                     ax	conn>,<ssid	hidden>
                                                                                   ERROR
Note The configuration changes will be saved in the flash system parameter area.
Example AT+CWSAP_DEF="ESP8266","1234567890",5,3
<ip addr>,<mac>
                      Response
                                     OK
                        Note         This command cannot get a static IP. It only works when both DHCPs of the ESP8266
                                     SoftAP, and of the Station to which ESP8266 is connected, are enabled.
Espressif                                                ! /! 62
                                                          27                                                          2019.02
                                                                                                    4. Wi-Fi AT Commands
!
                                                                              Set Command:
                             Query Command:
                Commands                                                      AT+CWDHCP_CUR=<<mode>,<en>
                             AT+CWDHCP_CUR?
                                                                              Function: to enable/disable DHCP.
                                                                              • <mode>:
                             • Bit0:
                                                                                   ‣ 0: Sets ESP8266 SoftAP
                                ‣ 0: SoftAP DHCP is disabled.
                                                                                   ‣ 1: Sets ESP8266 Station
                                ‣ 1: SoftAP DHCP is enabled.
                Parameters                                                         ‣ 2: Sets both SoftAP and Station
                             • Bit1:
                                                                              • <en>:
                                ‣ 0: Station DHCP is disabled.
                                                                                   ‣ 0: Disables DHCP
                                ‣ 1: Station DHCP is enabled.
                                                                                   ‣ 1: Enables DHCP
Example AT+CWDHCP_CUR=0,1
                                                                            Set Command:
                             Query Command:
                Commands                                                    AT+CWDHCP_DEF=<<mode>,<en>
                             AT+CWDHCP_DEF?
                                                                            Function: to enable/disable DHCP.
                                                                            • <mode>:
                             • Bit0:
                                                                                 ‣ 0: Sets ESP8266 SoftAP
                               ‣ 0: SoftAP DHCP is disabled.
                                                                                 ‣ 1: Sets ESP8266 Station
                               ‣ 1: SoftAP DHCP is enabled.
                Parameters                                                       ‣ 2: Sets both SoftAP and Station
                             • Bit1:
                                                                            • <en>:
                               ‣ 0: Station DHCP is disabled.
                                                                                 ‣ 0: Disables DHCP
                               ‣ 1: Station DHCP is enabled.
                                                                                 ‣ 1: Enables DHCP
• The configuration changes will be stored in the user parameter area in the flash.
Example AT+CWDHCP_DEF=0,1
Espressif                                        ! /! 62
                                                  28                                                                   2019.02
                                                                                                 4. Wi-Fi AT Commands
!
Set Command:
                            +CWDHCPS_CUR=<lease	time>,<start	
                Response                                                 OK
                            IP>,<end	IP>
• <enable>:
                            • <start	IP>: start IP of the IP range that can be obtained from ESP8266 SoftAP DHCP
                               server.
                            • <end	IP>: end IP of the IP range that can be obtained from ESP8266 SoftAP DHCP server.
                 Notes      • This AT command is enabled when ESP8266 runs as SoftAP, and when DHCP is enabled.
                               The IP address should be in the same network segment as the IP address of ESP8266
                               SoftAP.
AT+CWDHCPS_CUR=1,3,"192.168.4.10","192.168.4.15"
Examples or
Set Command:
• <enable>:
                            • <start	IP>: start IP of the IP range that can be obtained from ESP8266 SoftAP DHCP
                               server.
                            • <end	IP>: end IP of the IP range that can be obtained from ESP8266 SoftAP DHCP server.
Espressif                                       ! /! 62
                                                 29                                                                 2019.02
                                                                                                    4. Wi-Fi AT Commands
!
• The configuration changes will be stored in the user parameter area in the flash.
                  Notes       • This AT command is enabled when ESP8266 runs as SoftAP, and when DHCP is enabled.
                                   The IP address should be in the same network segment as the IP address of ESP8266
                                   SoftAP.
AT+CWDHCPS_DEF=1,3,"192.168.4.10","192.168.4.15"
Examples or
Response OK
<enable>:
Note The configuration changes will be saved in the system parameter area in the flash.
Example AT+CWAUTOCONN=1
4.2.16. AT+CIPSTAMAC_CUR—Sets the MAC Address of the ESP8266 Station; Configuration Not
        Saved in the Flash
                                                                          Set Command:
                             Query Command:                               AT+CIPSTAMAC_CUR=<mac>
                Commands
                             AT+CIPSTAMAC_CUR?                            Function: to set the MAC address of the ESP8266
                                                                          Station.
+CIPSTAMAC_CUR:<mac>
                Response                                                  OK
                             OK
                             • The MAC address of ESP8266 SoftAP is different from that of the ESP8266 Station. Please
                  Notes           make sure that you do not set the same MAC address for both of them.
                             • Bit 0 of the ESP8266 MAC address CANNOT be 1. For example, a MAC address can be
                                  “18:…” but not “15:…”.
Example AT+CIPSTAMAC_CUR="18:fe:35:98:d3:7b"
Espressif                                           ! /! 62
                                                     30                                                             2019.02
                                                                                                     4. Wi-Fi AT Commands
!
4.2.17. AT+CIPSTAMAC_DEF—Sets the MAC Address of the ESP8266 Station; Configuration Saved
        in the Flash
                                                                      Set Command:
                            Query Command:                            AT+CIPSTAMAC_DEF=<mac>
               Commands
                            AT+CIPSTAMAC_DEF?                         Function: to set the MAC address of the ESP8266
                                                                      Station.
+CIPSTAMAC_DEF:<mac>
               Response                                               OK
                            OK
• The configuration changes will be saved in the user parameter area in the flash.
                            • The MAC address of ESP8266 SoftAP is different from that of the ESP8266 Station. Please
                 Notes           make sure that you do not set the same MAC address for both of them.
                            • Bit 0 of the ESP8266 MAC address CANNOT be 1. For example, a MAC address can be “18:
                                 …” but not “15:…”.
Example AT+CIPSTAMAC_DEF="18:fe:35:98:d3:7b"
4.2.18. AT+CIPAPMAC_CUR—Sets the MAC Address of the ESP8266 SoftAP; Configuration Not
        Saved in the Flash
+CIPAPMAC_CUR:<mac>
               Response                                               OK
                            OK
                            • The MAC address of ESP8266 SoftAP is different from that of the ESP8266 Station. Please
                 Notes           make sure you do not set the same MAC address for both of them.
                            • Bit 0 of the ESP8266 MAC address CANNOT be 1. For example, a MAC address can be “18:
                                 …” but not “15:…”.
Example AT+CIPAPMAC_CUR="1a:fe:36:97:d5:7b"
4.2.19. AT+CIPAPMAC_DEF—Sets the MAC Address of the ESP8266 SoftAP; Configuration Saved
        in Flash
Espressif                                             ! /! 62
                                                       31                                                         2019.02
                                                                                                         4. Wi-Fi AT Commands
!
+CIPAPMAC_DEF:<mac>
                Response                                                  OK
                            OK
• The configuration changes will be saved in the user parameter area in the flash.
                            • The MAC address of ESP8266 SoftAP is different from that of the ESP8266 Station. Please
                 Notes           make sure you do not set the same MAC address for both of them.
                            • Bit 0 of the ESP8266 MAC address CANNOT be 1. For example, a MAC address can be “18:
                                 …” but not “15:…”.
Example AT+CIPAPMAC_DEF="1a:fe:36:97:d5:7b"
4.2.20. AT+CIPSTA_CUR—Sets the Current IP Address of the ESP8266 Station; Configuration Not
        Saved in the Flash
               Commands     AT+CIPSTA_CUR?
                              AT+CIPSTA_CUR=<ip>[,<gateway>,<netmask>]
                            Function: to obtain the current IP           Function: to set the current IP address of the ESP8266
                            address of the ESP8266 Station.              Station.
+CIPSTA_CUR:<ip>
+CIPSTA_CUR:<gateway>
                Response                                                 OK
                            +CIPSTA_CUR:<netmask>
OK
Example AT+CIPSTA_CUR="192.168.6.100","192.168.6.1","255.255.255.0"
4.2.21. AT+CIPSTA_DEF—Sets the Default IP Address of the ESP8266 Station; Configuration Saved
        in the Flash
Espressif                                              ! /! 62
                                                        32                                                                 2019.02
                                                                                                          4. Wi-Fi AT Commands
!
+CIPSTA_DEF:<ip>
+CIPSTA_DEF:<gateway>
                Response                                                   OK
                             +CIPSTA_DEF:<netmask>
OK
• The configuration changes will be saved in the user parameter area in the flash.
Example AT+CIPSTA_DEF="192.168.6.100","192.168.6.1","255.255.255.0"
4.2.22. AT+CIPAP_CUR—Sets the IP Address of the ESP8266 SoftAP; Configuration Not Saved in
        the Flash
+CIPAP_CUR:<ip>
+CIPAP_CUR:<gateway>
               Response                                                   OK
                            +CIPAP_CUR:<netmask>
OK
• [<netmask>]: netmask.
Notes • The Set Command interacts with DHCP-related AT commands (AT+CWDHCP-related commands):
Example AT+CIPAP_CUR="192.168.5.1","192.168.5.1","255.255.255.0"
Espressif                                               ! /! 62
                                                         33                                                              2019.02
                                                                                                           4. Wi-Fi AT Commands
!
4.2.23. AT+CIPAP_DEF—Sets the Default IP Address of the ESP8266 SoftAP; Configuration Saved
        in the Flash
+CIPAP_DEF:<ip>
+CIPAP_DEF:<gateway>
               Response                                                   OK
                            +CIPAP_DEF:<netmask>
OK
• [<netmask>]: netmask.
• The configuration changes will be saved in the user parameter area in the flash.
Notes • The Set Command interacts with DHCP-related AT commands (AT+CWDHCP-related commands):
Example AT+CIPAP_DEF="192.168.5.1","192.168.5.1","255.255.255.0"
                            Execute Command:
                            AT+CWSTARTSMART
                              Set Command:
               Commands                                                   AT+CWSTARTSMART=<type>
Response OK
<type>:
               Parameters   ‣ 1: ESP-TOUCH
                            ‣ 2: AirKiss
                            ‣ 3: ESP-TOUCH+AirKiss
Espressif                                                ! /! 62
                                                          34                                                               2019.02
                                                                                                                 4. Wi-Fi AT Commands
!
                              • The message smart	get	wifi	info means that SmartConfig has successfully acquired the AP
                                    information. ESP8266 will try to connect to the target AP.
                              • Message smartconfig	connected	wifi is printed if the connection is successful. Use command
                Notes               AT+CWSTOPSMART to stop SmartConfig before running other commands. Please make sure that
                                    you do not execute other commands during SmartConfig.
                              • Starting from AT_v1.0, SmartConfig can get protocol type (AirKiss or ESP-TOUCH) automatically
                                    by command AT+CWSTARTSMART.
                              • Users can remove this function to reduce bin size and save memory by recompiling the at project,
                                    refer to Section 1.1, and disable the #define	CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE in
                                    user_config.h.
AT+CWMODE=1
               Example
                              AT+CWSTARTSMART
Response OK
Parameters -
                 Note           Irrespective of whether SmartConfig succeeds or not, before executing any other AT commands,
                                please always call AT+CWSTOPSMART to release the internal memory taken up by SmartConfig.
Example AT+CWSTOPSMART
Response OK
Espressif                                                    ! /! 62
                                                              35                                                                   2019.02
                                                                                                          4. Wi-Fi AT Commands
!
                              • <time>: the interval of time for ESP8266 to send packets; range: 0 ~ 24x3600; unit: second.
              Parameters
                                 ‣ 0: ESP8266 will not take the initiative to send packets; it only makes response to queries
                                   from WeChat.
                                 ‣ Otherwise: the time interval for ESP8266 to send packets regularly in order to be detected by
                                   WeChat on the same LAN.
Example AT+CWSTARTDISCOVER="gh_9e2cff3dfa51","122475",10
Response OK
Example AT+CWSTOPDISCOVER
Response OK
                                <enable>:
               Parameters
                                ‣ 1: enables WPS/Wi-Fi Protected Setup
                                ‣ 0: disables WPS
AT+CWMODE=1
                Example
                                AT+WPS=1
OK
                                or
               Response
                                opmode	mismatch	when	mdns
ERROR
Espressif                                               ! /! 62
                                                         36                                                               2019.02
                                                                                                      4. Wi-Fi AT Commands
!
• <enable>:
                                  ‣ 1: enables the MDNS function; the following three parameters need to be set.
                                  ‣ 0: disables the MDNS function; the following three parameters need not to be set.
               Parameters
                            • <hostname>: MDNS host name
                            • Please do not use special characters (such as	.) or a protocol name (for example, http) for
                 Notes            <hostname> and <server_name>.
                            • ESP8266 SoftAP mode does not support the MDNS function for now.
Example AT+MDNS=1,"espressif","iot",8080
                            Query Command:
                                                                          Set Command:
               Commands     AT+CWHOSTNAME?
AT+CWHOSTNAME=<hostname>
+CWHOSTNAME:<host name> OK
                            OK
                                           If the Station mode is not enabled, the command
                                                                          will return:
OK
Parameters <hostname>: the host name of the ESP8266 Station, the maximum length is 32 bytes.
AT+CWMODE=3
                Example
                            AT+CWHOSTNAME="my_test"
4.2.31. AT+CWCOUNTRY_CUR—Set ESP8266 WiFi Country Code; Configuration Not Saved in the
        Flash
                                                                          Set Command:
                            Query Command:
                                                                          AT+CWCOUNTRY_CUR=<country_policy>,<country_co
                            AT+CWCOUNTRY_CUR?
Commands de>,<start_channel>,<total_channel_count>
Espressif                                            ! /! 62
                                                      37                                                                2019.02
                                                                                                        4. Wi-Fi AT Commands
!
                            +CWCOUNTRY_CUR:<country_policy>,<cou
                            ntry_code>,<start_channel>,<total_ch
                            annel_count>
                            OK
               Response                                                  OK
                            Command AT+CWCOUNTRY_CUR? will return
                            the actual value of WiFi country code,
                            which may be changed to the same as the
                            AP it connected to.
                            <country_policy>:
                                  • 0: will change the county code to be the same as the AP that ESP is connected to
                                  • 1: the country code will not change, always be the one set by command.
               Parameters   <country_code>: country code, the length can be 3 characters at most; but the third one is a
                            special character which will not be shown when querying by command AT+CWCOUNTRY_CUR?
                            <start_channel> : the channel number to start at
                            <total_channel_count> : channel count
AT+CWMODE=3
                Example
                            AT+CWCOUNTRY_CUR=1,"CN",1,13
                            code of ESP8266 which is saved in the        Function: Set the default WiFi country code of
                            flash.                                       ESP8266, and save in the flash.
                            +CWCOUNTRY_DEF:<country_policy>,<cou
                            ntry_code>,<start_channel>,<total_ch
                            annel_count>
                Response    OK
                                          OK
                            Command AT+CWCOUNTRY_DEF? will return
                            the default WiFi country code which is
                            stored in the flash.
                            <country_policy>:
                                  • 0: will change the county code to be the same as the AP that ESP is connected to
                                  • 1: the country code will not change, always be the one set by command.
               Parameters   <country_code>: country code, the length can be 3 characters at most; but the third one is a
                            special character which will not be shown when querying by command AT+CWCOUNTRY_DEF?
                            <start_channel> : the channel number to start at
                            <total_channel_count> : channel count
Notes The configuration changes will be saved in the flash user parameter area.
AT+CWMODE=3
                Example
                            AT+CWCOUNTRY_DEF=1,"CN",1,13
Espressif                                            ! /! 62
                                                      38                                                               2019.02
                                                                                        5. TCP/IP-Related AT Commands
!
    5.            TCP/IP-Related AT Commands
5.1.        Overview
                          Command                                            Description
AT+CIPSENDEX Sends data when length of data is <length>, or when \0 appears in the data
Espressif                                        ! /62
                                                  39                                                            2019.02
                                                                        5. TCP/IP-Related AT Commands
!
AT+CIPDNS_CUR Sets user-defined DNS servers; configuration not saved in the flash
Espressif                          ! /62
                                    40                                                            2019.02
                                                                                                         5. TCP/IP 相关 AT 指令
!
5.2.        Commands
5.2.1.      AT+CIPSTATUS—Gets the Connection Status
STATUS:<stat>
                      Response
                                     +CIPSTATUS:<link	ID>,<type>,<remote	IP>,<remote	port>,<local	port>,<tetype>
• <tetype>:
+CIPDOMAIN:<IP address>
OK
Response Or
DNS Fail
ERROR
Parameter <domain name>: the domain name, length should be less than 64 bytes.
Espressif                                              ! /62
                                                        41                                                          2019.02
                                                                                                      5. TCP/IP-Related AT Commands
!
OK
                               or
                  Response     ERROR
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
                               • [<TCP	keep	alive>]: detection time interval when TCP is kept alive; this function is disabled by
                                    default.
                                    ‣ 0: disable TCP keep-alive.
                                    ‣ 1	~	7200: detection time interval; unit: second (s).
AT+CIPSTART="TCP","iot.espressif.cn",8000
Examples AT+CIPSTART="TCP","192.168.101.110",1000
                               OK
                               or
                  Response     ERROR
                               If the UDP transmission is already established, the response is:
ALREADY CONNECTED
Espressif                                                        ! /! 62
                                                                  42                                                            2019.02
                                                                                                    5. TCP/IP-Related AT Commands
!
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
                              ‣ 0: the destination peer entity of UDP will not change; this is the default setting.
                              ‣ 1: the destination peer entity of UDP can change once.
                              ‣ 2: the destination peer entity of UDP is allowed to change.
⚠ Notice:
AT+CIPSTART="UDP","192.168.101.110",1000,1002,2
             Example
                         For more information please see: ESP8266 AT Command Examples.
              Set
                         AT+CIPSTART=[<link	ID>,]<type>,<remote	IP>,<remote	port>[,<TCP	keep	alive>]
            Command
OK
                         or
            Response     ERROR
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
                         • [<TCP	keep	alive>]: detection time interval when TCP is kept alive; this function is disabled by
                              default.
                              ‣ 0: disable the TCP keep-alive function.
                              ‣ 1	~	7200: detection time interval, unit: second (s).
                         • SSL connection does not support UART-Wi-Fi passthrough mode (transparent transmission).
              Notes
                         • SSL connection needs a large amount of memory; otherwise, it may cause system reboot. The
                              command AT+CIPSSLSIZE=<size> can be used to enlarge the SSL buffer size.
Example AT+CIPSTART="SSL","iot.espressif.cn",8443
Espressif                                                   ! /! 62
                                                             43                                                           2019.02
                                                                                                       5. TCP/IP-Related AT Commands
!
Response OK
Parameters <size>: the size of the SSL buffer; range of value: [2048, 4096].
Example AT+CIPSSLSIZE=4096
                  Commands     AT+CIPSSLCCONF?
                                           AT+CIPSSLCCONF=<SSL	mode>
                               Function: Get configuration of the ESP8266 SSL             Function: Set configuration of the ESP8266 SSL
                               client.                                                    client.
                               +CIPSSLCCONF:<SSL	mode>
                  Response                                                                OK
                               OK
<SSL mode>:
                  Parameters        ‣ bit0:if set to be 1, certificate and private key will be enabled, so SSL server can verify ESP8266; if
                                      0, then will not.
                                    ‣ bit1:if set to be 1, CA will be enabled, so ESP8266 can verify SSL server; if 0, then will not.
• If certificates need to be enabled, please call this command before SSL connection is established.
                               • If certificates need to be enabled, please refer to the ESP8266 SSL User Guide to generate
                                    certificates.
                                     - esp_ca_cert.bin downloads to 0xFB000 by default
                    Notes            - esp_cert_private_key.bin downloads to 0xFC000 by default
AT+CWJAP="SSID","PASSWORD" // connect to an AP
                   Example
                               AT+CIPSNTPTIME? // get SNTP time
AT+CIPSSLCCONF=2
AT+CIPSTART="SSL","192.168.3.38",8443
Espressif                                                        ! /! 62
                                                                  44                                                                2019.02
                                                                                                    5. TCP/IP-Related AT Commands
!
                              Set Command:
                              1. Single connection: (+CIPMUX=0)
                                  AT+CIPSEND=<length>
                              2. Multiple connections: (+CIPMUX=1)                    Execute Command:
                                  AT+CIPSEND=<link	ID>,<length>                       AT+CIPSEND
                 Commands
                              3. Remote IP and ports can be set in UDP                Function: to start sending data in transparent
                                 transmission:                                        transmission mode.
                                  AT+CIPSEND=[<link	ID>,]<length>	[,<remote	
                                  IP>,<remote	port>]
                              Function: to configure the data length in normal
                              transmission mode.
Espressif                                                         ! /! 62
                                                                   45                                                           2019.02
                                                                                                     5. TCP/IP-Related AT Commands
!
                               Wrap return > after the Set Command. Begin receiving serial data. When the requirement of data length,
                               determined by <length>, is met, or when \0	appears in the data, the transmission starts.
                               If connection cannot be established or gets disconnected during transmission, the system returns:
                  Response     ERROR
SEND OK
                 Parameters    • When the requirement of data length, determined by <length>, is met, or when \0 appears, the
                                  transmission of data starts. Go back to the normal command mode and wait for the next AT
                                  command.
                               • When sending \0, please send it as \\0.
                   Set           AT+CIPSENDBUF=<length>
                 Command      2. Multiple connections: (+CIPMUX=1)
                                 AT+CIPSENDBUF=<link	ID>,<length>
Espressif                                                          ! /! 62
                                                                    46                                                        2019.02
                                                                                                           5. TCP/IP-Related AT Commands
!
OK
                               >
                               • Wrap return > begins receiving serial data; when the length of data defined by the parameter <length>
                                   is met, the data is sent; if the data length over the value of <length>, the data will be discarded, and
                                   the command returns busy.
                               • If the connection cannot be established, or if it is not a TCP connection, or if the buffer is full, or some
                                   other error occurs, the command returns
                 Response          ERROR
                               • If data is transmitted successfully,
SEND FAIL
                 Parameters    • <segment	ID>: uint32; the ID assigned to each data packet, starting from 1; the ID number increases
                                   by 1 every time a data packet is written into the buffer.
                               • <length>: data length; MAX: 2048 bytes.
                               • This command only writes data into the TCP-send-buffer, so it can be called continually, and the user
                                   need not wait for SEND	OK; if a TCP segment is sent successfully, it will return	<segment	ID>,SEND	OK.
                   Notes       • Before data length reaches the value defined by <length>, input +++ can switch back from data mode
                                   to command mode, and discard the data received before.
                               • This command can NOT be used for SSL connections.
                                   OK
                  Response         If the connection is not established or there is still TCP data waiting to be sent, the response will be:
ERROR
Espressif                                                            ! /! 62
                                                                      47                                                                 2019.02
                                                                                                5. TCP/IP-Related AT Commands
!
AT+CIPBUFSTATUS=<link ID>
                           • Only when <next	segment	ID> - <segment	ID	sent> = 1, can AT+CIPBUFRESET be called to reset the
                                counting.
             Parameters
                           • <segment	ID	successfully	sent>: the ID of the last successfully sent TCP segment;
                           • <queue	number>: available TCP queue number; it’s not reliable and should be used as a reference
                                only.
                           Description:
                                • 20: means that the latest segment ID is 19; so when calling AT+CIPSENDBUF the next time, the
                                    segment ID returned is 20;
              Example           • 15: means that the TCP segment with the ID 15 is the last segment sent, but the segment may
                                    not be successfully sent;
                                • 10: means that the TCP segment with the ID 10 was sent successfully;
• 200: means that the remaining size of the TCP-send-buffer is 200 bytes;
                                • 7: the available TCP queue number; it is not reliable and should be used as a reference only;
                                    when the queue number is 0, no TCP data can be sent.
Espressif                                                   ! /! 62
                                                             48                                                              2019.02
                                                                                                5. TCP/IP-Related AT Commands
!
• The command can only be used to record the status of the last 32 segments at most.
              Parameters
                           • <status>:
                                ‣ FALSE: the segment-sending failed;
                                ‣ TRUE: the segment was sent successfully.
Response OK
• Default is the normal disconnect mode. Usually the abort mode should not be enabled.
                           • If the abort mode is needed, please use this command after TCP connection is established. And
                Notes           the configuration only takes effect in the current connection. If the connection breaks, you need to
                                set it again after new connection is established.
• This configuration only works on normal TCP connection, cannot be used on SSL connection.
                           AT+CIPSTART=0,"TCP","192.168.3.60",3400
               Example     AT+CIPCLOSEMODE=0,1
AT+CIPCLOSE=0
Response OK
               Execute
                            AT+CIFSR
              Command
Espressif                                                 ! /! 62
                                                           49                                                                2019.02
                                                                                             5. TCP/IP-Related AT Commands
!
+CIFSR:APIP,<SoftAP IP address>
OK
<IP address>:
Notes Only when the ESP8266 Station is connected to an AP can the Station IP can be queried.
                                                                           Set Command:
                           Query Command:
              Commands                                                     AT+CIPMUX=<mode>
                           AT+CIPMUX?
                                                                           Function: to set the connection type.
+CIPMUX:<mode>
              Response                                                     OK
                           OK
                           <mode>:
              Parameters
                                ‣ 0: single connection
                                ‣ 1: multiple connections
                           • Multiple connections can only be set when transparent transmission is disabled (AT+CIPMODE=0).
                Notes      • This mode can only be changed after all connections are disconnected.
                           • If the TCP server is running, it must be deleted (AT+CIPSERVER=0) before the single connection
                                mode is activated.
Example AT+CIPMUX=1
Response OK
• <mode>:
Espressif                                                   ! /! 62
                                                             50                                                          2019.02
                                                                                                 5. TCP/IP-Related AT Commands
!
                          • A TCP server can only be created when multiple connections are activated (AT+CIPMUX=1).
               Notes      • A server monitor will automatically be created when the TCP server is created.
• When a client is connected to the server, it will take up one connection and be assigned an ID.
AT+CIPMUX=1
              Example
                          AT+CIPSERVER=1,1001
+CIPSERVERMAXCONN:<num>
             Response                                                            OK
                          OK
             Parameters   <num>: the maximum number of clients allowed to connect to the TCP or SSL server, range: [1, 5]
                          To set this configuration, you should call the command AT+CIPSERVERMAXCONN=<num>	before creating
               Notes
                          a server.
AT+CIPMUX=1
Example AT+CIPSERVERMAXCONN=2
AT+CIPSERVER=1,80
                          Query Command:
                                                                                 Set Command:
                          AT+CIPMODE?
             Commands                                                            AT+CIPMODE=<mode>
                          Function: to obtain information about
                                                                                 Function: to set the transmission mode.
                          transmission mode.
+CIPMODE:<mode>
             Response                                                            OK
                          OK
<mode>:
               Notes      • During the UART-Wi-Fi passthrough transmission, if the TCP connection breaks, ESP8266 will
                               keep trying to reconnect until +++ is input to exit the transmission. If it is a normal TCP transmission
                               and the TCP connection breaks, ESP8266 will give a prompt and will not attempt to reconnect.
Example AT+CIPMODE=1
Espressif                                                 ! /! 62
                                                           51                                                                  2019.02
                                                                                                     5. TCP/IP-Related AT Commands
!
Response OK
• <mode>:
• [<TCP keep alive>] (optional): TCP is kept alive. This function is disabled by default.
                            • This command will save the UART-Wi-Fi passthrough mode and its link in the flash. ESP8266 will
                                 enter the UART-Wi-Fi passthrough mode on any subsequent power cycles.
                Notes
                            • As long as the remote IP (or domain name) and port are valid, the configuration will be saved in the
                                 flash.
Example AT+SAVETRANSLINK=1,"192.168.6.110",1002,"TCP"
Response OK
• <mode>:
                                      ‣ 0: normal mode; ESP8266 will NOT enter UART-Wi-Fi passthrough mode on power-up.
                                      ‣ 1: ESP8266 enters UART-Wi-Fi passthrough mode on power-up.
                                 • <remote	IP>: remote IP or domain name.
               Parameters
                                 • <remote	port>: remote port.
                                 • [<UDP	local	port>] (optional): local port when UDP transparent transmission is enabled on
                                      power-up.
                                 • This command will save the UART-Wi-Fi passthrough mode and its link in the flash. ESP8266 will
                                      enter the UART-Wi-Fi passthrough mode on any subsequent power cycles.
                 Notes
                                 • As long as the remote IP (or domain name) and port are valid, the configuration will be saved in
                                      the user parameter area in the flash.
Example AT+SAVETRANSLINK=1,"192.168.6.110",1002,"UDP",1005
Espressif                                                    ! /! 62
                                                              52                                                             2019.02
                                                                                          5. TCP/IP-Related AT Commands
!
+CIPSTO:<time>
               Response                                                  OK
                           OK
                           • ESP8266 configured as a TCP server will disconnect from the TCP client that does not
                Notes           communicate with it until timeout.
                           • If AT+CIPSTO=0, the connection will never time out. This configuration is not recommended.
AT+CIPMUX=1
Example AT+CIPSERVER=1,1001
AT+CIPSTO=10
AT+PING=<IP>
             Set Command
                           Function: Ping packets.
                           +<time>
                           OK
               Response    or
                           +timeout
                           ERROR
AT+PING="192.168.1.1"
                Notes
                           AT+PING="www.baidu.com"
Espressif                                               ! /! 62
                                                         53                                                           2019.02
                                                                                              5. TCP/IP-Related AT Commands
!
Execute AT+CIUPDATE
+CIPUPDATE:<n>
              Response
                           OK
• <n>:
Response OK
                           <mode>:
              Parameters        ‣ 0: does not show the remote IP and port with +IPD.
                                ‣ 1: shows the remote IP and port with +IPD.
Example AT+CIPDINFO=1
                           The command is valid in normal command mode. When the module receives network data, it will
                           send the data through the serial port using the +IPD command.
                           • [<remote	IP>]: remote IP, enabled by command AT+CIPDINFO=1.
              Parameters   • [<remote	port>]: remote port, enabled by command AT+CIPDINFO=1.
                           • <link	ID>: ID number of connection.
                           • <len>: data length.
                           • <data>: data received.
Espressif                                                 ! /! 62
                                                           54                                                              2019.02
                                                                                                 5. TCP/IP-Related AT Commands
!
+CIPRECVMODE:<mode>
              Response                                               OK
                           OK
Example AT+CIPRECVMODE=1
                           • The configuration is for normal TCP transmission only, and cannot be used on SSL, UDP or WiFi-
                                UART passthrough mode.
                           • If the passive mode is enabled, when ESP8266 receives TCP data, it will prompt the following
                                message in different scenarios:
                Note
                                - for multiple connection mode (AT+CIPMUX=1), the message is: +IPD,<link ID>,<len>
AT+CIPRECVDATA=<len>
            Set Commands
                           • For multiple connection mode (AT+CIPMUX=1):
AT+CIPRECVDATA=<link_id>,<len>
                           +CIPRECVDATA:<actual_len>,<data>
              Response
                           OK
                           • In a case of disconnection, the buffered TCP data will still be there and can be read by MCU until
               Notes            a new connection is established. If the newly established connection happens to use the same
                                link ID, the previously buffered data in the last connection will be lost.
Espressif                                                 ! /! 62
                                                           55                                                                  2019.02
                                                                                             5. TCP/IP-Related AT Commands
!
AT+CIPRECVMODE=1
                            // For example, if host MCU gets a message of receiving 100 bytes data in connection with No.0, the
               Example      message will be as following: +IPD,0,100
                            // then you can read those 100 bytes by using the command below
                            AT+CIPRECVDATA=0,100
Parameters <data length of link>: length of the entire data buffered for the link
AT+CIPRECVLEN?
               Example      +CIPRECVLEN:100,,,,,
                            OK
                                                                    Set Command:
                           Query Command:
              Commands
                                                                    AT+CIPSNTPCFG=<enable>[,<timezone>][,<SNTP	
                           AT+CIPSNTPCFG?
                                                                    server0>,<SNTP	server1>,<SNTP	server2>]
                           +CIPSNTPCFG:<enable>,<timezone>
                           ,<SNTP	server1>[,<SNTP	
              Response     server2>,<SNTP	server3>]
                OK
OK
• <enable>:
‣ 0: SNTP is disabled;
‣ 1: SNTP is enabled.
              Parameters   •    <timezone>: time zone; range: [-11,13]; if SNTP is enabled, the <timezone> has to be set;
                           •    <SNTP	server0>: optional parameter indicating the first SNTP server;
                           •    <SNTP	server1>: optional parameter indicating the second SNTP server;
                           •    <SNTP	server2>: optional parameter indicating the third SNTP server.
Example AT+CIPSNTPCFG=1,8,"cn.ntp.org.cn","ntp.sjtu.edu.cn","us.pool.ntp.org"
                           If the <SNTP server> parameters are not set, servers "cn.ntp.org.cn","ntp.sjtu.edu.cn",	and	
                 Note
                           "us.pool.ntp.org" will be used by default.
Espressif                                                 ! /! 62
                                                           56                                                               2019.02
                                                                                              5. TCP/IP-Related AT Commands
!
+CIPSNTPTIME:<time>
               Response
                           OK
OK
               Example
                           AT+CIPSNTPCFG=1,8	//set	time	zone
5.2.30. AT+CIPDNS_CUR—Sets User-defined DNS Servers; Configuration Not Saved in the Flash
                           Query Command:
                                                                   Set Command:
                           AT+CIPDNS_CUR?
[+CIPDNS_CUR:<DNS server0>]
OK
• <enable>:
Example AT+CIPDNS_CUR=1,"208.67.220.220"
                           • For command: AT+CIPDNS_CUR=0 (disable to use user-defined DNS servers), "208.67.222.222" will
                                be used as DNS server by default. And the DNS server may change according to the configuration
                                of the router which the chip connected to.
                Note
                           • For command: AT+CIPDNS_CUR=1 (enable to use user-defined DNS servers, but the <DNS server>
                                parameters are not set), servers "208.67.222.222"	will be used as DNS server by default.
• <DNS server0> and <DNS server1> cannot be set to the same server.
Espressif                                                ! /! 62
                                                          57                                                               2019.02
                                                                                               5. TCP/IP-Related AT Commands
!
                           Query Command:
                                                                    Set Command:
              Commands     AT+CIPDNS_DEF?
[+CIPDNS_DEF:<DNS server0>]
OK
• <enable>:
Example AT+CIPDNS_DEF=1,"208.67.220.220"
                           • For command: AT+CIPDNS_DEF=0 (disable to use user-defined DNS servers), "208.67.222.222" will
                                be used as DNS server by default. And the DNS server may change according to the configuration
                Note            of the router which the chip connected to.
                           • For command: AT+CIPDNS_DEF=1 (enable to use user-defined DNS servers, but the <DNS server>
                                parameters are not set), servers "208.67.222.222"	will be used as DNS server by default.
• <DNS server0> and <DNS server1> cannot be set to the same server.
Espressif                                                ! /! 62
                                                          58                                                               2019.02
                                                                                                                           Appendix A
!
    A.                                                                                      Appendix A
            ESP8266 AT commands below will save the configuration changes in flash:
AT Command Examples
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+CWDHCPS_DEF AT+CWDHCPS_DEF=1,3,"192.168.4.10","192.168.4.15"
AT+SAVETRANSLINK AT+SAVETRANSLINK_DEF=1,"192.168.6.10",1001
AT+CIPDNS_DEF AT+CIPDNS_DEF=1,"208.67.220.220"
AT+SYSMSG_DEF AT+SYSMSG_DEF=3
AT+CWCOUNTRY_DEF AT+CWCOUNTRY_DEF=1,"CN",1,13
AT+CIPSSLCCONF AT+CIPSSLCCONF=2
AT+CWMODE_DEF AT+CWMODE_DEF=3
AT+CWJAP_DEF AT+CWJAP_DEF="abc","0123456789"
AT+CWSAP_DEF AT+CWSAP_DEF="ESP8266","12345678",5,3
AT+CWAUTOCONN AT+CWAUTOCONN=1
⚠ Notice:
                • Only when the configuration changes will the AT firmware write the new configuration into the flash. Therefore,
                  users need not be concerned about wearing out the flash on repeated application of commands that set the same
                  default configurations over and over again.
                • For 512 KB + 512 KB Flash Map, the user parameter area is 0x7C000 ~ 0x80000, 16 KB;
• For 1024 KB + 1024 KB Flash Map: the user parameter area is 0xFC000 ~ 0x100000, 16 KB;
Espressif                                                    ! /! 62
                                                              59                                                               2019.02
                                                                                                                    Appendix B
!
    B.                                                                               Appendix B
            Messages of ESP8266 AT are as below:
Messages Description
busy s... Busy sending. The system is sending data now, cannot accept the newly input.
Espressif                                              ! /! 62
                                                        60                                                            2019.02
                                                                                                          Appendix C
!
    C.                                                                                                Q&A
            If you have any questions about the execution of AT commands, please contact us via Espressif
            Technical Inquiries. Please describe the issues that you might encounter, including any relevant details,
            as follows:
               • AT Version information or AT Command: You can use command AT+GMR to acquire information
                  on your current AT command version.
               • Hardware Module information: for example, ESP-WROOM-02.
AT+CWMODE_CUR=1
OK
AT+GMR
SDK version:1.0.1
OK
AT+CIPSTAMAC_DEF="14:CF:11:22:33:05"
OK
tail 0
chksum 0xde
tail 0
chksum 0x69
tail 4
chksum 0xcb
csum 0xcb
mode : sta(18: fe: 34: 97: d5: 7b) + softAP(1a: fe: 34: 97: d5: 7b)
Espressif                                             ! /! 62
                                                       61                                                    2019.02
                      Disclaimer and Copyright Notice
                      Information in this document, including URL references, is subject to change without
                      notice.
                      THIS DOCUMENT IS PROVIDED AS IS WITH NO WARRANTIES WHATSOEVER,
                      INCLUDING ANY WARRANTY OF MERCHANTABILITY, NON-INFRINGEMENT, FITNESS
                      FOR ANY PARTICULAR PURPOSE, OR ANY WARRANTY OTHERWISE ARISING OUT
                      OF ANY PROPOSAL, SPECIFICATION OR SAMPLE.
                      All liability, including liability for infringement of any proprietary rights, relating to the use of
                      information in this document, is disclaimed. No licenses express or implied, by estoppel or
                      otherwise, to any intellectual property rights are granted herein.
                      The Wi-Fi Alliance Member logo is a trademark of the Wi-Fi Alliance. The Bluetooth logo is
                      a registered trademark of Bluetooth SIG.
                      All trade names, trademarks and registered trademarks mentioned in this document are
Espressif IOT Team
   property of their respective owners, and are hereby acknowledged.
www.espressif.com     Copyright © 2019 Espressif Inc. All rights reserved.