Espressif Systems ESP32 Series Setup guide

ESP32
AT Instruction Set and Examples
Version 1.3
Espressif Systems
Copyright © 2019

About This Guide
This document introduces the ESP32 AT commands, explains how to use them and
provides examples of several common AT commands.
Release Notes
Documentation Change Notification
Espressif provides email notifications to keep customers updated on changes to
technical documentation. Please subscribe at https://www.espressif.com/en/subscribe.
Certification
Download certificates for Espressif products from https://www.espressif.com/en/
certificates.
Date
Version
Release notes
2017.11
V1.0
Initial release.
2018.06
V1.1
Updated Section 4.2.15,5.2.8,5.2.15,6.2.5,
6.2.11 and Chapter 8.
Added Section 5.2.9,6.2.29,6.2.30,9.5.2.2.
2018.12
V1.2
Update Chapter 1 and Section 5.2.3.
2019.06
V1.3
Corrected a typo in Section 4.2.3.

Table of Contents
1. Overview 1................................................................................................................................
1.1. User-Defined AT Commands!1".....................................................................................................
1.2. Downloading AT Firmware into Flash!1".........................................................................................
2. Command Description 3..........................................................................................................
3. Basic AT Commands 4.............................................................................................................
3.1. Overview!4"....................................................................................................................................
3.2. Commands!4".................................................................................................................................
3.2.1. AT—Tests AT Startup!4"..................................................................................................................
3.2.2. AT+RST—Restarts the Module!4"..................................................................................................
3.2.3. AT+GMR—Checks Version Information!5"....................................................................................
3.2.4. AT+GSLP—Enters Deep-sleep Mode!5".......................................................................................
3.2.5. ATE—AT Commands Echoing!5"....................................................................................................
3.2.6. AT+RESTORE—Restores the Factory Default Settings!5"...........................................................
3.2.7. AT+UART_CUR—Current UART Configuration, Not Saved in Flash!6"......................................
3.2.8. AT+UART_DEF—Default UART Configuration, Saved in Flash!7"...............................................
3.2.9. AT+SLEEP—Sets the Sleep Mode!8"............................................................................................
3.2.10. AT+SYSRAM—Checks the Remaining Space of RAM!8"............................................................
3.2.11. AT+SYSFLASH—Set User Partitions in Flash *!8"........................................................................
3.2.12. AT+FS—Filesystem Operations *!9"...............................................................................................
3.2.13. AT+RFPOWER—Set RF TX Power *!11".......................................................................................
4. Wi-Fi AT Commands 12............................................................................................................
4.1. Overview!12"..................................................................................................................................
4.2. Commands!12"...............................................................................................................................
4.2.1. AT+CWMODE—Sets the Wi-Fi Mode (Station/SoftAP/Station+SoftAP)!12"..............................
4.2.2. AT+CWJAP—Connects to an AP!14"............................................................................................
4.2.3. AT+CWLAPOPT—Sets the Configuration for the Command AT+CWLAP!15"...........................
4.2.4. AT+CWLAP—Lists the Available APs!16"......................................................................................
4.2.5. AT+CWQAP—Disconnects from the AP!16".................................................................................
4.2.6. AT+CWSAP—Configuration of the ESP32 SoftAP!17".................................................................
4.2.7. AT+CWLIF—IP of Stations to Which the ESP32 SoftAP is Connected!18"................................
4.2.8. AT+CWDHCP—Enables/Disables DHCP!18"...............................................................................

