logo资料库

EN(Esp8266_at_instruction_set_en).pdf

第1页 / 共68页
第2页 / 共68页
第3页 / 共68页
第4页 / 共68页
第5页 / 共68页
第6页 / 共68页
第7页 / 共68页
第8页 / 共68页
资料共68页,剩余部分请下载后查看
Overview
Customize AT Firmware
Compiling AT project
Customize AT Functions
Add User-Defined AT Commands
Downloading AT Firmware into the Flash
16 Mbit Flash, Map: 1024 KB + 1024 KB
32 Mbit Flash, Map: 1024 KB + 1024 KB
4 Mbit Flash
8 Mbit Flash
16 Mbit Flash, Map: 512 KB + 512 KB
32 Mbit Flash, Map: 512 KB + 512 KB
Command Description
Basic AT Commands
Overview
Commands
AT—Tests AT Startup
AT+RST—Restarts the Module
AT+GMR—Checks Version Information
AT+GSLP—Enters Deep-sleep Mode
ATE—AT Commands Echoing
AT+RESTORE—Restores the Factory Default Settings
AT+UART_CUR—Current UART Configuration; Not Saved in the Flash
AT+UART_DEF—Default UART Configuration; Saved in the Flash
AT+SLEEP—Configures the Sleep Modes
AT+WAKEUPGPIO—Configures a GPIO to Wake ESP8266 up from Light-sleep Mode
AT+RFPOWER—Sets the Maximum Value of RF TX Power
AT+RFVDD—Sets RF TX Power According to VDD33
AT+SYSRAM—Checks the Remaining Space of RAM
AT+SYSADC—Checks the Value of ADC
AT+SYSIOSETCFG—Configures IO Working Mode
AT+SYSIOGETCFG—Checks the Working Modes of IO Pins
AT+SYSGPIODIR—Configures the Direction of a GPIO
AT+SYSGPIOWRITE—Configures the Output Level of a GPIO
AT+SYSGPIOREAD—Reads the GPIO Input Level
AT+SYSMSG_CUR—Set Current System Messages
AT+SYSMSG_DEF—Set Default System Messages
Wi-Fi AT Commands
Overview
Commands
AT+CWMODE_CUR—Sets the Current Wi-Fi mode; Configuration Not Saved in the Flash
AT+CWMODE_DEF—Sets the Default Wi-Fi mode; Configuration Saved in the Flash
AT+CWJAP_CUR—Connects to an AP; Configuration Not Saved in the Flash
AT+CWJAP_DEF—Connects to an AP; Configuration Saved in the Flash
AT+CWLAPOPT—Sets the Configuration for the Command AT+CWLAP
AT+CWLAP—Lists Available APs
AT+CWQAP—Disconnects from the AP
AT+CWSAP_CUR—Configures the ESP8266 SoftAP; Configuration Not Saved in the Flash
AT+CWSAP_DEF—Configures the ESP8266 SoftAP; Configuration Saved in the Flash
AT+CWLIF—IP of Stations to Which the ESP8266 SoftAP is Connected
AT+CWDHCP_CUR—Enables/Disables DHCP; Configuration Not Saved in the Flash
AT+CWDHCP_DEF—Enables/Disables DHCP; Configuration Saved in the Flash
AT+CWDHCPS_CUR—Sets the IP Address Allocated by ESP8266 SoftAP DHCP; Configuration Not Saved in Flash
AT+CWDHCPS_DEF—Sets the IP Address Allocated by ESP8266 SoftAP DHCP; Configuration Saved in Flash
AT+CWAUTOCONN—Auto-Connects to the AP or Not
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 the 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 Flash
AT+CIPSTA_CUR—Sets the Current IP Address of the ESP8266 Station; Configuration Not Saved in the Flash
AT+CIPSTA_DEF—Sets the Default IP Address of the ESP8266 Station; Configuration Saved in the Flash
AT+CIPAP_CUR—Sets the IP Address of the ESP8266 SoftAP; Configuration Not Saved in the Flash
AT+CIPAP_DEF—Sets the Default IP Address of the ESP8266 SoftAP; Configuration Saved in the Flash
AT+CWSTARTSMART—Starts SmartConfig
AT+CWSTOPSMART—Stops SmartConfig
AT+CWSTARTDISCOVER—Enables the Mode that ESP8266 can be Found by WeChat
AT+CWSTOPDISCOVER—Disables the Mode that ESP8266 can be Found by WeChat
AT+WPS—Enables the WPS Function
AT+MDNS—Configures the MDNS Function
AT+CWHOSTNAME—Configures the Name of ESP8266 Station
AT+CWCOUNTRY_CUR—Set ESP8266 WiFi Country Code; Configuration Not Saved in the Flash
AT+CWCOUNTRY_DEF—Set the default WiFi Country Code of ESP8266; Configuration Saved in the Flash
TCP/IP-Related AT Commands
Overview
Commands
AT+CIPSTATUS—Gets the Connection Status
AT+CIPDOMAIN—DNS Function
AT+CIPSTART—Establishes TCP Connection, UDP Transmission or SSL Connection
AT+CIPSSLSIZE—Sets the Size of SSL Buffer
AT+CIPSSLCCONF - Sets Configuration of ESP SSL Client
AT+CIPSEND—Sends Data
AT+CIPSENDEX—Sends Data
AT+CIPSENDBUF—Writes Data into the TCP-Send-Buffer
AT+CIPBUFRESET—Resets the Segment ID Count
AT+CIPBUFSTATUS—Checks the Status of the TCP-Send-Buffer
AT+CIPCHECKSEQ—Checks If a Specific Segment Was Successfully Sent
AT+CIPCLOSEMODE—Set the Close Mode of TCP Connection
AT+CIPCLOSE—Closes the TCP/UDP/SSL Connection
AT+CIFSR—Gets the Local IP Address
AT+CIPMUX—Enable or Disable Multiple Connections
AT+CIPSERVER—Deletes/Creates TCP Server
AT+CIPSERVERMAXCONN—Set the Maximum Connections Allowed by Server
AT+CIPMODE—Sets Transmission Mode
AT+SAVETRANSLINK—Saves the Transparent Transmission Link in Flash
AT+CIPSTO—Sets the TCP Server Timeout
AT+PING—Ping Packets
AT+CIUPDATE—Updates the Software Through Wi-Fi
AT+CIPDINFO—Shows the Remote IP and Port with +IPD
+IPD—Receives Network Data
AT+CIPRECVMODE—Set TCP Receive Mode
AT+CIPRECVDATA—Get TCP Data in Passive Receive Mode
AT+CIPRECVLEN—Get TCP Data Length in Passive Receive Mode
AT+CIPSNTPCFG—Sets the Configuration of SNTP
AT+CIPSNTPTIME—Checks the SNTP Time
AT+CIPDNS_CUR—Sets User-defined DNS Servers; Configuration Not Saved in the Flash
AT+CIPDNS_DEF—Sets User-defined DNS Servers; Configuration Saved in the Flash
Appendix A
Appendix B
Q&A
ESP8266 AT Instruction Set Version 3.0.2 Espressif Systems Copyright © 2019 www.espressif.com
About This Guide This document provides AT commands list based on ESP8266_NONOS_SDK. Release Notes Date 2016.04 2016.05 2016.07 2017.05 2017.08 2018.02 2018.05 2018.05 V1.5.3 V1.5.4 V2.0.0 V2.1.0 V2.1.1 V2.2 V2.2.1 V2.2.2 2018.08 V3.0 Version Release notes First Release. Updated Section 5.2.16 and Section 5.2.19 Added Section 3.2.11, updated Section 1.2 Updated Section 3.2, Section 4.1 and Section 5.2. Added Appendix B. Added Section 3.2.22, 3.2.23, 4.2.39, 4.2.40, 5.2.15 Updated 4.2.7, 4.2.8, and Appendix B. Updated 4.2.10, 4.2.11 and 4.2.12 Added Section 5.2.11, 5.2.23, 5.2.24 Updated Section 3.2.10. Added Section 5.2.5, 5.2.25, 5.2.26, 5.2.27 Updated Chapter 1, and Section 4.2.3, 4.2.4, 4.2.11, 4.2.12, Appendix A Remove AT+RFAUTOTRACE command. 2019.02 2019.06 V3.0.1 V3.0.2 Updated Section 5.2.5, 5.2.30, 5.2.31. Corrected a typo in Section 4.2.5. Documentation Change Notification Espressif provides email notifications to keep customers updated on changes to technical documentation. Please subscribe here. Certifications Please download the product certification(s) here.

