Esp32 Instruction Set en
Esp32 Instruction Set en
Esp32 Instruction Set en
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
Certification
Download certificates for Espressif products from https://www.espressif.com/en/
certificates.
Table of Contents
1. Overview ................................................................................................................................ 1
1.1. User-Defined AT Commands .....................................................................................................1
5.2.3. AT+CIPDNS—Sets User-defined DNS Servers; Configuration Saved in the Flash .............24
5.2.20. AT+CIPSNTPCFG—Sets the Time Zone and the SNTP Server ............................................37
9.3.1. ESP32 as a TCP Client in UART-Wi-Fi Passthrough (Single Connection Mode) ..................71
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.
📖 Note:
Espressif ! /!97
1 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.
customized_partitions/
ESP32-WROVER Series GPIO22, GPIO19, GPIO15, GPIO14
factory_param_WROVER-32.bin
customized_partitions/
ESP32-PICO Series GPIO22, GPIO19, GPIO15, GPIO14
factory_param_PICO-D4.bin
customized_partitions/
ESP32-SOLO Series GPIO17, GPIO16, GPIO15, GPIO14
factory_param_SOLO-1.bin
📖 Note:
• ble_data.bin is to provide BLE services when the ESP32 works as a BLE server;
📖 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.
If users compile esp32-at by themselves, they can call command 'make print_flash_cmd'
and print the download addresses, following the steps below:
• Call rm sdkconfig to remove the old configuration.
• Call make defconfig to set the latest default configuration.
• Call make print_flash_cmd to print the download addresses.
Espressif ! /!97
2 2019.06
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.
• AT commands are ended with a new-line (CR-LF), so the serial tool should be set into "New Line
Mode".
Espressif ! /!97
3 2019.06
3. Basic AT Commands
!
3. Basic AT Commands
3.1. Overview
Commands Description
AT Tests AT startup.
3.2. Commands
3.2.1. AT—Tests AT Startup
Execute Command AT
Response OK
Parameters -
Response OK
Parameters -
Espressif ! /!97
4 2019.06
3. Basic AT Commands
!
OK
<time>
Response
OK
Response OK
Response OK
Espressif ! /!97
5 2019.06
3. Basic AT Commands
!
The execution of this command will reset all parameters saved in flash, and
Note restore the 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>,<stopbi
ts>,<parity>,<flow control>
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
Example AT+UART_CUR=115200,8,1,0,3
Espressif ! /!97
6 2019.06
3. Basic AT Commands
!
Query Command:
Set Command:
AT+UART_DEF?
Command AT+UART_DEF=<baudrate>,<databits>,<stop
Function:
bits>,<parity>,<flow control>
Read the UART configuration from flash.
+UART_DEF:<baudrate>,<databits>,<stopbi
Response ts>,<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 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:
Notes
‣ 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 ! /!97
7 2019.06
3. Basic AT Commands
!
Response OK
<sleep mode>:
Parameters
‣ 0: disable the sleep mode.
‣ 1: Modem-sleep mode.
Example AT+SLEEP=0
AT+SYSRAM?
Example +SYSRAM:148408
OK
Query Command:
Set Command:
AT+SYSFLASH?
Command
AT+SYSFLASH=<operation>,<partition>,<of
Function:
fset>,<length>
Check the user partitions in flash.
+SYSFLASH:<partition>,<type>,<subtype>,
+SYSFLASH:<length>,<data>
Response <addr>,<size>
OK
OK
<operation>:
<partition>: name of user partition
‣ 0: erase sector
<type>: type of user partition ‣ 1: write data into the user partition
‣ 2: read data from the user partition
Parameters <subtype>: subtype of user partition
<partition>: name of user partition
<addr>: address of user partition
<offset>: offset of user partition
<size>: size of user partition
<length>: data length
Espressif ! /!97
8 2019.06
3. Basic AT Commands
!
• 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
Notes <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
AT+SYSFLASH=1,"ble_data",100,10
AT+SYSFLASH=0,"ble_data",4096,8192
Set Command:
Command
AT+FS=<type>,<operation>,<filename>,<offset>,<length>
Response OK
Espressif ! /!97
9 2019.06
3. Basic AT Commands
!
// delete a file.
AT+FS=0,0,"filename"
AT+FS=0,1,"filename",100,10
Example
// read 100 bytes from offset 0 of a file.
AT+FS=0,2,"filename",0,100
AT+FS=0,4,"."
Espressif ! /! 97
10 2019.06
3. Basic AT Commands
!
Set Command:
Command
AT+RFPOWER=<wifi_power>[,<ble_adv_power>,<ble_scan_power>,<ble_conn_power>]
Response OK
• The RF TX power may not be very precise, it is normal that the actual RF TX power is
different from the setting value.
Notes
• The last three parameters,[<ble_adv_power>,<ble_scan_power>,<ble_conn_power>],
should be set or be omitted altogether.
AT+RFPOWER=0
Example Or
AT+RFPOWER=0,0,0,0
Espressif ! /! 97
11 2019.06
4. Wi-Fi AT Commands
!
4. Wi-Fi AT Commands
4.1. Overview
Commands Description
4.2. Commands
4.2.1. AT+CWMODE—Sets the Wi-Fi Mode (Station/SoftAP/Station+SoftAP)
ds AT+CWMODE=? Function: to query the Wi-Fi Function: to set the Wi-Fi mode
mode of ESP32. of ESP32.
+CWMODE:<mode> +CWMODE:<mode>
Response OK
OK OK
Espressif ! /! 97
12 2019.06
4. Wi-Fi AT Commands
!
<mode>:
Example AT+CWMODE=3
Espressif ! /! 97
13 2019.06
4. Wi-Fi AT Commands
!
4.2.2. AT+CWJAP—Connects to an AP
OK
+CWJAP:<ssid>,<bssid>,<channel>,<rss
or
Response i>
+CWJAP:<error code>
OK
ERROR
WIFI CONNECTED
Messages WIFI GOT IP
WIFI DISCONNECT
AT+CWJAP="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="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 ! /! 97
14 2019.06
4. Wi-Fi AT Commands
!
Response OK
AT+CWLAPOPT=1,31
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 31, namely 0x1F, meaning that the corresponding bits of <mask>
are set to 1. All parameters will be shown in the result of AT+CWLAP.
Espressif ! /! 97
15 2019.06
4. Wi-Fi AT Commands
!
Set Command:
Execute Command:
AT+CWLAP=<ssid>[,<mac>,<channel>]
Commands AT+CWLAP
+CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<chann +CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<chann
Response el>
el>
OK OK
‣ 0: OPEN
‣ 1: WEP
‣ 2: WPA_PSK
‣ 3: WPA2_PSK
Parameters ‣ 4: WPA_WPA2_PSK
‣ 5: WPA2_Enterprise (AT can NOT connect to WPA2_Enterprise AP for now.)
• <ssid>: string parameter, SSID of the AP.
AT+CWLAP="Wi-Fi","ca:d7:19:d8:a6:44",6
AT+CWLAP="Wi-Fi"
Response OK
Parameters -
Espressif ! /! 97
16 2019.06
4. Wi-Fi AT Commands
!
Set Command:
Query Command:
AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>[
AT+CWSAP?
+CWSAP:<ssid>,<pwd>,<channel>,<ecn>,<max
Response conn>,<ssid hidden>
OK
OK
Example AT+CWSAP="ESP32","1234567890",5,3
Espressif ! /! 97
17 2019.06
4. Wi-Fi AT Commands
!
Execute
AT+CWLIF
Command
+CWLIF:<ip addr>,<mac>
Response
OK
Note This command cannot get a static IP. It only works when both DHCPs of the ESP32
SoftAP, and of the Station to which ESP32 is connected, are enabled.
Set Command:
Query Command:
Commands AT+CWDHCP=<operate>,<mode>
AT+CWDHCP?
Function: to enable/disable DHCP.
+CWDHCP:<enable>
Response OK
OK
AT+CWDHCP=1,1
Enable Station DHCP. If the last DHCP mode is 2, then the current DHCP mode will be 3.
Examples
AT+CWDHCP=0,2
Disable SoftAP DHCP. If the last DHCP mode is 3, then the current DHCP mode will be 1.
Espressif ! /! 97
18 2019.06
4. Wi-Fi AT Commands
!
Set Command:
+CWDHCPS:<lease time>,<start
Response IP>,<end IP>
OK
OK
• <enable>:
• <start IP>: start IP of the IP range that can be obtained from ESP32 SoftAP DHCP server.
• <end IP>: end IP of the IP range that can be obtained from ESP32 SoftAP DHCP server.
Notes • This AT command can only be called when ESP32 runs as SoftAP, and when DHCP is
enabled. The IP address should be in the same network segment as the IP address of
ESP32 SoftAP.
AT+CWDHCPS=1,3,"192.168.4.10","192.168.4.15"
Examples or
Response OK
<enable>:
Example AT+CWAUTOCONN=1
Espressif ! /! 97
19 2019.06
4. Wi-Fi AT Commands
!
Commands
Function: to start SmartConfig of a Function: enable ESP-TOUCH+AirKiss
designated type. SmartConfig.
Response OK OK
<type>:
• The message Smart get wifi info means that SmartConfig has successfully acquired
Notes the AP information. ESP32 will try to connect to the target AP.
• Message smartconfig connected wifi is printed if the connection is successful.
AT+CWMODE=1
Example
AT+CWSTARTSMART=3
Execute
AT+CWSTOPSMART
Command
Response OK
Parameters -
Example AT+CWSTOPSMART
Espressif ! /! 97
20 2019.06
4. Wi-Fi AT Commands
!
OK
Response or
ERROR
<enable>:
AT+CWMODE=1
Example
AT+WPS=1
Commands
Function: Checks the host name of ESP32 Function: Sets the host name of ESP32
Station. Station.
+CWHOSTNAME:<host name> OK
OK
If the station mode is not enabled, the
command will return:
OK
Parameters <hostname>: the host name of the ESP32 Station, maximum length: 32 bytes
AT+CWMODE=3
Example
AT+CWHOSTNAME="my_test"
Response OK
Espressif ! /! 97
21 2019.06
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 other special characters (such as .) for <hostname> and
Notes
<service_name>.
AT+MDNS=1,"espressif","_iot",8080
Example Or
AT+MDNS=0
Espressif ! /! 97
22 2019.06
5. TCP/IP-Related AT Commands
!
5. TCP/IP-Related AT Commands
5.1. Overview
Commands Description
Espressif ! /! 97
23 2019.06
5. TCP/IP-Related AT Commands
!
5.2. Commands
5.2.1. AT+CIPSTATUS—Gets the Connection Status
Execute
AT+CIPSTATUS
Command
STATUS:<stat>
• <tetype>:
Execute
AT+CIPDOMAIN=<domain name>
Command
Query Command:
Set Command:
Command AT+CIPDNS?
+CIPDNS:<DNS server0>
Espressif ! /! 97
24 2019.06
5. TCP/IP-Related AT Commands
!
• <enable>:
Example AT+CIPDNS=1,"208.67.220.220"
• If users set two DNS servers with this command, please note that these two DNS servers
should not be the same.
Commands
Function: to obtain the MAC address of Function: to set the MAC address of the ESP32
the ESP32 Station. Station.
+CIPSTAMAC:<mac>
Response OK
OK
• The MAC address of ESP32 SoftAP is different from that of the ESP32 Station. Please
make sure that you do not set the same MAC address for both of them.
Notes
• Bit 0 of the ESP32 MAC address CANNOT be 1. For example, a MAC address can be "1a:
…" but not "15:…".
• FF:FF:FF:FF:FF:FF and 00:00:00:00:00:00 are invalid MAC and cannot be set.
Example AT+CIPSTAMAC="1a:fe:35:98:d3:7b"
+CIPAPMAC:<mac>
Response OK
OK
Espressif ! /! 97
25 2019.06
5. TCP/IP-Related AT Commands
!
• The MAC address of ESP32 SoftAP is different from that of the ESP32 Station. Please
make sure you do not set the same MAC address for both of them.
Notes
• Bit 0 of the ESP32 MAC address CANNOT be 1. For example, a MAC address can be "18:
…" but not "15:…".
• FF:FF:FF:FF:FF:FF and 00:00:00:00:00:00 are invalid MAC and cannot be set.
Example AT+CIPAPMAC="18:fe:36:97:d5:7b"
Commands AT+CIPSTA?
AT+CIPSTA=<ip>[,<gateway>,<netmask>]
Function: to obtain the IP address of the Function: to set the IP address of the
ESP32 Station. ESP32 Station.
+CIPSTA:<ip>
Response OK
OK
Example AT+CIPSTA="192.168.6.100","192.168.6.1","255.255.255.0"
+CIPAP:<ip>,<gateway>,<netmask>
Response OK
OK
• [<netmask>]: netmask.
Espressif ! /! 97
26 2019.06
5. TCP/IP-Related AT Commands
!
Example AT+CIPAP="192.168.5.1","192.168.5.1","255.255.255.0"
Response OK
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
Note Users are recommended to enable this function when establishing a TCP connection.
AT+CIPSTART="TCP","iot.espressif.cn",8000
Examples AT+CIPSTART="TCP","192.168.101.110",1000
Espressif ! /! 97
27 2019.06
5. TCP/IP-Related AT Commands
!
Response OK
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
Parameters • [<UDP mode>] (optional parameter): the entity of UDP transmission. For UDP transparent
transmission, the value of this parameter has to be 0.
‣ 0: the destination peer entity of UDP will not change; this is the default setting.
‣ 1: the destination peer entity of UDP will 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 Chapter 9: AT Command Examples.
Set
AT+CIPSTART=[<link ID>,]<type>,<remote IP>,<remote port>[,<TCP keep alive>]
Command
Response OK
• <type>: string parameter indicating the connection type: "TCP", "UDP" or "SSL".
Espressif ! /! 97
28 2019.06
5. TCP/IP-Related AT Commands
!
• SSL connection needs much memory. Lack of available memory may cause system
Notes reboot.
• Users are recommended to enable this function when establishing a TCP connection.
Example AT+CIPSTART="SSL","iot.espressif.cn",8443
Response OK
‣ 0: no authentication
‣ 1: loading cert and private key for the authentication server may request
‣ 2: loading CA to authenticate server
Parameters ‣ 3: bi-directional authentication, both SSL server and client will authenticate certificate of
each other
• <cert_key_ID>: The ID of the certificate, starting from 0. ESP32 AT supports multiple
certificates. On how to generate the bin file, please refer to PKI Bin in esp32-at/tools/
readme.md.
• <CA_ID>: The CA ID that starts from 0. ESP32 AT supports multiple certificates. On how to
generate the bin file, please refer to PKI Bin in esp32-at/tools/readme.md.
• Please call this command before establishing the SSL connection, if it is needed.
Note • This configuration will be saved in the NVS area of flash. And if a SSL connection is saved
in flash by command AT+SAVETRANSLINK, the SSL connection will be established
according to this configuration in next start-up.
Example
AT+CIPSSLCCONF=1,3,0,0 // to set the NO.1 link, loading certificates (with ID 0) for
authentication.
Espressif ! /! 97
29 2019.06
5. TCP/IP-Related AT Commands
!
Set Command:
Otherwise, the system returns: For UDP transparent transmission, the value
of <UDP mode> has to be 0 when using
SEND FAIL AT+CIPSTART.
Espressif ! /! 97
30 2019.06
5. TCP/IP-Related AT Commands
!
Set Command:
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.
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.
Response OK
Espressif ! /! 97
31 2019.06
5. TCP/IP-Related AT Commands
!
Execute
AT+CIFSR
Command
+CIFSR:APIP,<SoftAP IP address>
OK
<IP address>:
IP address of the ESP32 SoftAP;
Notes Only when the ESP32 Station is connected to an AP can the Station IP 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
• The default mode is single connection mode.
• If the TCP server is running, it must be deleted (AT+CIPSERVER=0) before the single
connection mode is activated.
Example AT+CIPMUX=1
Espressif ! /! 97
32 2019.06
5. TCP/IP-Related AT Commands
!
+CIPSERVER:<mode>,<port>,<SSL>,<SSL CA
Response enable> OK
OK
<mode>:
‣ 0: delete server.
‣ 1: create server.
<port> (optional parameter): port number; 333 by default.
Parameters
[<SSL>] (optional parameter): string "SSL", to set an SSL server
‣ 0: disable CA.
‣ 1: enable CA.
• A server can only be created when multiple connections are activated (AT+CIPMUX=1).
• Connecting of a client to the ESP server will take up one connection. The connection will be
assigned an ID.
AT+CIPMUX=1
AT+CIPSERVER=1,80
Example
• To create an SSL server:
AT+CIPMUX=1
AT+CIPSERVER=1,443,"SSL",1
Query Command:
Set Command:
AT+CIPSERVERMAXCONN?
Commands AT+CIPSERVERMAXCONN=<num>
Function: obtain the maximum number of
Function: set the maximum number of clients
clients allowed to connect to the TCP or SSL
allowed to connect to the TCP or SSL server.
server.
Espressif ! /! 97
33 2019.06
5. TCP/IP-Related AT Commands
!
+CIPSERVERMAXCONN:<num>
Response OK
OK
<num>: the maximum number of clients allowed to connect to the TCP or SSL server, range:
Parameters
[1, 5]
To set this configuration, you should call the command AT+CIPSERVERMAXCONN=<num> before
Notes
creating a server.
AT+CIPMUX=1
Example AT+CIPSERVERMAXCONN=2
AT+CIPSERVER=1,80
Query Command:
Set Command:
Commands AT+CIPMODE?
AT+CIPMODE=<mode>
Function: to obtain information about
Function: to set the transmission mode.
transmission mode.
+CIPMODE:<mode>
Response OK
OK
<mode>:
‣ 0: normal transmission mode.
Parameters
‣ 1: UART-Wi-Fi passthrough mode (transparent transmission), which can only be enabled
in TCP/SSL single connection mode or in UDP mode when the remote IP and port do
not change.
• During the UART-Wi-Fi passthrough transmission, if the TCP connection breaks, ESP32 will
keep trying to reconnect until +++ is input to exit the transmission. If it is a normal TCP
Notes transmission and the TCP connection breaks, ESP32 will give a prompt and will not attempt
to reconnect.
• The UART-Wi-Fi passthrough mode and the BLE commands cannot be used together, so
before enabling UART-WiFi passthrough mode, please ensure that the BLE commands are
not enabled (AT+BLEINIT=0).
Example AT+CIPMODE=1
Espressif ! /! 97
34 2019.06
5. TCP/IP-Related AT Commands
!
Response OK
• <mode>:
‣ 0: normal mode, ESP32 will NOT enter UART-Wi-Fi passthrough mode on power-up.
‣ 1: ESP32 will enter UART-Wi-Fi passthrough mode on power-up.
• <remote IP>: remote IP or domain name.
Parameters • <remote port>: remote port.
• [<TCP keep alive>] (optional): TCP is kept alive. This function is disabled by default.
‣ 0: disables the TCP keep-alive function.
‣ 1 ~ 7200: keep-alive detection time interval, unit: second (s).
• This command will save the UART-Wi-Fi passthrough mode and its link in the NVS area.
ESP32 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 flash.
Example AT+SAVETRANSLINK=1,"192.168.6.110",1002,"TCP"
Set
AT+SAVETRANSLINK=<mode>,<remote IP>,<remote port>,<type>[,<UDP local port>]
Command
Response OK
• <mode>:
‣ 0: normal mode; ESP32 will NOT enter UART-Wi-Fi passthrough mode on power-up.
‣ 1: ESP32 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 NVS area.
ESP32 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 flash.
Example AT+SAVETRANSLINK=1,"192.168.6.110",1002,"UDP",1005
Espressif ! /! 97
35 2019.06
5. TCP/IP-Related AT Commands
!
Response OK
• <mode>:
‣ 0: normal mode, ESP32 will NOT enter UART-Wi-Fi passthrough mode on power-up.
‣ 1: ESP32 will enter UART-Wi-Fi passthrough mode on power-up.
• <remote IP>: remote IP or domain name.
Parameters • <remote port>: remote port.
• [<type>] (optional): SSL, TCP by default.
• [<TCP keep alive>] (optional): TCP is kept alive. This function is disabled by default.
Example AT+SAVETRANSLINK=1,"192.168.6.110",443,"SSL"
Query Command:
Set Command:
AT+CIPSTO?
Commands AT+CIPSTO=<time>
Function: to check the TCP server
Function: to set the TCP server timeout.
timeout.
+CIPSTO:<time>
Response OK
OK
AT+CIPMUX=1
Example AT+CIPSERVER=1,1001
AT+CIPSTO=10
Espressif ! /! 97
36 2019.06
5. TCP/IP-Related AT Commands
!
Set Command:
Command Query Command:
s AT+CIPSNTPCFG=<enable>[,<timezone>][,<SNTP
AT+CIPSNTPCFG?
server0>,<SNTP server1>,<SNTP server2>]
+CIPSNTPCFG:<enable>,<timezone>,<SN
TP server1>[,<SNTP server2>,<SNTP
Response server3>]
OK
OK
• <enable>:
‣ 0: SNTP is disabled;
‣ 1: SNTP is enabled.
Parameter • <timezone>: time zone; range: [-11,13]; if SNTP is enabled, the <timezone> has to be set;
s
• <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"
Query
AT+CIPSNTPTIME?
Command
+CIPSNTPTIME:SNTP time
Response
OK
Parameters -
AT+CIPSNTPCFG=1,8,"cn.ntp.org.cn","ntp.sjtu.edu.cn"
OK
Example AT+CIPSNTPTIME?
OK
Set Command:
Execute Command:
AT+CIUPDATE=<ota_mode>[,<version>]
Command AT+CIUPDATE
Espressif ! /! 97
37 2019.06
5. TCP/IP-Related AT Commands
!
+CIPUPDATE:<n>
OK
<ota_mode>:
‣ 0:normal FOTA
‣ 1:SSL FOTA
Parameters none
[<version>]:optional parameter, to set a
specific version for upgrading. If it is not set, the
default version will be downloaded for
upgrading.
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
Espressif ! /! 97
38 2019.06
5. TCP/IP-Related AT Commands
!
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.
AT+PING=<IP>
Set Command
Function: Ping packets.
+PING:<time>
OK
Response or
+PING:TIMEOUT
ERROR
AT+PING="192.168.1.1"
Notes
AT+PING="www.baidu.com"
Espressif ! /! 97
39 2019.06
6. BLE-Related AT Commands
!
6. BLE-Related AT Commands
6.1. Overview
Commands Description
Espressif ! /! 97
40 2019.06
6. BLE-Related AT Commands
!
Commands Description
⚠ Notice:
• Download BLE Spec (ESP32 supports Core Version 4.2): https://www.bluetooth.com/specifications/
adopted-specifications
• The BLE commands and the UART-Wi-Fi passthrough mode cannot be used together, so before BLE
initialization, please ensure that the UART-Wi-Fi passthrough mode is not enabled (AT+CIPMODE=0).
Espressif ! /! 97
41 2019.06
6. BLE-Related AT Commands
!
6.2. Commands
6.2.1. AT+BLEINIT—BLE Initialization
Query Command:
Set Command:
AT+BLEINIT?
Commands AT+BLEINIT=<init>
Function: to check the initialization status of
Function: to initialize the role of BLE.
BLE.
+BLEINIT:0
OK
Response OK
If BLE is initialized, it will return:
+BLEINIT:<role>
OK
<init>:
• Before using BLE AT commands, this command has to be called first to trigger the
initialization process.
• After being initialized, the BLE role cannot be changed directly. If the user wants to
change the BLE role, AT+RST or AT+BLEINIT=0 needs to be called first.
• If using ESP32 as a BLE server, a service bin should be downloaded into Flash.
Notes
‣ at_customize.bin has to be downloaded, so that the relevant commands can be used.
Please refer to the ESP32_Customize_Partitions for more details.
‣ To learn how to generate a service bin, please refer to esp32-at/tools/readme.md.
‣ The download address of the service bin is the "ble_data" address in esp32-at/
at_customize.csv.
Example AT+BLEINIT=1
Function: to get the BLE public address. Function: to set the BLE random address.
+BLEADDR:<BLE_public_addr>
Response OK
OK
<addr_type>:
Parameter
‣ 0: public address
‣ 1: random address
Espressif ! /! 97
42 2019.06
6. BLE-Related AT Commands
!
• For the time being, only two actions are supported: getting the public address and
setting the BLE random address.
Notes
• The two most significant bits of the random address shall be equal to 1. More details are
in the BLE spec.
Example AT+BLEADDR=1,"f8:7f:24:87:1c:f7"
+BLENAME:<device_name>
Response OK
OK
• This configuration sets the device name characteristic of GAP service, it is the device
Notes name we can get after BLE connection is established, more details are in BLE core v4.2
vol.3 part C 12.1.
• If user wants to set the device name while advertising, it is the command
AT+BLEADVDATA that should be used.
Example AT+BLENAME="esp_demo"
Set Command:
Query Command: AT+BLESCANPARAM=<scan_type>,<own_addr_ty
pe>,
Commands AT+BLESCANPARAM?
<filter_policy>,<scan_interval>,<scan_wi
Function: to get the parameters of BLE ndow>
scanning. Function: to set the parameters of BLE
scanning.
+BLESCANPARAM:<scan_type>,<own_addr_t
ype>,<filter_policy>,<scan_interval>,
Response <scan_ window>
OK
OK
Espressif ! /! 97
43 2019.06
6. BLE-Related AT Commands
!
<scan_type>:
‣ 0: passive scan
‣ 1: active scan
<own_addr_type>:
‣ 0: public address
‣ 1: random address
‣ 2: RPA public address
Parameters ‣ 3: RPA random address
<filter_policy>:
‣ 0: BLE_SCAN_FILTER_ALLOW_ALL
‣ 1: BLE_SCAN_FILTER_ALLOW_ONLY_WLST
‣ 2: BLE_SCAN_FILTER_ALLOW_UND_RPA_DIR
‣ 3: BLE_SCAN_FILTER_ALLOW_WLIST_PRA_DIR
<scan_interval>: scan interval
Example
AT+BLESCANPARAM=0,0,0,100,50
Set Command:
Commands AT+BLESCAN=<enable>[,<interval>]
+BLESCAN:<addr>,<rssi>,<adv_data>,<scan_rsp_data>,<addr_type>
Response
OK
Espressif ! /! 97
44 2019.06
6. BLE-Related AT Commands
!
<enable>:
‣ 0: disable scanning
‣ 1: enable scanning
[<interval>]: optional parameter, unit: second
‣ 0: public address
‣ 1: random address
‣ 2: RPA (Resolvable Private Address) public
‣ 3: RPA (Resolvable Private Address) random
Set Command:
Commands AT+BLESCANRSPDATA=<scan_rsp_data>
Function: to set scan response.
Response OK
<scan_rsp_data>: scan response data is a HEX string. For example, to set the response
Parameter data as "0x11 0x22 0x33 0x44 0x55", the command should be
AT+BLESCANRSPDATA="1122334455".
Example
AT+BLESCANRSPDATA="1122334455"
Espressif ! /! 97
45 2019.06
6. BLE-Related AT Commands
!
Set Command:
Query Command: AT+BLEADVPARAM=<adv_int_min>,<adv_int_max
>,
AT+BLEADVPARAM?
Commands <adv_type>,<own_addr_type>,<channel_map>
Function: to query the parameters of [,<adv_filter_policy>,<peer_addr_type>,<p
advertising. eer_addr>]
+BLEADVPARAM:<adv_int_min>,<adv_int_
max>,<adv_type>,<own_addr_type>,<cha
Response nnel_map>,<adv_filter_policy>,<peer_ OK
addr_type>,<peer_addr>
OK
‣ 0: ADV_TYPE_IND
‣ 1: ADV_TYPE_DIRECT_IND_HIGH
‣ 2: ADV_TYPE_SCAN_IND
‣ 3: ADV_TYPE_NONCONN_IND
<own_addr_type>: own BLE address type
‣ 0: BLE_ADDR_TYPE_PUBLIC
‣ 1: BLE_ADDR_TYPE_RANDOM
<channel_map>: channel of advertising
Parameters ‣ 1: ADV_CHNL_37
‣ 2: ADV_CHNL_38
‣ 4: ADV_CHNL_39
‣ 7: ADV_CHNL_ALL
[<adv_filter_policy>](optional parameter): filter policy of advertising
‣ 0: ADV_FILTER_ALLOW_SCAN_ANY_CON_ANY
‣ 1: ADV_FILTER_ALLOW_SCAN_WLST_CON_ANY
‣ 2: ADV_FILTER_ALLOW_SCAN_ANY_CON_WLST
‣ 3: ADV_FILTER_ALLOW_SCAN_WLST_CON_WLST
‣ 0: PUBLIC
‣ 1: RANDOM
Example
AT+BLEADVPARAM=50,50,0,0,4,0,0,"12:34:45:78:66:88"
Espressif ! /! 97
46 2019.06
6. BLE-Related AT Commands
!
Set Command:
Commands AT+BLEADVDATA=<adv_data>
Response OK
<adv_data>: advertising data; this is a HEX string. For example, to set the advertising data
Parameters
as "0x11 0x22 0x33 0x44 0x55", the command should be AT+BLEADVDATA="1122334455".
Example
AT+BLEADVDATA="1122334455"
Execute Command:
Commands AT+BLEADVSTART
Response OK
Parameter None
Example
AT+BLEADVSTART
Execute Command:
Commands AT+BLEADVSTOP
Function: to stop advertising.
Response OK
Parameter None
After having started advertising, if the BLE connection is established successfully, it will stop
Notes
advertising automatically. In such a case, this command does NOT need to be called.
Example AT+BLEADVSTART
AT+BLEADVSTOP
Espressif ! /! 97
47 2019.06
6. BLE-Related AT Commands
!
Set Command:
Query Command:
AT+BLECONN=<conn_index>,<remote_address>[
Commands AT+BLECONN?
,<addr_type>]
Function: to query the BLE connection.
Function: to establish the BLE connection.
OK
+BLECONN:<conn_index>,<remote_addres
s> If the connection established successfully, it will
prompt message
OK
Response
If the connection has not been +BLECONN:<conn_index>,<remote_address>
established, there will NOT be It will prompt the message below, if NOT:
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
‣ 0: public address
‣ 1: random address
‣ 2: RPA (Resolvable Private Address) public
‣ 3: RPA (Resolvable Private Address) random
Example
AT+BLECONN=0,"24:0a:c4:09:34:23"
Set Command:
Query Command:
AT+BLECONNPARAM=<conn_index>,<min_int
Commands AT+BLECONNPARAM?
erval>,<max_interval>,<latency>,<time
out>
Function: to query the parameters of BLE
connection. Function: to update the parameters of BLE
connection.
OK // command received
+BLECONNPARAM:<conn_index>,<min_interval>
,<max_interval>,<cur_interval>,<latency>, If the setting failed, it will prompt message
Response
<timeout>
below:
OK +BLECONNPARAM:<conn_index>,-1
Espressif ! /! 97
48 2019.06
6. BLE-Related AT Commands
!
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
This commands supports the client only when updating its connection parameters. Of course,
Note
the connection has to be established first.
Example AT+BLECONN=0,"24:0a:c4:09:34:23"
AT+BLECONNPARAM=0,12,14,1,500
Execute Command:
Commands AT+BLEDISCONN=<conn_index>
OK
+BLEDISCONN:<conn_index>,<remote_address>
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
Parameter now, but multiple BLE connections will be supported in the future.
Example AT+BLECONN=0,"24:0a:c4:09:34:23"
AT+BLEDISCONN=0
Set Command:
Commands AT+BLEDATALEN=<conn_index>,<pkt_data_len>
Response OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
Parameter now, but multiple BLE connections will be supported in the future.
Notes The BLE connection has to be established before setting the packet length.
Espressif ! /! 97
49 2019.06
6. BLE-Related AT Commands
!
Example AT+BLECONN=0,"24:0a:c4:09:34:23"
AT+BLEDATALEN=0,30
+BLECFGMTU:<conn_index>,<mtu_size>
Response OK // the command is received
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
Parameter now, but multiple BLE connections will be supported in the future.
<mtu_size>: MTU length
• Only the client can call this command to set the length of MTU. However, the BLE
connection has to be established first.
Notes • The actual length of MTU needs to be negotiated. The "OK" response only means that the
MTU length must be set. So, the user should use command AT+BLECFGMTU? to query the
actual MTU length.
Example AT+BLECONN=0,"24:0a:c4:09:34:23"
AT+BLECFGMTU=0,300
Execute Command:
Commands AT+BLEGATTSSRVCRE
Response OK
Parameter None
• If using ESP32 as a BLE server, a service bin should be downloaded into Flash in order
to provide services.
‣ To learn how to generate a service bin, please refer to esp32-at/tools/readme.md.
Notes
‣ The download address of the service bin is the "ble_data" address in esp32-at/
at_customize.csv.
• This command should be called immediately to create services, right after the BLE server
is initialized. If a BLE connection is established first, the service creation will fail.
Example
AT+BLEGATTSSRVCRE
Espressif ! /! 97
50 2019.06
6. BLE-Related AT Commands
!
Function: GATTS starts all services. Function: GATTS starts a specific service.
Response OK
Example AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
Function: GATTS stops all services. Function: GATTS stops a specific service.
Response OK
Parameter None <srv_index>: service's index starting from 1
AT+BLEGATTSSRVCRE
Example
AT+BLEGATTSSRVSTART
AT+BLEGATTSSRVSTOP
Query Command:
Commands AT+BLEGATTSSRV?
+BLEGATTSSRV:<srv_index>,<start>,<srv_uuid>,<srv_type>
Response
OK
<srv_index>: service's index starting from 1
<start>:
Parameters
<srv_uuid>: service's UUID
‣ 1: is a primary service
Espressif ! /! 97
51 2019.06
6. BLE-Related AT Commands
!
Example AT+BLEGATTSSRVCRE
AT+BLEGATTSSRV?
Query Command:
Command
s AT+BLEGATTSCHAR?
Function: GATTS characteristics discovery.
+BLEGATTSCHAR:"char",<srv_index>,<char_index>,<char_uuid>,<char_prop>
+BLEGATTSCHAR:"desc",<srv_index>,<char_index>,<desc_index>
OK
<srv_index>: service's index starting from 1
AT+BLEGATTSSRVCRE
Example
AT+BLEGATTSSRVSTART
AT+BLEGATTSCHAR?
Set Command:
Commands AT+BLEGATTSNTFY=<conn_index>,<srv_index>,<char_index>,<length>
wrap return > after the command. Begin receiving serial data. When the requirement of data
length, determined by <length>, is met, the notification starts.
Response
If the data transmission is successful, the system returns:
OK
Espressif ! /! 97
52 2019.06
6. BLE-Related AT Commands
!
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
A simple workflow is shown below. Users can refer to Section 9.5 BLE AT Examples for
more details.
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
// for example, to notify of 4 bytes of data using the 6th characteristic in the 3rd service, use
the following command:
AT+BLEGATTSNTFY=0,3,6,4
// after > shows, inputs 4 bytes of data, such as "1234"; then, the data will be transmitted
automatically
Set Command:
Commands AT+BLEGATTSIND=<conn_index>,<srv_index>,<char_index>,<length>
Function: GATTS indicates its characteristics.
wrap return > after the command. Begin receiving serial data. When the requirement of data
length, determined by <length>, is met, the indication starts.
Response
If the data transmission is successful, the system returns:
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
Espressif ! /! 97
53 2019.06
6. BLE-Related AT Commands
!
A simple workflow is shown below. Users can refer to Section 9.5 BLE AT Examples for
more details.
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
AT+BLEGATTSCHAR? // check for which characteristic the client can receive indications
// for example, to indicate 4 bytes of data using the 7th characteristic in the 3rd service, use
the following command:
AT+BLEGATTSIND=0,3,7,4
// after > shows, inputs 4 bytes of data, such as "1234"; then, the data will be transmitted
automatically
Set Command:
Commands AT+BLEGATTSSETATTR=<srv_index>,<char_index>[,<desc_index>],<length>
wrap return > after the command. Begin receiving serial data. When the requirement of data
length, determined by <length>, is met, the setting starts.
Response
If the setting is successful, the system returns:
OK
<srv_index>: service's index; it can be fetched with command AT+BLEGATTSCHAR?
Note If the <length> is larger than the maximum length allowed, the setting will fail.
A simple workflow is shown below. Users can refer to Section 9.5 BLE AT Examples for
more details.
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
Example
AT+BLEGATTSCHAR?
// for example, to set 4 bytes of data of the 1st characteristic in the 1st service, use the
following command:
AT+BLEGATTSSETATTR=1,1,,4
// after > shows, inputs 4 bytes of data, such as "1234"; then, the setting starts
Espressif ! /! 97
54 2019.06
6. BLE-Related AT Commands
!
Query Command:
Commands AT+BLEGATTCPRIMSRV=<conn_index>
+BLEGATTCPRIMSRV:<conn_index>,<srv_index>,<srv_uuid>,<srv_type>
Response
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
‣ 1: is a primary service
Example AT+BLECONN=0,"24:12:5f:9d:91:98"
AT+BLEGATTCPRIMSRV=0
Set Command:
Commands AT+BLEGATTCINCLSRV=<conn_index>,<srv_index>
Function: GATTC discovers included services.
+BLEGATTCINCLSRV:<conn_index>,<srv_index>,<srv_uuid>,<srv_type>,<included_srv_
Response uuid>,<included_srv_type>
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
‣ 1: is a primary service
<included_srv_uuid>: included service's UUID
‣ 1: is a primary service
Espressif ! /! 97
55 2019.06
6. BLE-Related AT Commands
!
AT+BLECONN=0,"24:12:5f:9d:91:98"
Example AT+BLEGATTCPRIMSRV=0
Set Command:
Commands AT+BLEGATTCCHAR=<conn_index>,<srv_index>
+BLEGATTCCHAR:"char",<conn_index>,<srv_index>,<char_index>,<char_uuid>,<char_p
rop>
+BLEGATTCCHAR:"desc",<conn_index>,<srv_index>,<char_index>,<desc_index>,<desc_
uuid>
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
Parameters
<char_uuid>: characteristic's UUID
AT+BLECONN=0,"24:12:5f:9d:91:98"
Example AT+BLEGATTCPRIMSRV=0
Set Command:
Commands AT+BLEGATTCRD=<conn_index>,<srv_index>,<char_index>[,<desc_index>]
Espressif ! /! 97
56 2019.06
6. BLE-Related AT Commands
!
+BLEGATTCRD:<conn_index>,<len>,<value>
Response
OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
AT+BLECONN=0,"24:12:5f:9d:91:98"
AT+BLEGATTCPRIMSRV=0
Example AT+BLEGATTCCHAR=0,3 // set a specific index, according to the result of the previous
command
// for example, to read 1st descriptor of the 2nd characteristic in the 3rd service, use the
following command:
AT+BLEGATTCRD=0,3,2,1
Set Command:
Commands AT+BLEGATTCWR=<conn_index>,<srv_index>,<char_index>[,<desc_index>],<length>
wrap return > after the command. Begin receiving serial data. When the requirement of data
length, determined by <length>, is met, the writting starts.
Response
If the setting is successful, the system returns:
OK
Espressif ! /! 97
57 2019.06
6. BLE-Related AT Commands
!
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
[<desc_index>] (optional parameter): descriptor's index. If it is set, the value of the target
descriptor will be written; if it is not set, the value of the target characteristic will be written.
AT+BLECONN=0,"24:12:5f:9d:91:98"
AT+BLEGATTCPRIMSRV=0
// for example, to write 6 bytes of data to the 4th characteristic in the 3rd service, use the
following command:
AT+BLEGATTCWR=0,3,4,,6
// after > shows, inputs 6 bytes of data, such as "123456"; then, the writing starts
AT+BLESPPCFG=<cfg_enable>,<tx_srv_index>,<tx_char_index>,<rx_srv_index>,<rx_srv
Set _index>
Command Function: to configure BLE SPP (Serial Port Profile, UART-BLE passthrough mode). It will
take two characteristics: one for sending data, the other for receiving data.
Response OK
Espressif ! /! 97
58 2019.06
6. BLE-Related AT Commands
!
<cfg_enable>:
• 0: clears BLE SPP configuration, the following four parameters need not to be set.
• 1: sets BLE SPP configuration, the following four parameters have to be set.
<tx_srv_index>: the index of the service that contains the target characteristic for sending
data.
• If ESP runs as a BLE server, <tx_srv_index> will be a local service ID which can be
obtained by using the command AT+BLEGATTSSRVCRE.
• If ESP runs as a BLE client, <tx_srv_index> will be a remote service ID which can be
obtained by using the command AT+BLEGATTCPRIMSRV=<conn_index>.
<tx_char_index>: the index of the characteristic that is used for sending data.
<rx_srv_index>: the index of the service that contains the target characteristic for receiving
data.
• If ESP runs as a BLE server, <rx_srv_index> will be a local service ID which can be
obtained by using the command AT+BLEGATTSSRVCRE.
• If ESP runs as a BLE client, <rx_srv_index> will be a remote service ID which can be
obtained by using the command AT+BLEGATTCPRIMSRV=<conn_index>.
<rx_char_index>: the index of the characteristic that is used for receiving data.
• This command can be called multiple times, the final configuration depends on the last
Note setting.
• If the target characteristic cannot be written, it will return "ERROR". This configuration will
not be saved in flash, and will be cleared after system reboot or BLE shutdown.
Espressif ! /! 97
59 2019.06
6. BLE-Related AT Commands
!
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
AT+BLEGATTSCHAR?
// After a BLE client connects to the ESP server, the message +BLECONN:0,<client MAC>
Example
will appear.
// For example, to configure the 7th characteristic in the 1st service as a TX channel for
sending data; and configure the 5th characteristic in the 1st service as a RX channel for
receiving data, use the following command:
AT+BLESPPCFG=1,1,7,1,5
// The client needs to listen to the notification/indication from TX channel which is the 7th
characteristic in this example.
Execute AT+BLESPP
Command Function: to enable BLE SPP (Serial Port Profile, UART-BLE passthrough mode).
OK
Response The wrap return is > after this command is executed. Then, ESP32 enters UART-BLE
passthrough mode.
When a single packet containing +++ is received, ESP32 returns to normal command mode.
Please wait for at least one second before sending the next AT command.
• When calling this command to enable BLE SPP, the configuration set by AT+BLESPPCFG
will be checked. If the configuration has not been set, cleared, or is invalid (for example,
the characteristic fails to meet requirements), the command will return "ERROR".
• If the UART-WiFi passthrough mode has been enabled, the command will return
"ERROR".
Note • If the BLE connection is not established, or the multiple connections mode is enabled,
the command will return "ERROR".
• If the BLE is advertising, the command will return "ERROR". However, the command will
be enabled successfully if the advertising type is ADV_TYPE_NONCONN_IND.
• If the BLE connection breaks unexpectedly in UART-BLE passthrough mode, the ESP will
keep trying to restore the connection.
Espressif ! /! 97
60 2019.06
6. BLE-Related AT Commands
!
AT+BLEGATTSSRVCRE
AT+BLEGATTSSRVSTART
AT+BLEGATTSCHAR?
// After a BLE client connects to the ESP server, the message +BLECONN:0,<client MAC>
Example will return.
// For example, to configure the 7th characteristic in the 1st service as a TX channel for
sending data; and configure the 5th characteristic in the 1st service as a RX channel for
receiving data, use the following command:
AT+BLESPPCFG=1,1,7,1,5
// The client needs to listen to the notification/indication from TX channel which is the 7th
characteristic in this example.
+BLESECPARAM:<auth_req>,<iocap>,<key_s
Response ize>,<init_key>,<rsp_key>
OK
OK
Espressif ! /! 97
61 2019.06
6. BLE-Related AT Commands
!
‣ 0: ESP_LE_AUTH_NO_BOND
‣ 1: ESP_LE_AUTH_BOND
‣ 2: ESP_LE_AUTH_REQ_MITM
‣ 4: ESP_LE_AUTH_REQ_SC_ONLY
‣ 5: ESP_LE_AUTH_REQ_SC_BOND
‣ 6: ESP_LE_AUTH_REQ_SC_MITM
‣ 7: ESP_LE_AUTH_REQ_SC_MITM_BOND
<iocap>: IO capabilities
Parameters
<key_size>: encryption key size, range : [7, 16]
<init_key>:
Note This configuration should be set before the BLE connection is established.
Example AT+BLESECPARAM=1,4,16,3,3
Set Command:
Commands AT+BLEENC=<conn_index>,<sec_act>
Response OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
<sec_act>:
Parameters
‣ 0: ESP_BLE_SEC_NONE
‣ 1: ESP_BLE_SEC_ENCRYPT
‣ 2: ESP_BLE_SEC_ENCRYPT_NO_MITM
‣ 3: ESP_BLE_SEC_ENCRYPT_MITM
AT+BLESECPARAM=1,4,16,3,3
Example
AT+BLEENC=0,3
Espressif ! /! 97
62 2019.06
6. BLE-Related AT Commands
!
Set Command:
Commands AT+BLEENCRSP=<conn_index>,<accept>
Response OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
Parameters <accept>:
‣ 0: reject
‣ 1: accept
Example AT+BLEENCRSP=0,1
Set Command:
Commands AT+BLEKEYREPLY=<conn_index>,<key>
Response OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
Parameters now, but multiple BLE connections will be supported in the future.
Example AT+BLEKEYREPLY=0,649784
Set Command:
Commands AT+BLECONFREPLY=<conn_index>,<confirm>
Function: to reply to a pairing result when the pairing key cannot be used.
Response OK
<conn_index>: index of BLE connection; only 0 is supported for the single connection right
now, but multiple BLE connections will be supported in the future.
Parameters <confirm>:
‣ 0: No
‣ 1: Yes
Example
AT+BLECONFREPLY=0,1
Espressif ! /! 97
63 2019.06
6. BLE-Related AT Commands
!
Query Command:
Command
AT+BLEENCDEV?
+BLEENCDEV:<enc_dev_index>,<mac_address>
Response
OK
<enc_dev_index>: index of bonded devices; only 0 is supported for the single connection right
Parameters now, but multiple BLE connections will be supported in the future.
<mac_address>: Mac address
Example AT+BLEENCDEV?
Set Command:
Execute Command:
Command AT+BLEENCCLEAR=<enc_dev_index>
s AT+BLEENCCLEAR
Response OK
Parameter <enc_dev_index>: index of bonded devices; only 0 is supported for the single connection right
s now, but multiple BLE connections will be supported in the future.
Example AT+BLEENCCLEAR
Espressif ! /! 97
64 2019.06
7. AT Commands with Configuration Saved in the NVS Area
!
7. AT Commands with
Configuration Saved in the
NVS Area
Commands Examples
AT+UART AT+UART=115200,8,1,0,3
AT+UART_DEF AT+UART_DEF=115200,8,1,0,3
AT+CWDHCP AT+CWDHCP=1,1
AT+CIPSTAMAC AT+CIPSTAMAC="18:fe:35:98:d3:7b"
AT+CIPAPMAC AT+CIPAPMAC="1a:fe:36:97:d5:7b"
AT+CIPSTA AT+CIPSTA="192.168.6.100"
AT+CIPAP AT+CIPAP="192.168.5.1"
AT+CWDHCPS AT+CWDHCPS=1,3,"192.168.4.10","192.168.4.15"
AT+SAVETRANSLINK AT+SAVETRANSLINK=1,"192.168.6.10",1001
AT+CWMODE AT+CWMODE=3
AT+CWJAP AT+CWJAP="abc","0123456789"
AT+CWSAP AT+CWSAP="ESP32","12345678",5,3
AT+CWAUTOCONN AT+CWAUTOCONN=1
AT+CIPSSLCCONF AT+CIPSSLCCONF=1,3,0,0
⚠ Notice:
Espressif ! /! 97
65 2019.06
8. AT Messages
!
8. AT Messages
Messages of ESP32 AT are as below:
Messages Description
+DIST_STA_IP:<sta_mac>,<s
ESP softAP distributes an IP address to the station connected.
ta_ip>
+STA_DISCONNECTED:<sta_ma
A station disconnects from the ESP softAP.
c>
Espressif ! /! 97
66 2019.06
9. AT Commands Examples
!
9. AT Commands Examples
Herein we introduce some examples of how to use Espressif's AT Commands.
Response:
OK
Response:
OK
Response:
4. Connect the PC to the same router which ESP32 is connected to. Use a network tool
on the PC to create a TCP server.
- For example, the TCP server on PC is 192.168.3.116, port 8080.
5. ESP32 is connected to the TCP server as a client:
AT+CIPSTART="TCP","192.168.3.116",8080 // protocol、server IP & port
6. Send data:
AT+CIPSEND=4 // set date length which will be sent, such as
4 bytes
Response:
SEND OK
⚠ Notice:
• If the number of bytes inputted are more than the size defined (n):
- the system will reply busy, and send the first n bytes.
- and after sending the first n bytes, the system will reply SEND OK.
Espressif ! /! 97
67 2019.06
9. AT Commands Examples
!
7. Receive data:
Response:
OK
Response:
OK
Response:
+CIFSR:STAIP,"192.168.101.104" // IP address of ESP32 Station
4. Connect the PC to the same router which ESP32 is connected to. Use a network tool
on the PC to create UDP transmission.
- For example, the PC's IP address is 192.168.101.116 and the port is 8080.
5. Below are two examples of UDP transmission:
In UDP transmission, whether the remote IP and port are fixed or not is determined by the
last parameter of AT+CIPSTART, namely 0. 0 means that the remote IP and port are fixed
and cannot be changed. A specific ID is given to such a connection, ensuring that the data
sender and receiver will not be replaced by other devices.
1. Enable multiple connections:
AT+CIPMUX=1
Response:
OK
Espressif ! /! 97
68 2019.06
9. AT Commands Examples
!
Response:
4,CONNECT
OK
📖 Notes:
• "192.168.101.110" and 8080 are the remote IP and port of UDP transmission on the remote side, i.e.,
the UDP configuration set by PC.
• 1112 is the local port number of ESP32. Users can define this port number. The value of this parameter
will be random if it is not defined beforehand.
• 0 means that the remote IP and port are fixed and cannot be changed. For example, if another PC also
creates a UDP entity and sends data to ESP32 port 1112, ESP32 can receive the data sent from UDP
port 1112. But when data are sent using AT command AT+CIPSEND=4,X, it will still be sent to the first
PC end. If parameter 0 is not used, the data will be sent to the new PC.
3. Send data:
AT+CIPSEND=4,7 // send 7 bytes to transmission NO.4
Response:
SEND OK
⚠ Notice:
• If the number of bytes inputted are more than the size defined (n):
- the system will reply busy, and send the first n bytes.
- and after sending the first n bytes, the system will reply SEND OK.
4. Receive data:
+IPD,4,n:xxxxxxxxxx // received n bytes, data=xxxxxxxxxxx
Response:
4,CLOSED
OK
Response:
CONNECT
OK
Espressif ! /! 97
69 2019.06
9. AT Commands Examples
!
📖 Notes:
• "192.168.101.110" and 8080 here refer to the IP and port of the remote UDP transmission terminal
which is created on a PC in Section 9.2.1.
• 1112 is the local port of ESP32. Users can define this port. The value of this parameter will be random
if it is not defined beforehand.
• 2 means the means the opposite terminal of UDP transmission can be changed. The remote IP and
port will be automatically changed to those of the last UDP connection to ESP32.
2. Send data:
AT+CIPSEND=7 // send 7 bytes
Response:
SEND OK
⚠ Notice:
• If the number of bytes inputted are more than the size defined (n):
- the system will reply busy, and send the first n bytes.
- and after sending the first n bytes, the system will reply SEND OK.
3. If you want to send data to any other UDP terminals, please designate the IP and port of
the target terminal in the command.
AT+CIPSEND=6,"192.168.101.111",1000 // send six bytes
Response:
SEND OK
4. Receive data:
+IPD,n:xxxxxxxxxx // received n bytes, data=xxxxxxxxxxx
Response:
CLOSED
OK
Espressif ! /! 97
70 2019.06
9. AT Commands Examples
!
Here is an example of the ESP32 Station working as a TCP client in single connection
mode of transparent transmission.
1. Set the Wi-Fi mode:
AT+CWMODE=3 // SoftAP+Station mode
Response:
OK
Response:
OK
Response:
192.168.101.105 // device's IP that got from router
4. Connect the PC to the same router to which ESP32 is connected. Use a network tool
on the PC to create a TCP server.
- For example, the PC's IP address is 192.168.101.110 and the port is 8080.
5. Connect the device to the TCP server as a TCP client:
AT+CIPSTART="TCP","192.168.101.110",8080 // protocol, server IP & port
Response:
OK
Response:
OK
7. Send data:
AT+CIPSEND
Response:
> // From now on, data received from UART will be transparent transmitted
to server
Espressif ! /! 97
71 2019.06
9. AT Commands Examples
!
When receiving a packet that contains only “+++”, the UART-WiFi passthrough
transmission process will be stopped. Then please wait at least 1 second before sending
next AT command.
Please be noted that if you input “+++” directly by typing, the “+++”, may not be
recognised as three consecutive “+” because of the Prolonged time when typing.
⚠ Notice:
The aim of ending the packet with +++ is to exit transparent transmission and to accept normal AT
commands, while TCP still remains connected. However, users can also deploy command AT+CIPSEND to
go back into transparent transmission.
Response:
OK
Response:
CLOSED
OK
Response:
OK
!
3. Use a network tool on PC to create a UDP.
- For example, the PC's IP address is 192.168.4.2 and the port is 1001.
Espressif ! /! 97
72 2019.06
9. AT Commands Examples
!
4. Create a UDP transmission between ESP32 and the PC with a fixed remote IP and port.
AT+CIPSTART="UDP","192.168.4.2",1001,2233,0
Response:
OK
Response:
OK
6. Send data:
AT+CIPSEND
Response:
> // from now on, data received from UART will be transparent
transmitted to server
⚠ Notice:
The aim of ending the packet with +++ is to exit transparent transmission and to accept normal AT
commands, while TCP still remains connected. However, users can also use command AT+CIPSEND to go
back into transparent transmission.
Response:
OK
Response:
CLOSED
OK
Espressif ! /! 97
73 2019.06
9. AT Commands Examples
!
Response:
OK
Response:
OK
Response:
OK
!
5. Using a network tool on PC to create a TCP client and connect to the TCP server that
ESP created.
⚠ Notice:
When ESP32 works as a TCP server, there is a timeout mechanism. If the TCP client is connected to the
ESP32 TCP server, while there is no data transmission for a period of time, the server will disconnect from
the client. To avoid such a problem, please set up a data transmission cycle every two seconds.
Espressif ! /! 97
74 2019.06
9. AT Commands Examples
!
6. Send data:
// ID number of connection is defaulted to be 0
Response:
SEND OK
⚠ Notice:
• If the number of bytes inputted are more than the size defined (n):
- the system will reply busy, and send the first n bytes.
- and after sending the first n bytes, the system will reply SEND OK.
7. Receive data:
+IPD,0,n:xxxxxxxxxx // received n bytes, data = xxxxxxxxxx
Response:
0,CLOSED
OK
Espressif ! /! 97
75 2019.06
9. AT Commands Examples
!
iBeacon prefix 9 02 01 06 1A FF 4C 00 02 15
TX power 1 Used to calculate the distance between the ESP32 device and the phone
Response:
OK
2. Start advertising.
Configure the parameters of the advertisement as Table 9-2 shows:
Type Content
iBeacon prefix 02 01 06 1A FF 4C 00 02 15
Major 27 B7
Minor F2 06
TX power C5
Espressif ! /! 97
76 2019.06
9. AT Commands Examples
!
Response:
OK
Start advertising:
AT+BLEADVSTART
Response:
OK
Open WeChat on your mobile phone and then select “Shake Nearby” to discover the
ESP32 device that is advertising, as shown in Figure 9-1.
!
Figure 9-1. “Shake Nearby” on WeChat
⚠ Notice:
If the ESP32 device has already been initialized as a BLE server, you need to call AT+BLEINIT=0 to de-init
it first, and then re-init it as a BLE client.
Espressif ! /! 97
77 2019.06
9. AT Commands Examples
!
Response:
OK
Response:
OK
+BLESCAN:24:0a:c4:01:4d:fe,-74,02010207097a4f68664b43020aeb051220004000,
+BLESCAN:
24:0a:c4:02:10:0e,-33,0201061aff4c000215fda50693a4e24fb1afcfc6eb0764782527b7f206c5,
The result shows the advertisement that has been configured in Section 9.5.1.1. Then, the
host MCU can parse the data whose frame is shown in Table 9-1.
⚠ Notice:
The ESP32 Server needs to download a "service bin" into Flash to provide BLE services.
1. BLE initialization:
• ESP32 Server:
Response:
OK
- Create services.
AT+BLEGATTSSRVCRE
Response:
OK
- Start services.
AT+BLEGATTSSRVSTART
Espressif ! /! 97
78 2019.06
9. AT Commands Examples
!
Response:
OK
• ESP32 Client:
Response:
OK
Response:
+BLEADDR:24:0a:c4:03:f4:d6
OK
Response:
OK
* 02 01 06 //<length>,<type>,<data>
* 0A 09 457370726573736966 //<length>,<type>,<data>
* 03 03 02A0 //<length>,<type>,<data>
*/
Response:
OK
If you do not configure the advertisement data, then the payload will be empty when
scanned.
You can also configure the response data of the scanning (ScanRspData):
AT+BLESCANRSPDATA="0201060B09457370726573736966030302A0"
OK
Espressif ! /! 97
79 2019.06
9. AT Commands Examples
!
AT+BLEADVSTART
Response:
OK
• ESP32 Client:
- Configure the scanning parameters. This is optional, though. For example, in the
active-scan mode, the command is as follows:
AT+BLESCANPARAM=1,0,0,100,50
Response:
OK
- Start scanning.
AT+BLESCAN=1,3
Response:
+BLESCAN:<BLE address>,<rssi>,<adv_data>,<scan_rsp_data>
OK
Response:
OK
+BLECONN:0,"24:0a:c4:03:f4:d6"
📖 Notes:
OK
+BLECONNPARAM:0,30,30,30,0,600
OK
Espressif ! /! 97
80 2019.06
9. AT Commands Examples
!
AT+BLECFGMTU=0,200
OK
AT+BLECFGMTU?
+BLECFGMTU:0,200
OK
3. Read/Write a characteristic:
• ESP32 Server:
Response:
+BLEGATTSSRV:1,1,0xA002,1
OK
- Discover characteristics.
AT+BLEGATTSCHAR?
Response:
+BLEGATTSCHAR:"char",1,1,0xC300
+BLEGATTSCHAR:"desc",1,1,1
+BLEGATTSCHAR:"char",1,2,0xC301
+BLEGATTSCHAR:"desc",1,2,1
+BLEGATTSCHAR:"char",1,3,0xC302
+BLEGATTSCHAR:"desc",1,3,1
OK
• ESP32 Client:
- Discover services:
AT+BLEGATTCPRIMSRV=0
Response:
+BLEGATTCPRIMSRV:0,1,0x1801,1
+BLEGATTCPRIMSRV:0,2,0x1800,1
+BLEGATTCPRIMSRV:0,3,0xA002,1
OK
Espressif ! /! 97
81 2019.06
9. AT Commands Examples
!
⚠ Notice:
• When discovering services, the ESP32 Client will get two more default services (UUID:0x1800 and
0x1801) than what the ESP32 Server will get.
• So, for the same service, the <srv_index> received by the ESP32 Client equals the <srv_index>
received by ESP32 Server + 2.
• For example, the <srv_index> of the above-mentioned service, 0xA002, is 3 when the ESP32 Client is
in the process of discovering services. But if the ESP32 Server tries to discover it with command
AT+BLEGATTSSRV?, the <srv_index> will be 1.
- Discover characteristics.
AT+BLEGATTCCHAR=0,3
Response:
+BLEGATTCCHAR:"char",0,3,1,0xC300,2
+BLEGATTCCHAR:"desc",0,3,1,1,0x2901
+BLEGATTCCHAR:"char",0,3,2,0xC301,2
+BLEGATTCCHAR:"desc",0,3,2,1,0x2901
+BLEGATTCCHAR:"char",0,3,3,0xC302,8
+BLEGATTCCHAR:"desc",0,3,3,1,0x2901
+BLEGATTCCHAR:"char",0,3,4,0xC303,4
+BLEGATTCCHAR:"desc",0,3,4,1,0x2901
+BLEGATTCCHAR:"char",0,3,5,0xC304,8
+BLEGATTCCHAR:"char",0,3,6,0xC305,16
+BLEGATTCCHAR:"desc",0,3,6,1,0x2902
+BLEGATTCCHAR:"char",0,3,7,0xC306,32
+BLEGATTCCHAR:"desc",0,3,7,1,0x2902
OK
- Read a characteristic. Please note that the target characteristic's properties have to
include the read operation.
AT+BLEGATTCRD=0,3,1
Response:
+BLEGATTCRD:0,1,30
OK
📖 Note:
If the ESP32 Client reads the characteristic successfully, message +READ:<conn_index>,<remote BLE
address> will be prompted on the ESP32 Server side.
- Write a characteristic. Please note that the target characteristic's properties have to
include the write operation.
AT+BLEGATTCWR=0,3,3,,2
Response:
Espressif ! /! 97
82 2019.06
9. AT Commands Examples
!
OK
📖 Note:
4. Notify of a characteristic:
• ESP32 Client:
- Configure the characteristic's descriptor. Please note that the target characteristic's
properties have to include notifications.
AT+BLEGATTCWR=0,3,6,1,2
Response:
> // waiting for data, should input HEX string "01" here
OK
📖 Note:
• ESP32 Server:
- Notify of a characteristic. Please note that the target characteristic's properties have
to include notifications.
AT+BLEGATTSNTFY=0,1,6,3
Response:
> // waiting for data
OK
📖 Note:
• For the same service, the <srv_index> on the ESP32 Client side equals the <srv_index> on the ESP32
Server side + 2.
5. Indicate a characteristic:
• ESP32 Client:
Espressif ! /! 97
83 2019.06
9. AT Commands Examples
!
- Configure the characteristic's descriptor. Please note that the target characteristic's
property has to support the indicate operation.
AT+BLEGATTCWR=0,3,7,1,2
Response:
> // waiting for serial data, should input HEX string "02" here
OK
📖 Note:
• ESP32 Server:
- Indicate characteristic. Please note that the target characteristic's property has to
support the indicate operation.
AT+BLEGATTSIND=0,1,7,3
Response:
> // waiting for serial data
OK
📖 Note:
• For the same service, the <srv_index> on the ESP32 Client side equals the <srv_index> on the ESP32
Server side + 2.
⚠ Notice:
Download the service bin into the flash of the ESP32 Server.
• The download address of the "service bin" is the address of "ble_data" in esp32-at/at_customize.csv.
1. BLE initialization:
• ESP32 Server:
Espressif ! /! 97
84 2019.06
9. AT Commands Examples
!
Response:
OK
- Create services:
AT+BLEGATTSSRVCRE
Response:
OK
- Start services:
AT+BLEGATTSSRVSTART
Response:
OK
• ESP32 Client:
Response:
OK
Response:
+BLEADDR:24:0a:c4:03:f4:d6
OK
- Configure advertisement data (optional). Without the configuration, the payload of the
broadcasting packet will be empty.
AT+BLEADVDATA="0201060B09457370726573736966030302A0"
* 02 01 06 //<length>,<type>,<data>
* 0A 09 457370726573736966 //<length>,<type>,<data>
* 03 03 02A0 //<length>,<type>,<data>
*/
Response:
OK
Espressif ! /! 97
85 2019.06
9. AT Commands Examples
!
- Start advertising.
AT+BLEADVSTART
Response:
+BLEADDR:24:0a:c4:03:f4:d6
OK
• ESP32 Client:
- Start scanning:
AT+BLESCAN=1,3
Response:
+BLESCAN:<BLE address>,<rssi>,<adv_data>,<scan_rsp_data>
OK
Response:
OK
+BLECONN:0,"24:0a:c4:03:f4:d6"
📖 Notes:
3. Discover Services:
• ESP32 Server:
Response:
+BLEGATTSSRV:1,1,0xA002,1
OK
- Discover characteristics:
AT+BLEGATTSCHAR?
Response:
Espressif ! /! 97
86 2019.06
9. AT Commands Examples
!
+BLEGATTSCHAR:"char",1,1,0xC300
+BLEGATTSCHAR:"desc",1,1,1
+BLEGATTSCHAR:"char",1,2,0xC301
+BLEGATTSCHAR:"desc",1,2,1
+BLEGATTSCHAR:"char",1,3,0xC302
+BLEGATTSCHAR:"desc",1,3,1
OK
• ESP32 Client:
- Discover services:
AT+BLEGATTCPRIMSRV=0
Response:
+BLEGATTCPRIMSRV:0,1,0x1801,1
+BLEGATTCPRIMSRV:0,2,0x1800,1
+BLEGATTCPRIMSRV:0,3,0xA002,1
OK
⚠ Notice:
• When discovering services, the ESP32 Client will get two more default services (UUID:0x1800 and
0x1801) than what the ESP32 Server will get.
• So, for the same service, the <srv_index> received by the ESP32 Client equals the <srv_index>
received by ESP32 Server plus 2.
• For example, the <srv_index> of the above-mentioned service, 0xA002, is 3 when the ESP32 Client is
in the process of discovering services. But if the ESP32 Server tries to discover it with command
AT+BLEGATTSSRV?, the <srv_index> will be 1.
- Discover characteristics.
AT+BLEGATTCCHAR=0,3
Response:
+BLEGATTCCHAR:"char",0,3,1,0xC300,2
+BLEGATTCCHAR:"desc",0,3,1,1,0x2901
+BLEGATTCCHAR:"char",0,3,2,0xC301,2
+BLEGATTCCHAR:"desc",0,3,2,1,0x2901
+BLEGATTCCHAR:"char",0,3,3,0xC302,8
+BLEGATTCCHAR:"desc",0,3,3,1,0x2901
+BLEGATTCCHAR:"char",0,3,4,0xC303,4
+BLEGATTCCHAR:"desc",0,3,4,1,0x2901
+BLEGATTCCHAR:"char",0,3,5,0xC304,8
+BLEGATTCCHAR:"char",0,3,6,0xC305,16
+BLEGATTCCHAR:"desc",0,3,6,1,0x2902
+BLEGATTCCHAR:"char",0,3,7,0xC306,32
+BLEGATTCCHAR:"desc",0,3,7,1,0x2902
Espressif ! /! 97
87 2019.06
9. AT Commands Examples
!
OK
- Set a characteristic that enables writing permission to TX channel for sending data.
Set another characteristic that supports notification or indication to RX channel for
receiving data.
AT+BLESPPCFG=1,3,5,3,7
Response:
OK
Response:
OK
📖 Note:
After ESP32 Client enabling BLE SPP, data received from serial port will be transmitted to the BLE server
directly.
• ESP32 Server:
Response:
OK
Response:
OK
Espressif ! /! 97
88 2019.06
9. AT Commands Examples
!
📖 Notes:
• After ESP32 Server enables BLE SPP, the data received from serial port will be transmitted to the BLE
client directly.
• If the ESP32 Client does not enable BLE SPP first, or uses other device as BLE client, then the BLE
client needs to listen to the notification or indication first. For example, if the ESP32 Client does not
enable BLE SPP first, then it should enable listening with command AT+BLEGATTCWR=0,3,7,1,1 first
for the ESP32 Server to transmit successfully.
• For the same service, the <srv_index> on the ESP32 Client side equals the <srv_index> on the ESP32
Server side plus 2.
• Use AT+BLEGATTSNTFY for the server to pass on the SSID and password to the client.
• Call AT+BLEGATTSNTFY continuously for the server to transfer data to the client.
Espressif ! /! 97
89 2019.06
10. OTA Update
!
!
2. Click "Join" in the upper right corner of the webpage, and enter your name, email
address, and password.
!
3. Click on "Device" in the upper right corner of the webpage, and click on "Create" to
create a device.
Espressif ! /! 97
90 2019.06
10. OTA Update
!
!
4. A key is generated when the device is successfully created, as the figure below shows.
Espressif ! /! 97
91 2019.06
10. OTA Update
!
!
5. Use the key to compile your own OTA BIN. The process of configuring the AT OTA token
key is as follows:
Espressif ! /! 97
92 2019.06
10. OTA Update
!
⚠ Notice:
If using SSL OTA, the option "OTA based upon ssl" should be selected.
6. Click on "Product" to enter the webpage, as shown below. Click on the device created.
Enter version and corename under "ROM Deploy". Rename the BIN compiled in Step 5
as "ota.bin" and save the configuration.
Espressif ! /! 97
93 2019.06
10. OTA Update
!
!
7. Click on the ota.bin to save it as the current version.
Espressif ! /! 97
94 2019.06
10. OTA Update
!
!
8. Run the command AT+CIUPDATE. If the network is connected, OTA update w.
Espressif ! /! 97
95 2019.06
11. Q & A
!
11. 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-32.
!
• If possible, please provide the printed log information, such as:
Guru Meditation Error of type StoreProhibited occurred on core 0. Exception was unhandled.
Register dump:
Rebooting...
Espressif ! /! 97
96 2019.06
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.