4.2.9. AT+CWDHCPS—Sets the IP Address Allocated by ESP32 SoftAP DHCP (The
configuration is saved in Flash.)!19".................................................................................................................
4.2.10. AT+CWAUTOCONN—Auto-Connects to the AP or Not!19"........................................................
4.2.11. AT+CWSTARTSMART—Starts SmartConfig!20"..........................................................................
4.2.12. AT+CWSTOPSMART—Stops SmartConfig!20"............................................................................
4.2.13. AT+WPS—Enables the WPS Function!21"....................................................................................
4.2.14. AT+CWHOSTNAME—Configures the Host Name of ESP32 Station *!21".................................
4.2.15. AT+MDNS—Configures the MDNS Function *!21".......................................................................
5. TCP/IP-Related AT Commands 23..........................................................................................
5.1. Overview!23"..................................................................................................................................
5.2. Commands!24"...............................................................................................................................
5.2.1. AT+CIPSTATUS—Gets the Connection Status!24".......................................................................
5.2.2. AT+CIPDOMAIN—DNS Function!24"............................................................................................
5.2.3. AT+CIPDNS—Sets User-defined DNS Servers; Configuration Saved in the Flash!24".............
5.2.4. AT+CIPSTAMAC—Sets the MAC Address of the ESP32 Station!25".........................................
5.2.5. AT+CIPAPMAC—Sets the MAC Address of the ESP32 SoftAP!25"...........................................
5.2.6. AT+CIPSTA—Sets the IP Address of the ESP32 Station!26".......................................................
5.2.7. AT+CIPAP—Sets the IP Address of the ESP32 SoftAP!26".........................................................
5.2.8. AT+CIPSTART—Establishes TCP Connection, UDP Transmission or SSL Connection!27".....
5.2.9. AT+CIPSSLCCONF—Set Configuration of SSL Client *!29"........................................................
5.2.10. AT+CIPSEND—Sends Data!30".....................................................................................................
5.2.11. AT+CIPSENDEX—Sends Data!31".................................................................................................
5.2.12. AT+CIPCLOSE—Closes TCP/UDP/SSL Connection!31"............................................................
5.2.13. AT+CIFSR—Gets the Local IP Address!32"...................................................................................
5.2.14. AT+CIPMUX—Enables/Disables Multiple Connections!32".........................................................
5.2.15. AT+CIPSERVER—Deletes/Creates TCP or SSL Server *!33"......................................................
5.2.16. AT+CIPSERVERMAXCONN—Set the Maximum Connections Allowed by Server *!33"...........
5.2.17. AT+CIPMODE—Configures the Transmission Mode!34".............................................................
5.2.18. AT+SAVETRANSLINK—Saves the Transparent Transmission Link in Flash!35"........................
5.2.19. AT+CIPSTO—Sets the TCP Server Timeout!36"...........................................................................
5.2.20. AT+CIPSNTPCFG—Sets the Time Zone and the SNTP Server!37"............................................
5.2.21. AT+CIPSNTPTIME—Queries the SNTP Time!37".........................................................................
5.2.22. AT+CIUPDATE—Updates the Software Through Wi-Fi!37".........................................................
5.2.23. AT+CIPDINFO—Shows the Remote IP and Port with "+IPD"!38"...............................................
5.2.24. +IPD—Receives Network Data!38"................................................................................................