Table of Contents 1. Overview 1.1. Customize AT Firmware 1.1.1. Compiling AT project 1.1.2. Customize AT Functions 1.1.3. Add User-Defined AT Commands 1.2. Downloading AT Firmware into the Flash ................................................................................................................................................ .............................................................................................................................. ..................................................................................................................... ................................................................................................................ ................................................................................................. ................................................................................................... ...................................................................................... ...................................................................................... ................................................................................................................................... ................................................................................................................................... .......................................................................................... .......................................................................................... 1.2.1. 16 Mbit Flash, Map: 1024 KB + 1024 KB 1.2.2. 32 Mbit Flash, Map: 1024 KB + 1024 KB 1.2.3. 4 Mbit Flash 1.2.4. 8 Mbit Flash 1.2.5. 16 Mbit Flash, Map: 512 KB + 512 KB 1.2.6. 32 Mbit Flash, Map: 512 KB + 512 KB 1 1 1 1 1 2 3 3 3 4 4 5 2. Command Description .......................................................................................................................... 6 3. Basic AT Commands 3.1. Overview 3.2. Commands ............................................................................................................................. ..................................................................................................................................................... ................................................................................................................................................. ..................................................................................................................... ..................................................................................................... ........................................................................................ ........................................................................................... ....................................................................................................... ................................................................ ...................................... ............................................. .................................................................................. ............ ....................................................... ................................................................ ............................................................... .................................................................................... 3.2.1. AT—Tests AT Startup 3.2.2. AT+RST—Restarts the Module 3.2.3. AT+GMR—Checks Version Information 3.2.4. AT+GSLP—Enters Deep-sleep Mode 3.2.5. ATE—AT Commands Echoing 3.2.6. AT+RESTORE—Restores the Factory Default Settings 3.2.7. AT+UART_CUR—Current UART Configuration; Not Saved in the Flash 3.2.8. AT+UART_DEF—Default UART Configuration; Saved in the Flash 3.2.9. AT+SLEEP—Configures the Sleep Modes 3.2.10. AT+WAKEUPGPIO—Configures a GPIO to Wake ESP8266 up from Light-sleep Mode 3.2.11. AT+RFPOWER—Sets the Maximum Value of RF TX Power 3.2.12. AT+RFVDD—Sets RF TX Power According to VDD33 3.2.13. AT+SYSRAM—Checks the Remaining Space of RAM 3.2.14. AT+SYSADC—Checks the Value of ADC 7 7 8 8 8 8 8 9 9 9 11 12 12 13 13 14 14
3.2.15. AT+SYSIOSETCFG—Configures IO Working Mode 3.2.16. AT+SYSIOGETCFG—Checks the Working Modes of IO Pins 3.2.17. AT+SYSGPIODIR—Configures the Direction of a GPIO 3.2.18. AT+SYSGPIOWRITE—Configures the Output Level of a GPIO 3.2.19. AT+SYSGPIOREAD—Reads the GPIO Input Level 3.2.20. AT+SYSMSG_CUR—Set Current System Messages 3.2.21. AT+SYSMSG_DEF—Set Default System Messages .................................................................... ..................................................... ............................................................. .................................................. ..................................................................... ................................................................. ................................................................... 14 14 15 15 16 16 18 4. Wi-Fi AT Commands 4.1. Overview 4.2. Commands ........................................................................................................................... ................................................................................................................................................... ............................................................................................................................................... ...... .............. .......................... ................................. .................................. ................................................................................................ ..................................................................................... .... ........... ................................... ............. ..................... 19 19 21 21 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 22 4.2.3. AT+CWJAP_CUR—Connects to an AP; Configuration Not Saved in the Flash 23 4.2.4. AT+CWJAP_DEF—Connects to an AP; Configuration Saved in the Flash 24 4.2.5. AT+CWLAPOPT—Sets the Configuration for the Command AT+CWLAP 24 4.2.6. AT+CWLAP—Lists Available APs 4.2.7. AT+CWQAP—Disconnects from the AP 26 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 27 4.2.10. AT+CWLIF—IP of Stations to Which the ESP8266 SoftAP is Connected 4.2.11. AT+CWDHCP_CUR—Enables/Disables DHCP; Configuration Not Saved in the Flash 28 4.2.12. AT+CWDHCP_DEF—Enables/Disables DHCP; Configuration Saved in the Flash 28 4.2.13. AT+CWDHCPS_CUR—Sets the IP Address Allocated by ESP8266 SoftAP DHCP; ............................................................................................................... 29 4.2.14. AT+CWDHCPS_DEF—Sets the IP Address Allocated by ESP8266 SoftAP DHCP; Configuration 29 30 ............................................................................................................................................. ............................................................. 4.2.15. AT+CWAUTOCONN—Auto-Connects to the AP or Not 4.2.16. AT+CIPSTAMAC_CUR—Sets the MAC Address of the ESP8266 Station; Configuration Not Configuration Not Saved in Flash Saved in Flash Saved in the Flash ....................................................................................................................................... 30 4.2.17. AT+CIPSTAMAC_DEF—Sets the MAC Address of the ESP8266 Station; Configuration Saved in 31 ...................................................................................................................................................... the Flash 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 ............................................................................................................................................................ 31 Flash
Flash the Flash Saved in the Flash 4.2.20. AT+CIPSTA_CUR—Sets the Current IP Address of the ESP8266 Station; Configuration Not ....................................................................................................................................... 32 4.2.21. AT+CIPSTA_DEF—Sets the Default IP Address of the ESP8266 Station; Configuration Saved in 32 4.2.22. AT+CIPAP_CUR—Sets the IP Address of the ESP8266 SoftAP; Configuration Not Saved in the 33 ...................................................................................................................................................... the Flash ............................................................................................................................................................ 4.2.23. AT+CIPAP_DEF—Sets the Default IP Address of the ESP8266 SoftAP; Configuration Saved in ...................................................................................................................................................... ............................................................................... 4.2.24. AT+CWSTARTSMART—Starts SmartConfig ................................................................................ 4.2.25. AT+CWSTOPSMART—Stops SmartConfig .......... 4.2.26. AT+CWSTARTDISCOVER—Enables the Mode that ESP8266 can be Found by WeChat .......... 4.2.27. AT+CWSTOPDISCOVER—Disables the Mode that ESP8266 can be Found by WeChat ........................................................................................ 4.2.28. AT+WPS—Enables the WPS Function .............................................................................. 4.2.29. AT+MDNS—Configures the MDNS Function .............................................. 4.2.30. AT+CWHOSTNAME—Configures the Name of ESP8266 Station 4.2.31. AT+CWCOUNTRY_CUR—Set ESP8266 WiFi Country Code; Configuration Not Saved in the ............................................................................................................................................................ 37 4.2.32. AT+CWCOUNTRY_DEF—Set the default WiFi Country Code of ESP8266; Configuration Saved 38 .................................................................................................................................................. 34 34 35 35 36 36 36 37 in the Flash Flash 5. TCP/IP-Related AT Commands 5.1. Overview 5.2. Commands .......................................................................................................... ................................................................................................................................................... ............................................................................................................................................... ........................................................................... ................................................................................................ ............. ........................................................................... ...................................................... ......................................................................................................... .................................................................................................... ........................................................ ................................................................... ............................................ ............................ ............................................. ............................................................ ...................................................................................... 5.2.1. AT+CIPSTATUS—Gets the Connection Status 5.2.2. AT+CIPDOMAIN—DNS Function 5.2.3. AT+CIPSTART—Establishes TCP Connection, UDP Transmission or SSL Connection 5.2.4. AT+CIPSSLSIZE—Sets the Size of SSL Buffer 5.2.5. AT+CIPSSLCCONF - Sets Configuration of ESP SSL Client 5.2.6. AT+CIPSEND—Sends Data 5.2.7. AT+CIPSENDEX—Sends Data 5.2.8. AT+CIPSENDBUF—Writes Data into the TCP-Send-Buffer 5.2.9. AT+CIPBUFRESET—Resets the Segment ID Count 5.2.10. AT+CIPBUFSTATUS—Checks the Status of the TCP-Send-Buffer 5.2.11. AT+CIPCHECKSEQ—Checks If a Specific Segment Was Successfully Sent 5.2.12. AT+CIPCLOSEMODE—Set the Close Mode of TCP Connection 5.2.13. AT+CIPCLOSE—Closes the TCP/UDP/SSL Connection 5.2.14. AT+CIFSR—Gets the Local IP Address 39 39 41 41 41 42 44 44 45 46 46 47 48 48 49 49 49
50 5.2.15. AT+CIPMUX—Enable or Disable Multiple Connections 50 5.2.16. AT+CIPSERVER—Deletes/Creates TCP Server 51 5.2.17. AT+CIPSERVERMAXCONN—Set the Maximum Connections Allowed by Server 51 5.2.18. AT+CIPMODE—Sets Transmission Mode 52 5.2.19. AT+SAVETRANSLINK—Saves the Transparent Transmission Link in Flash 53 5.2.20. AT+CIPSTO—Sets the TCP Server Timeout 53 5.2.21. AT+PING—Ping Packets 54 5.2.22. AT+CIUPDATE—Updates the Software Through Wi-Fi 54 5.2.23. AT+CIPDINFO—Shows the Remote IP and Port with +IPD 54 5.2.24. +IPD—Receives Network Data 55 5.2.25. AT+CIPRECVMODE—Set TCP Receive Mode 55 5.2.26. AT+CIPRECVDATA—Get TCP Data in Passive Receive Mode 56 5.2.27. AT+CIPRECVLEN—Get TCP Data Length in Passive Receive Mode 56 5.2.28. AT+CIPSNTPCFG—Sets the Configuration of SNTP 5.2.29. AT+CIPSNTPTIME—Checks the SNTP Time 56 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. 1. Overview 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. 1.1. Customize AT Firmware 1.1.1. Compiling AT project If users want to customize AT source code, or add customized AT commands, please copy the folder at in examples to the root directory of the corresponding ESP8266_NONOS_SDK , and then enter ESP8266_NONOS_SDK/at folder to develop and compile AT project. For details, please refer to ESP8266 Getting Started Guide. 1.1.2. Customize AT Functions • 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: - The official AT firmware launched by Espressif supports the commands AT+CWSTARTSMART and AT+CWSTOPSMART. If users don’t need SmartConfig, you can compile AT Project and disable CONFIG_AT_SMARTCONFIG_COMMAND_ENABLE in user_config.h for smaller bin size and more memory. - 1.1.3. Add User-Defined AT Commands Please use only English letters when naming user-defined AT commands. The AT command name must NOT contain characters or numbers. Espressif ! /!1 62 2019.06 !
1. Overview AT firmware is based on ESP8266_NONOS_SDK. Espressif Systems’ AT commands are provided in libat.a, which is included in the AT BIN firmware. Examples of customized, user-defined AT commands are provided in ESP8266_NONOS_SDK/example/at. Examples of implementing user-defined AT commands are provided in /ESP8266_NONOS_SDK/ examples/at/user/user_main.c. The structure, at_funcationType, is used to define four types of a command, for details of which please refer to the following table. Definition Type AT Command Description AT+TEST=? at_testCmd Test Registered Callback In Example at_testCmdTest Function Design Return the value range of parameters If at_testCmd is registered as NULL, there will be no testing command. AT Command AT+TEST? at_queryCmd Query Registered Callback In Example at_queryCmdTest Function Design Return the current value If at_queryCmd is registered as NULL, there will be no Query Command. AT Command AT+TEST=parameter1, parameter2, … at_setupCmd Set Registered Callback In Example at_setupCmdTest Function Design Set configuration If at_setupCmd is registered as NULL, there will be no setup command. AT Command AT+TEST at_exeCmd Execute Registered Callback In Example at_exeCmdTest Function Design Execute an action If at_exeCmd is registered as NULL, there will be no execution command. 1.2. Downloading AT Firmware into the Flash Please refer to ESP8266_NONOS_SDK/bin/at/readme.txt for instructions on how to download AT firmware into flash. Please use Espressif’s official Flash Download Tools to download the firmware. Make sure you select the corresponding flash size. Espressif’s official Flash Download Tools:
 http://espressif.com/en/support/download/other-tools?keys=&field_type_tid%5B%5D=14. Since ESP8266_NONOS_SDK_V3.0.0, AT_V1.7, limited by the size of the AT bin files, only 1024 KB +1024 KB flash map is supported by default. Espressif ! /!2 62 2019.06 !
分享到:
收藏