5.2.25. AT+PING—Ping Packets!39"..........................................................................................................
6. BLE-Related AT Commands 40...............................................................................................
6.1. Overview!40"..................................................................................................................................
6.2. Commands!42"...............................................................................................................................
6.2.1. AT+BLEINIT—BLE Initialization!42"................................................................................................
6.2.2. AT+BLEADDR—Sets BLE Device's Address!42"..........................................................................
6.2.3. AT+BLENAME—Sets BLE Device's Name!43".............................................................................
6.2.4. AT+BLESCANPARAM—Sets Parameters of BLE Scanning!43".................................................
6.2.5. AT+BLESCAN—Enables BLE Scanning!44".................................................................................
6.2.6. AT+BLESCANRSPDATA—Sets BLE Scan Response!45"............................................................
6.2.7. AT+BLEADVPARAM—Sets Parameters of Advertising!46"..........................................................
6.2.8. AT+BLEADVDATA—Sets Advertising Data!47".............................................................................
6.2.9. AT+BLEADVSTART—Starts Advertising!47"..................................................................................
6.2.10. AT+BLEADVSTOP—Stops Advertising!47"...................................................................................
6.2.11. AT+BLECONN—Establishes BLE connection!48"........................................................................
6.2.12. AT+BLECONNPARAM—Updates parameters of BLE connection!48".......................................
6.2.13. AT+BLEDISCONN—Ends BLE connection!49"............................................................................
6.2.14. AT+BLEDATALEN—Sets BLE Data Packet Length!49"................................................................
6.2.15. AT+BLECFGMTU—Sets GATT MTU Length!50"..........................................................................
6.2.16. AT+BLEGATTSSRVCRE—GATTS Creates Services!50"..............................................................
6.2.17. AT+BLEGATTSSRVSTART—GATTS Starts Services!51".............................................................
6.2.18. AT+BLEGATTSSRVSTOP—GATTS Stops Services!51"...............................................................
6.2.19. AT+BLEGATTSSRV—GATTS Discovers Services!51"..................................................................
6.2.20. AT+BLEGATTSCHAR—GATTS Discovers Characteristics!52"....................................................
6.2.21. AT+BLEGATTSNTFY—GATTS Notifies of Characteristics!52".....................................................
6.2.22. AT+BLEGATTSIND—GATTS Indicates Characteristics!53"..........................................................
6.2.23. AT+BLEGATTSSETATTR—GATTS Sets Characteristic!54"..........................................................
6.2.24. AT+BLEGATTCPRIMSRV—GATTC Discovers Primary Services!55"..........................................
6.2.25. AT+BLEGATTCINCLSRV—GATTC Discovers Included Services!55".........................................
6.2.26. AT+BLEGATTCCHAR—GATTC Discovers Characteristics!56"...................................................
6.2.27. AT+BLEGATTCRD—GATTC Reads a Characteristic!56".............................................................
6.2.28. AT+BLEGATTCWR—GATTC Writes Characteristic!57"................................................................
6.2.29. AT+BLESPPCFG—Configures BLE SPP!58"................................................................................
6.2.30. AT+BLESPP—Enables BLE SPP!60".............................................................................................

6.2.31. AT+BLESECPARAM—Set Parameters of BLE SMP!61"..............................................................
6.2.32. AT+BLEENC—Starts a Pairing Request!62"..................................................................................
6.2.33. AT+BLEENCRSP—Sets a Pairing Response!63"..........................................................................
6.2.34. AT+BLEKEYREPLY—Reply to a Pairing Key!63"..........................................................................
6.2.35. AT+BLECONFREPLY—Reply to a Pairing Result!63"...................................................................
6.2.36. AT+BLEENCDEV—Lists All Devices that Bonded!64"..................................................................
6.2.37. AT+BLEENCCLEAR—Unbind Device!64".....................................................................................
7. AT Commands with Configuration Saved in the NVS Area 65................................................
8. AT Messages 66........................................................................................................................
9. AT Commands Examples 67....................................................................................................
9.1. ESP32 as a TCP Client in Single Connection!67"..........................................................................
9.2. UDP Transmission!68"....................................................................................................................
9.2.1. UDP (with Fixed Remote IP and Port)!68"......................................................................................
9.2.2. UDP (with Changeable Remote IP and Port)!69"..........................................................................
9.3. Transparent Transmission!70"........................................................................................................
9.3.1. ESP32 as a TCP Client in UART-Wi-Fi Passthrough (Single Connection Mode)!71"..................
9.3.2. UDP Transmission (UART-Wi-Fi PassthroughTransmission)!72"..................................................
9.4. ESP32 as a TCP Server in Multiple Connections!74"....................................................................
9.5. BLE AT Examples !76"....................................................................................................................
9.5.1. iBeacon Examples!76".....................................................................................................................
9.5.2. BLE Communication Examples!78"...............................................................................................
10.OTA Update 90.........................................................................................................................
11.Q & A 96....................................................................................................................................

!
1. Overview
1. Overview
This document introduces the ESP32 AT commands, and explains how to use them.
The AT command set is divided into different categories: Basic AT commands, Wi-Fi AT
commands, TCP/IP AT commands, etc.
Please note that the AT commands marked with * are beta versions that have not been fully
tested.
1.1. User-Defined AT Commands
Please use only English letters or an underscore (_), when naming user-defined AT
commands. The AT command name must NOT contain characters or numbers.
AT firmware is based on the Espressif IoT Development Framework (ESP-IDF). Espressif
Systems' AT commands are provided in libat_core.a, which is included in the AT BIN
firmware. Examples of customized, user-defined AT commands are provided in esp-at.
The structure, at_cmd_struct, is used to define four types of a command. Examples of
implementing user-defined AT commands are provided in /esp32-at/main/interface/uart/
at_uart_task.c.
1.2. Downloading 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=13.
Download ESP32_AT_BIN: http://www.espressif.com/en/support/download/at.
The flashing addresses are in /ESP32_AT_BIN/download.config.
Please note that there are several binaries for some specific functions, they are listed as
below:
•at_customize.bin is to provide a user partition table, which lists different partitions for
the ble_data.bin, SSL certificates, and factory_param_XXX.bin.Furthermore, users
can add their own users partitions, and read/write the user partitions with the
command AT+FS and AT+SYSFLASH.
•factory_param_XXX.bin indicates the hardware configurations for different ESP
modules. Please make sure the correct bin is used for your specific module. If users
design their own module, they can configure it with reference to the esp32-at/docs/
ESP32_AT_Factory_Parameter_Bin.md, and the binaries will be automatically
📖Note:
For codes related to ESP32 AT instruction set, please refer to https://github.com/espressif/esp32-at.
Espressif
!/!1 97
2019.06

!
1. Overview
generated after compilation. When users flash the firmware into the module, the
customized_partitions/factory_param.bin in the download.config should be
replaced with the actual module-specific customized_partitions/
factory_param_XXX.bin.
•ble_data.bin is to provide BLE services when the ESP32 works as a BLE server;
•server_cert.bin, server_key.bin and server_ca.bin are examples of SSL server‘s
certificate;
If some of the functions are not used, then the corresponding binaries need not to be
downloaded into flash.
If all functions are needed, then those binaries have to be downloaded into flash. In this
case, there is a CombineBin button on the ESP Flash Download Tool to combine multiple
binaries into one, to make the downloading easier. Please note that the downloading
addresses of binaries and other flash configurations have to be set correctly while
combining.
If users compile esp32-at by themselves, they can call command 'makeprint_flash_cmd'
and print the download addresses, following the steps below:
•Call rmsdkconfig to remove the old configuration.
•Call makedefconfig to set the latest default configuration.
•Call make print_flash_cmd to print the download addresses."
Modules
UART Pins(TX, RX, CTS, RTS)
Bin
ESP32-WROOM-32 Series
(Default Value)
GPIO17, GPIO16, GPIO15, GPIO14
customized_partitions/
factory_param_WROOM-32.bin
ESP32-WROVER Series
GPIO22, GPIO19, GPIO15, GPIO14
customized_partitions/
factory_param_WROVER-32.bin
ESP32-PICO Series
GPIO22, GPIO19, GPIO15, GPIO14
customized_partitions/
factory_param_PICO-D4.bin
ESP32-SOLO Series
GPIO17, GPIO16, GPIO15, GPIO14
customized_partitions/
factory_param_SOLO-1.bin
📖Note:
UART CTS and RTS are optional pins, not compulsive.
📖Note:
• If the ESP32-AT bin fails to boot, and prints log "ota data partition invalid", please erase all flash or
download the blank.bin into the address labeled as "otadata" in esp32-at/partitions_at.csv.
• Users can change to use another UART for AT communication. For example, if you want to use
UART0 for AT communication, you need to:
- make menuconfig -> component config -> AT -> "AT UART settings" to set it to use UART 0
- The debug log will output through UART0 by default, but users can disable it in menuconfig, as:
make menuconfig --> Component config --> ESP32-specific --> UART for console output
• ESP32_AT_Bin/factory stores the ESP AT factory binaries for different ESP official modules.
Espressif
!/!2 97
2019.06

!
2. Command Description
2. Command Description
Each command set contains four types of AT commands.
Type
Command Format
Description
Test Command
AT+<x>=?
Queries the Set Commands' internal
parameters and their range of values.
Query Command
AT+<x>?
Returns the current value of parameters.
Set Command
AT+<x>=<…>
Sets the value of user-defined parameters in
commands, and runs these commands.
Execute Command
AT+<x>
Runs commands with no user-defined
parameters.
⚠Notice:
•Not all AT commands support all four variations mentioned above.
•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.
•The default baud rate of AT command is 115200.
•AT commands are ended with a new-line (CR-LF), so the serial tool should be set into "New Line
Mode".
•Definitions of AT command error codes are in esp32-at/components/at/include/esp_at.h.
Espressif
!/!3 97
2019.06

!
3. Basic AT Commands
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
Commands
Description
AT
Tests AT startup.
AT+RST
Restarts a module.
AT+GMR
Checks version information.
AT+GSLP
Enters Deep-sleep mode.
ATE
Configures echoing of AT commands.
AT+RESTORE
Restores the factory default settings of the module.
AT+UART_CUR
Current UART configuration.
AT+UART_DEF
Default UART configuration, saved in flash.
AT+SLEEP
Sets the sleep mode.
AT+SYSRAM
Checks the remaining space of RAM.
AT+SYSFLASH
Sets user partitions in flash
AT+SYSFS
File systems operations
AT+RFPOWER
Sets RF TX power
Execute Command
AT
Response
OK
Parameters
-
Execute Command
AT+RST
Response
OK
Parameters
-
Espressif
!/!4 97
2019.06

!
3. Basic AT Commands
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
Note
When the command is capitalized, it can be used to force restart.
When system is in a "busy" state, user can call "AT+RST" to force restart. The
system will prompt message "will force to restart!!!" before restarts.
Execute Command
AT+GMR
Response
<ATversioninfo>
<SDKversioninfo>
<compiletime>
OK
Parameters
•<ATversioninfo>:information about the AT version.
•<SDKversioninfo>:information about the SDK version.
•<compiletime>: the duration of time for compiling the BIN.
Set Command
AT+GSLP=<time>
Response
<time>
OK
Parameters
<time>: the duration of ESP32's sleep. Unit: ms.
ESP32 will wake up after Deep-sleep for as many milliseconds (ms) as <time>
indicates.
Execute Command
ATE
Response
OK
Parameters
•ATE0: Switches echo off.
•ATE1: Switches echo on.
Execute Command
AT+RESTORE
Response
OK
Espressif
!/!5 97
2019.06

!
3. Basic AT Commands
3.2.7. AT+UART_CUR—Current UART Configuration, Not Saved in Flash
Note
The execution of this command will reset all parameters saved in flash, and
restore the factory default settings of the module. The chip will be restarted when
this command is executed.
Command
Query Command:
AT+UART_CUR?
Set Command:
AT+UART_CUR=<baudrate>,<databits>,<stop
bits>,<parity>,<flowcontrol>
Response
+UART_CUR:<baudrate>,<databits>,<stopbi
ts>,<parity>,<flowcontrol>
OK
Command AT+UART_CUR? will return the
actual value of UART configuration
parameters, which may have allowable errors
compared with the set value because of the
clock division.
OK
Parameters
•<baudrate>: UART baud rate
•<databits>: data bits
‣5: 5-bit data
‣6: 6-bit data
‣7: 7-bit data
‣8: 8-bit data
•<stopbits>: stop bits
‣1: 1-bit stop bit
‣2: 1.5-bit stop bit
‣3: 2-bit stop bit
•<parity>: parity bit
‣0: None
‣1: Odd
‣2: Even
•<flowcontrol>: flow control
‣0: flow control is not enabled
‣1: enable RTS
‣2: enable CTS
‣3: enable both RTS and CTS
Notes
1. The configuration changes will NOT be saved in flash.
2. The use of flow control requires the support of hardware:
‣IO15 is UART0 CTS
‣IO14 is UART0 RTS
3. The range of baud rates supported: 80 ~ 5000000.
Example
AT+UART_CUR=115200,8,1,0,3
Espressif
!/!6 97
2019.06

!
3. Basic AT Commands
3.2.8. AT+UART_DEF—Default UART Configuration, Saved in Flash
Command
Query Command:
AT+UART_DEF?
Function:
Read the UART configuration from flash.
Set Command:
AT+UART_DEF=<baudrate>,<databits>,<stop
bits>,<parity>,<flowcontrol>
Response
+UART_DEF:<baudrate>,<databits>,<stopbi
ts>,<parity>,<flowcontrol>
OK
OK
Parameters
•<baudrate>: UART baud rate
•<databits>: data bits
‣5: 5-bit data
‣6: 6-bit data
‣7: 7-bit data
‣8: 8-bit data
•<stopbits>: stop bits
‣1: 1-bit stop bit
‣2: 1.5-bit stop bit
‣3: 2-bit stop bit
•<parity>: parity bit
‣0: None
‣1: Odd
‣2: Even
•<flowcontrol>: flow control
‣0: flow control is not enabled
‣1: enable RTS
‣2: enable CTS
‣3: enable both RTS and CTS
Notes
1. The configuration changes will be saved in the NVS area, and will still be valid when the
chip is powered on again.
2. The use of flow control requires the support of hardware:
‣IO15 is UART0 CTS
‣IO14 is UART0 RTS
3. The range of baud rates supported: 80 ~ 5000000.
Example
AT+UART_DEF=115200,8,1,0,3
Espressif
!/!7 97
2019.06

!
3. Basic AT Commands
3.2.9. AT+SLEEP—Sets the Sleep Mode
3.2.10. AT+SYSRAM—Checks the Remaining Space of RAM
3.2.11. AT+SYSFLASH—Set User Partitions in Flash *
Set Command
AT+SLEEP=<sleepmode>
Response
OK
Parameters
<sleepmode>:
‣0: disable the sleep mode.
‣1: Modem-sleep mode.
Example
AT+SLEEP=0
Query Command
AT+SYSRAM?
Response
+SYSRAM:<remainingRAMsize>
OK
Parameters
<remainingRAMsize>: remaining space of RAM, unit: byte
Example
AT+SYSRAM?
+SYSRAM:148408
OK
Command
Query Command:
AT+SYSFLASH?
Function:
Check the user partitions in flash.
Set Command:
AT+SYSFLASH=<operation>,<partition>,<of
fset>,<length>
Response
+SYSFLASH:<partition>,<type>,<subtype>,
<addr>,<size>
OK
+SYSFLASH:<length>,<data>
OK
Parameters
<partition>: name of user partition
<type>: type of user partition
<subtype>: subtype of user partition
<addr>: address of user partition
<size>: size of user partition
<operation>:
‣0: erase sector
‣1: write data into the user partition
‣2: read data from the user partition
<partition>: name of user partition
<offset>: offset of user partition
<length>: data length
Espressif
!/!8 97
2019.06

!
3. Basic AT Commands
3.2.12. AT+FS—Filesystem Operations *
Notes
•at_customize.bin has to be downloaded, so that the relevant commands can be used. For
more details about at_customize.bin please refer to the ESP32_Customize_Partitions.
•Important things to note when erasing user partitions:
‣When erasing the targeted user partition in its entirety, parameters <offset> and
<length> can be omitted. For example, command AT+SYSFLASH=0,"ble_data" can
erase the entire "ble_data" user partition.
‣If parameters <offset> and <length> are not omitted when erasing the user partition,
they have to be 4KB-aligned.
•The introduction to partitions is in ESP-IDF Partition Tables.
Example
// read 100 bytes from the "ble_data" partition offset 0.
AT+SYSFLASH=2,"ble_data",0,100
// write 10 bytes to the "ble_data" partition offset 100.
AT+SYSFLASH=1,"ble_data",100,10
// erase 8192 bytes from the "ble_data" partition offset 4096.
AT+SYSFLASH=0,"ble_data",4096,8192
Command
Set Command:
AT+FS=<type>,<operation>,<filename>,<offset>,<length>
Response
OK
Parameters
<type>: only FATFS is currently supported
‣0: FATFS
<operation>:
‣0: delete file
‣1: write file
‣2: read file
‣3: query the size of the file
‣4: list files in a specific directory, only root directory is currently supported
<offset>: offset, for writing and reading operations only
<length>: data length, for writing and reading operations only
Notes
•This function is disabled by default. User needs to set configuration by "make
menuconfig" to enable it, and re-compile the ESP32 AT firmware.
•at_customize.bin has to be downloaded, so that the relevant commands can be used.
The definitions of user partitions are in esp32-at/at_customize.csv. Please refer to the
ESP32_Customize_Partitions for more details.
Espressif
!/!9 97
2019.06

!
3. Basic AT Commands
Example
// delete a file.
AT+FS=0,0,"filename"
// write 10 bytes to offset 100 of a file.
AT+FS=0,1,"filename",100,10
// read 100 bytes from offset 0 of a file.
AT+FS=0,2,"filename",0,100
// list all files in the root directory.
AT+FS=0,4,"."
Espressif
!/!10 97
2019.06

!
3. Basic AT Commands
3.2.13. AT+RFPOWER—Set RF TX Power *
Command
Set Command:
AT+RFPOWER=<wifi_power>[,<ble_adv_power>,<ble_scan_power>,<ble_conn_power>]
Response
OK
Parameters
<wifi_power>: range [0, 11]
‣0:level 0. Refer to the 44th byte of phy_init_data.bin, the default value is 19.5 dBm
‣1:level 1. Refer to the 45th byte of phy_init_data.bin, the default value is 19 dBm
‣2:level 2. Refer to the 46th byte of phy_init_data.bin, the default value is 18.5 dBm
‣3:level 3. Refer to the 47th byte of phy_init_data.bin, the default value is 17 dBm
‣4:level 4. Refer to the 48th byte of phy_init_data.bin, the default value is 15 dBm
‣5:level 5. Refer to the 49th byte of phy_init_data.bin, the default value is 13 dBm
‣6:level 5 - 2 dBm. For example, if level 5 is 13 dBm, level 6 will be 11 dBm
‣7:level 5 - 4.5 dBm
‣8:level 5 - 6 dBm
‣9:level 5 - 8 dBm
‣10:level 5 - 11 dBm
‣11:level 5 - 14 dBm
<ble_adv_power>:RF TX Power of BLE advertising, range: [0, 7]
‣0:7dBm
‣1:4dBm
‣2:1dBm
‣3:-2 dBm
‣4:-5 dBm
‣5:-8 dBm
‣6:-11 dBm
‣7:-14 dBm
<ble_scan_power>: RF TX Power of BLE scanning, range: [0, 7], the same as
<ble_adv_power>
<ble_conn_power>: RF TX Power of BLE connecting, range: [0, 7], the same as
<ble_adv_power>
Notes
•The RF TX power may not be very precise, it is normal that the actual RF TX power is
different from the setting value.
•The last three parameters,[<ble_adv_power>,<ble_scan_power>,<ble_conn_power>],
should be set or be omitted altogether.
Example
AT+RFPOWER=0
Or
AT+RFPOWER=0,0,0,0
Espressif
!/!11 97
2019.06

!
4. Wi-Fi AT Commands
4. Wi-Fi AT Commands
4.1. Overview
4.2. Commands
4.2.1. AT+CWMODE—Sets the Wi-Fi Mode (Station/SoftAP/Station+SoftAP)
Commands
Description
AT+CWMODE
Sets the Wi-Fi mode (STA/AP/STA+AP).
AT+CWJAP
Connects to an AP.
AT+CWLAPOPT
Sets the configuration of command AT+CWLAP.
AT+CWLAP
Lists available APs.
AT+CWQAP
Disconnects from the AP.
AT+CWSAP
Sets the configuration of the ESP32 SoftAP.
AT+CWLIF
Gets the Station IP to which the ESP32 SoftAP is connected.
AT+CWDHCP
Enables/disables DHCP.
AT+CWDHCPS
Sets the IP range of the ESP32 SoftAP DHCP server.
Saves the setting in flash.
AT+CWAUTOCONN
Connects to the AP automatically on power-up.
AT+CWSTARTSMART
Starts SmartConfig.
AT+CWSTOPSMART
Stops SmartConfig.
AT+WPS
Enables the WPS function.
AT+CWHOSTNAME
Configure the host name of ESP32 station.
AT+MDNS
MDNS function
Comman
ds
Test Command:
AT+CWMODE=?
Query Command:
AT+CWMODE?
Function: to query the Wi-Fi
mode of ESP32.
Set Command:
AT+CWMODE=<mode>
Function: to set the Wi-Fi mode
of ESP32.
Response
+CWMODE:<mode>
OK
+CWMODE:<mode>
OK
OK
Espressif
!/!12 97
2019.06

!
4. Wi-Fi AT Commands
Paramete
rs
<mode>:
‣0: Null mode, Wi-Fi RF will be disabled *
‣1: Station mode
‣2: SoftAP mode
‣3: SoftAP+Station mode
Note
The configuration changes will be saved in the NVS area.
Example
AT+CWMODE=3
Espressif
!/!13 97
2019.06

!
4. Wi-Fi AT Commands
4.2.2. AT+CWJAP—Connects to an AP
Commands
Query Command:
AT+CWJAP?
Function: to query the AP to which the
ESP32 Station is already connected.
Set Command:
AT+CWJAP=<ssid>,<pwd>[,<bssid>]
Function: to set the AP to which the ESP32
Station needs to be connected.
Response
+CWJAP:<ssid>,<bssid>,<channel>,<rss
i>
OK
OK
or
+CWJAP:<errorcode>
ERROR
Parameters
•<ssid>:a string parameter showing
the SSID of the AP.
•<bssid>: the AP's MAC address.
•<channel>: channel
•<rssi>: signal strength
•<ssid>: the SSID of the target AP.
•<pwd>: password, MAX: 64-byte ASCII.
•[<bssid>](optional parameter): the target
AP's MAC address, used when multiple APs
have the same SSID.
•<errorcode>: (for reference only)
‣1: connection timeout.
‣2: wrong password.
‣3: cannot find the target AP.
‣4: connection failed.
‣others: unknown error occurred.
Escape character syntax is needed if SSID or
password contains any special characters, such
as, or " or \.
Messages
// If ESP32 station connects to an AP, it will prompt messages:
WIFI CONNECTED
WIFI GOT IP
// If the WiFi connection ends, it will prompt messages:
WIFI DISCONNECT
Note
•The configuration changes will be saved in the NVS area.
•This command requires Station mode to be active.
Examples
AT+CWJAP="abc","0123456789"
For example, if the target AP's SSID is "ab\,c" and the password is "0123456789"\", the
command isas follows:
AT+CWJAP="ab\\\,c","0123456789\"\\"
If multiple APs have the same SSID as "abc", the target AP can be found by BSSID:
AT+CWJAP="abc","0123456789","ca:d7:19:d8:a6:44"
Espressif
!/!14 97
2019.06
Other manuals for ESP32 Series
6
Table of contents
Other Espressif Systems Single Board Computer manuals
Popular Single Board Computer manuals by other brands

Solectron
Solectron Force Computers Alpha VME 5/352 installation guide

Kontron
Kontron 3.5"-SBC-VR1000 user guide

Asus
Asus Aaeon UP-CORE Quick installation guide

Sun Microsystems
Sun Microsystems Netra CP3010 Programming guide

GATEWORKS
GATEWORKS Venice GW7300 operating manual

Lex
Lex PowerGATE 400A user manual