Basic AT Commands

[中文]

Introduction

Important

The default AT firmware supports all the AT commands mentioned on this page.

AT: Test AT Startup

Execute Command

Command:

AT

Response:

OK

AT+RST: Restart a Module

Execute Command

Command:

AT+RST

Response:

OK

Set Command

Command:

AT+RST=<mode>

Response:

OK

Parameter

  • <mode>:

    • 0: Restart ESP32-C2 and the chip enters normal running mode.

    • 1: Restart ESP32-C2 and the chip enters firmware downloading mode.

Note

  • If you want to achieve the firmware download, you could send this set command to let ESP32-C2 enter the download mode, so that you can save Boot pins on the hardware.

AT+GMR: Check Version Information

Execute Command

Command:

AT+GMR

Response:

<AT version info>
<SDK version info>
<compile time>
<Bin version>

OK

Parameters

  • <AT version info>: information about the esp-at core library version, which is under the directory: esp-at/components/at/lib/. Code is closed source, no plan to open.

  • <SDK version info>: information about the esp-at platform sdk version, which is defined in file: esp-at/module_config/module_{platform}_default/IDF_VERSION

  • <compile time>: the time to compile the firmware.

  • <Bin version>: esp-at firmware version. Version information can be modified in menuconfig. (python build.py menuconfig -> Component config -> AT -> AT firmware version.)

Note

  • If you have any issues on esp-at firmware, please provide AT+GMR version information firstly.

Example

AT+GMR
AT version:2.2.0.0-dev(ca41ec4 - ESP32-C2 - Sep 16 2020 11:28:17)
SDK version:v4.0.1-193-ge7ac221b4
compile time(98b95fc):Oct 29 2020 11:23:25
Bin version:2.1.0(MINI-1)

OK

AT+CMD: List all AT commands and types supported in current firmware

Query Command

Command:

AT+CMD?

Response:

+CMD:<index>,<AT command name>,<support test command>,<support query command>,<support set command>,<support execute command>

OK

Parameters

  • <index>: AT command sequence number.

  • <AT command name>: AT command name.

  • <support test command>: 0 means not supported, 1 means supported.

  • <support query command>: 0 means not supported, 1 means supported.

  • <support set command>: 0 means not supported, 1 means supported.

  • <support execute command>: 0 means not supported, 1 means supported.

AT+GSLP: Enter Deep-sleep Mode

Set Command

Command:

AT+GSLP=<time>

Response:

<time>

OK

Parameter

  • <time>: the duration when the device stays in Deep-sleep. Unit: millisecond. When the time is up, the device automatically wakes up, calls Deep-sleep wake stub, and then proceeds to load the application.

    • 0 means restarting right now

    • the maximum Deep-sleep time is about 28.8 days (2 31-1 milliseconds)

Notes

  • The theoretical and actual time of Deep-sleep may be different due to external factors.

ATE: Configure AT Commands Echoing

Execute Command

Command:

ATE0

or

ATE1

Response:

OK

Parameters

  • ATE0: Switch echo off.

  • ATE1: Switch echo on.

AT+RESTORE: Restore Factory Default Settings

Execute Command

Command:

AT+RESTORE

Response:

OK

Notes

  • The execution of this command will restore all parameters saved in flash to factory default settings of the module.

  • The device will be restarted when this command is executed.

AT+TRANSINTVL: Set the Data Transmission Interval in Passthrough Mode

Query Command

Command:

AT+TRANSINTVL?

Response:

+TRANSINTVL:<interval>

OK

Set Command

Command:

AT+TRANSINTVL=<interval>

Response:

OK

Parameter

  • <interval>: Data transmission interval. Unit: milliseconds. Default value: 20. Range: [0,1000].

Note

  • In passthrough mode, if the data received by ESP32-C2 reaches or exceeds 2920 bytes, the data will be immediately sent in chunks of 2920 bytes. Otherwise, it will wait for <interval> milliseconds before being sent.

  • To optimize data transmission in cases where the data size is small and the data transmission interval is short, adjusting <interval> can be useful. A smaller <interval> reduces the delay in sending data to the protocol stack, but this may increase the number of times the protocol stack sends data to the network, thereby potentially decreasing the throughput performance to some extent.

Example

// Set to send immediately upon receiving data
AT+TRANSINTVL=0

AT+UART_CUR: Current UART Configuration, Not Saved in Flash

Query Command

Command:

AT+UART_CUR?

Response:

+UART_CUR:<baudrate>,<databits>,<stopbits>,<parity>,<flow control>

OK

Set Command

Command:

AT+UART_CUR=<baudrate>,<databits>,<stopbits>,<parity>,<flow control>

Response:

OK

Parameters

  • <baudrate>: UART baud rate

    • For ESP32-C2 devices, the supported range is 80 ~ 5000000.

  • <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

  • <flow control>: flow control

    • 0: flow control is not enabled

    • 1: enable RTS

    • 2: enable CTS

    • 3: enable both RTS and CTS

Notes

  • The Query Command will return actual values of UART configuration parameters, which may have minor differences from the set value because of the clock division.

  • The configuration changes will NOT be saved in flash.

  • To use hardware flow control, you need to connect CTS/RTS pins of your ESP32-C2. For more details, please refer to Hardware Connection or components/customized_partitions/raw_data/factory_param/factory_param_data.csv.

Example

AT+UART_CUR=115200,8,1,0,3

AT+UART_DEF: Default UART Configuration, Saved in Flash

Query Command

Command:

AT+UART_DEF?

Response:

+UART_DEF:<baudrate>,<databits>,<stopbits>,<parity>,<flow control>

OK

Set Command

Command:

AT+UART_DEF=<baudrate>,<databits>,<stopbits>,<parity>,<flow control>

Response:

OK

Parameters

  • <baudrate>: UART baud rate

    • For ESP32-C2 devices, the supported range is 80 ~ 5000000.

  • <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

  • <flow control>: flow control

    • 0: flow control is not enabled

    • 1: enable RTS

    • 2: enable CTS

    • 3: enable both RTS and CTS

Notes

  • The configuration changes will be saved in the NVS area, and will still be valid when the chip is powered on again.

  • To use hardware flow control, you need to connect CTS/RTS pins of your ESP32-C2. For more details, please refer to Hardware Connection or components/customized_partitions/raw_data/factory_param/factory_param_data.csv.

Example

AT+UART_DEF=115200,8,1,0,3

AT+SLEEP: Set the Sleep Mode

Query Command

Command:

AT+SLEEP?

Response:

+SLEEP:<sleep mode>

OK

Set Command

Command:

AT+SLEEP=<sleep mode>

Response:

OK

Parameter

  • <sleep mode>:

    • 0: Disable the sleep mode.

    • 1: Modem-sleep mode.

      • Only Wi-Fi mode.

        • RF will be periodically closed according to AP DTIM.

      • Only BLE mode.

        • When Bluetooth LE is advertising, RF will be periodically closed according to advertising interval.

        • When Bluetooth LE is connected, RF will be periodically closed according to connection interval.

    • 2: Light-sleep mode.

      • Null Wi-Fi mode.

        • CPU will automatically sleep and RF will be closed.

      • Only Wi-Fi mode.

        • CPU will automatically sleep and RF will be periodically closed according to listen interval set by AT+CWJAP.

      • Only Bluetooth mode.

        • When Bluetooth LE is advertising, CPU will automatically sleep and RF will be periodically closed according to advertising interval of Bluetooth.

        • When Bluetooth LE is connected, CPU will automatically sleep and RF will be periodically closed according to connection interval of Bluetooth.

    • Wi-Fi and Bluetooth coexistence mode.

      • CPU will automatically sleep and RF will be periodically closed according to power management module.

    • 3: Modem-sleep listen interval mode.

      • Only Wi-Fi mode.

        • RF will be periodically closed according to listen interval set by AT+CWJAP.

      • Only BLE mode.

        • When Bluetooth LE is advertising, RF will be periodically closed according to advertising interval.

        • When Bluetooth LE is connected, RF will be periodically closed according to connection interval.

Note

  • When sleep mode is disabled, you cannot initialize Bluetooth LE. When Bluetooth LE is initialized, you cannot disable sleep mode.

  • Modem-sleep mode and Light-sleep mode can be set under Wi-Fi mode or BLE mode, but in Wi-Fi mode, these two modes can only be set in station mode.

  • Before setting the Light-sleep mode, it is recommended to set the wakeup source in advance through the command AT+SLEEPWKCFG, otherwise ESP32-C2 can’t wake up and will always be in sleep mode.

  • After setting the Light-sleep mode, if the Light-sleep wakeup condition is not met, ESP32-C2 will automatically enter the sleep mode. When the Light-sleep wakeup condition is met, ESP32-C2 will automatically wake up from sleep mode.

  • For Light-sleep mode in BLE mode, users must ensure external 32KHz crystal oscillator, otherwise the Light-sleep mode will work in Modem-sleep mode.

  • For more examples, please refer to Sleep AT Examples.

Example

AT+SLEEP=0

AT+SYSRAM: Query Current Remaining Heap Size and Minimum Heap Size

Query Command

Command:

AT+SYSRAM?

Response:

+SYSRAM:<remaining RAM size>,<minimum heap size>
OK

Parameters

  • <remaining RAM size>: current remaining heap size. Unit: byte.

  • <minimum heap size>: minimum available heap size in the runtime. Unit: byte. When the parameter’s value is less than or close to 10 KB, the Wi-Fi and BLE functions of ESP32-C2 may be affected.

Example

AT+SYSRAM?
+SYSRAM:148408,84044
OK

AT+SYSMSG: Query/Set System Prompt Information

Query Command

Function:

Query the current system prompt information state.

Command:

AT+SYSMSG?

Response:

+SYSMSG:<state>
OK

Set Command

Function:

Configure system prompt information. If you need more fine-grained management of AT messages, please use the AT+SYSMSGFILTER command.

Command:

AT+SYSMSG=<state>

Response:

OK

Parameter

  • <state>:

    • Bit0: Prompt information when quitting Wi-Fi Passthrough Mode, Bluetooth LE SPP and Bluetooth SPP.

      • 0: Print no prompt information when quitting Wi-Fi Passthrough Mode, Bluetooth LE SPP and Bluetooth SPP.

      • 1: Print +QUITT when quitting Wi-Fi Passthrough Mode, Bluetooth LE SPP and Bluetooth SPP.

    • Bit1: Connection prompt information type.

      • 0: Use simple prompt information, such as XX,CONNECT.

      • 1: Use detailed prompt information, such as +LINK_CONN:status_type,link_id,ip_type,terminal_type,remote_ip,remote_port,local_port.

    • Bit2: Connection status prompt information for Wi-Fi Passthrough Mode, Bluetooth LE SPP and Bluetooth SPP.

      • 0: Print no prompt information.

      • 1: Print one of the following prompt information when Wi-Fi, socket, Bluetooth LE or Bluetooth status is changed:

      - "CONNECT\r\n" or the message prefixed with "+LINK_CONN:"
      - "CLOSED\r\n"
      - "WIFI CONNECTED\r\n"
      - "WIFI GOT IP\r\n"
      - "WIFI GOT IPv6 LL\r\n"
      - "WIFI GOT IPv6 GL\r\n"
      - "WIFI DISCONNECT\r\n"
      - "+ETH_CONNECTED\r\n"
      - "+ETH_DISCONNECTED\r\n"
      - the message prefixed with "+ETH_GOT_IP:"
      - the message prefixed with "+STA_CONNECTED:"
      - the message prefixed with "+STA_DISCONNECTED:"
      - the message prefixed with "+DIST_STA_IP:"
      - the message prefixed with "+BLECONN:"
      - the message prefixed with "+BLEDISCONN:"
      

Notes

  • The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.

  • If you set Bit0 to 1, it will prompt “+QUITT” when you quit Wi-Fi Passthrough Mode.

  • If you set Bit1 to 1, it will impact the information of command AT+CIPSTART and AT+CIPSERVER. It will supply “+LINK_CONN:status_type,link_id,ip_type,terminal_type,remote_ip,remote_port,local_port” instead of “XX,CONNECT”.

Example

// print no promt info when quitting Wi-Fi passthrough mode
// print detailed connection prompt info
// print no prompt info when the connection status is changed
AT+SYSMSG=2

or

// In the transparent transmission mode, a prompt message will be printed when the Wi-Fi, socket, Bluetooth LE or Bluetooth status changes
AT+SYSMSG=4

AT+SYSMSGFILTER: Enable or Disable the system message Filter

Query Command

Function:

Query the current system message filtering state.

Command:

AT+SYSMSGFILTER?

Response:

+SYSMSGFILTER:<enable>

OK

Set Command

Function:

Enable or disable the system message filter.

Command:

AT+SYSMSGFILTER=<enable>

Response:

OK

Parameter

  • <enable>:

    • 0: Disable system message filtering. System default value. When disabled, system messages will not be filtered by the set filter.

    • 1: Enable system message filtering. When it is enabled, the data matching the regular expression will be filtered out by AT, and MCU will not receive it, whereas the unmatched data will be sent to the MCU as it is.

Notes

  • Please use AT+SYSMSGFILTERCFG to set up system message filters. Then, use this command to enable the system message filtering to achieve more sophisticated system message management.

  • Please use the AT+SYSMSGFILTER=1 command with caution. It is recommended that you disable the system message filtering promptly after enabling it to prevent the over-filtering of AT system messages.

  • Before entering the Passthrough Mode, it is strongly recommended to use the AT+SYSMSGFILTER=0 command to disable system message filtering.

  • If you are working on secondary development of AT project, please use the following APIs to transmit data via the AT command port.

// Data transmission via native AT command port. Data will not be filtered by AT+SYSMSGFILTER command, and AT will not actively wake up MCU before sending data (MCU wake-up function is set by AT+USERWKMCUCFG).
int32_t esp_at_port_write_data_without_filter(uint8_t data, int32_t len);

// Data transmission via AT command port with a filtering function. Data will be filtered by AT+SYSMSGFILTER command (if enabled), and AT will not actively wake up MCU before sending data (MCU wake-up function is set by AT+USERWKMCUCFG command).
int32_t esp_at_port_write_data(uint8_t data, int32_t len);

// Data transmission via AT command port with wake-up MCU function. Data will not be filtered by AT+SYSMSGFILTER command, and AT will actively wake up MCU before sending data (MCU wake-up function is set by AT+USERWKMCUCFG command).
int32_t esp_at_port_active_write_data_without_filter(uint8_t data, int32_t len);

// Data transmission via AT command port with wake-up MCU function and filtering function. Data will be filtered by AT+SYSMSGFILTER command (if enabled), and AT will actively wake up MCU before sending data (MCU wake-up function is set by AT+USERWKMCUCFG command).
int32_t esp_at_port_active_write_data(uint8_t data, int32_t len);

Example

For detailed examples, refer to system message filtering example.

AT+SYSMSGFILTERCFG: Query/Set the system message Filters

Query the Filters

Query Command

Command:

AT+SYSMSGFILTERCFG?

Response:

+SYSMSGFILTERCFG:<index>,"<head_regexp>","<tail_regexp>"

OK

Parameters

  • <index>: The index of filters.

  • <”head_regexp”>: The regular expression of header.

  • <”tail_regexp”>: The regular expression of tail.

Clear all the Filters

Set Command

Command:

AT+SYSMSGFILTERCFG=<operator>

Response:

OK

Parameter

  • <operator>:

    • 0: Clear all the filters. After clearing, you can free some heap size occupied by the filters.

Example

// Clear all the filters
AT+SYSMSGFILTERCFG=0

Add a Filter

Set Command

Command:

AT+SYSMSGFILTERCFG=<operator>,<head_regexp_len>,<tail_regexp_len>

Response:

OK

>

The symbol > indicates that AT is ready for receiving regular expressions from AT command port. You should enter the head regular expression and the tail regular expression. When the length reaches the <head_regexp_len> + <tail_regexp_len> value, the regular expression integrity check starts.

If the regular expression integrity check fails or the addition of filter fails, AT returns:

ERROR

If the integrity of the regular expression is verified successfully and the filter is added successfully, AT returns:

OK

Parameters

  • <operator>:

    • 1: Add a filter. A filter contains a header regular expression and a tail regular expression.

  • <head_regexp_len>: The length of the header regular expression. Range: [0,64]. If it is set to 0, the matching of the regular expression in the header is ignored, and <tail_regexp_len> cannot be 0.

  • <tail_regexp_len>: The length of the tail regular expression. Range: [0,64]. If it is set to 0, the matching of the regular expression in the tail is ignored, and <head_regexp_len> cannot be 0.

Notes

  • Please use this command to set up system message filters. Then, use AT+SYSMSGFILTER to enable the system message filtering to achieve more sophisticated system message management.

  • For more details about header and tail regular expression format, refer to POSIX Basic Regular Expression (BRE).

  • In order to avoid system message (TX data of AT command port) being filtered incorrectly, it is strongly recommended that the header regular expression starts with ^ and the tail regular expression ends with $.

  • Only when the system message matches both the header regular expression and the tail regular expression at the same time is the system message filtered. After filtering, the data matching the regular expression will be filtered out by AT, and MCU will not receive it, whereas the unmatched data will be sent to the MCU as it is.

  • When the system message matches one filter, it will not continue to match other filters.

  • When the system message matches the filter, the system message will not be cached, that is, the previous system message and the current system message will not be combined for matching.

  • For devices with large throughput, it is strongly recommended that you limit the number of filters and disable system message filtering using the AT+SYSMSGFILTER=0 command in time.

Example

// Set the filter to filter out the "WIFI CONNECTED" system message report
AT+SYSMSGFILTERCFG=1,17,0
// After the command returns OK and >, enter "^WIFI CONNECTED\r\n" (Note: \r\n are 2 bytes, corresponding to 0D 0A in ASCII code)

// Enable system message filtering
AT+SYSMSGFILTER=1

// Test filtering function
AT+CWMODE=1
AT+CWJAP="ssid","password"
// AT no longer outputs "WIFI CONNECTED" system message report

For more examples of filtering system messages, refer to system message filter example.

Delete a Filter

Set Command

Command:

AT+SYSMSGFILTERCFG=<operator>,<head_regexp_len>,<tail_regexp_len>

Response:

OK

>

The symbol > indicates that AT is ready for receiving regular expressions from AT command port. You should enter the head regular expression and the tail regular expression. When the length reaches the <head_regexp_len> + <tail_regexp_len> value, the regular expression integrity check starts.

If the regular expression integrity check fails or the addition of filter fails, AT returns:

ERROR

If the integrity of the regular expression is verified successfully and the filter is added successfully, AT returns:

OK

Parameters

  • <operator>:

    • 2: Delete a filter.

  • <head_regexp_len>: The length of the header regular expression. Range: [0,64]. If it is set to 0, the <tail_regexp_len> cannot be 0.

  • <tail_regexp_len>: The length of the header regular expression. Range: [0,64]. If it is set to 0, the <head_regexp_len> cannot be 0.

Notes

  • The filter to be deleted should be in the added filters.

Example

// Delete the filter added above
AT+SYSMSGFILTERCFG=2,17,0
// After the command returns OK and >, enter "^WIFI CONNECTED\r\n" (Note: \r\n are 2 bytes, corresponding to 0D 0A in ASCII code)

// Test filtering function
AT+CWMODE=1
AT+CWJAP="ssid","password"
// AT will output "WIFI CONNECTED" system message report again

AT+SYSFLASH: Query/Set User Partitions in Flash

Query Command

Function:

Query user partitions in flash.

Command:

AT+SYSFLASH?

Response:

+SYSFLASH:<partition>,<type>,<subtype>,<addr>,<size>
OK

Set Command

Function:

Read/write the user partitions in flash.

Command:

AT+SYSFLASH=<operation>,<partition>,<offset>,<length>

Response:

+SYSFLASH:<length>,<data>
OK

Parameters

  • <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

  • <type>: type of user partition

  • <subtype>: subtype of user partition

  • <addr>: address of user partition

  • <size>: size of user partition

Notes

  • Please make sure that you have downloaded at_customize.bin before using this command. For more details, please refer to How to Customize Partitions.

  • When erasing a partition, please erase the target partition in its entirety. This can be done by omitting the parameters <offset> and <length>. For example, command AT+SYSFLASH=0,"mfg_nvs" can erase the entire “mfg_nvs” user partition.

  • The introduction to partitions is in ESP-IDF Partition Tables.

  • If the operator is write, wrap return > after the write command, then you can send the data that you want to write. The length should be parameter <length>.

  • If the operator is write, please make sure that you have already erased this partition.

  • If you want to modify some data in the “mfg_nvs” partition, please use the AT+SYSMFG command (key-value pairs operation). If you want to modify total “mfg_nvs” partition, please use the AT+SYSFLASH command (partition operation).

Example

// erase the "mfg_nvs" partition in its entirety.
AT+SYSFLASH=0,"mfg_nvs",4096,8192

// write a new "mfg_nvs" partition (size: 0x1C000) at offset 0 of the "mfg_nvs" partition.
AT+SYSFLASH=1,"mfg_nvs",0,0x1C000

AT+SYSMFG: Query/Set manufacturing nvs User Partitions

Query Command

Function:

Query all namespaces of manufacturing nvs user partitions.

Command:

AT+SYSMFG?

Response:

+SYSMFG:<"namespace">

OK

Erase a namespace or key-value pair

Set Command

Command:

AT+SYSMFG=<operation>,<"namespace">[,<"key">]

Response:

OK

Parameters

  • <operation>:

    • 0: erase operation

    • 1: read operation

    • 2: write operation

  • <”namespace”>: namespace name.

  • <”key”>: key name. If this parameter is omitted, all key-value pairs of current <"namespace"> will be erased. Otherwise, only the current key-value pair is erased.

Note

Example

// Erase all key-value pairs of client_cert namespace (That is, erase all client certificates)
AT+SYSMFG=0,"client_cert"

// Erase the client_cert.0 key-value pair of client_cert namespace (That is, erase the first client certificate)
AT+SYSMFG=0,"client_cert","client_cert.0"

Read a namespace or key-value pair

Set Command

Command:

AT+SYSMFG=<operation>[,<"namespace">][,<"key">][,<offset>,<length>]

Response:

When <"namespace"> and subsequent parameters are omitted, it returns:

+SYSMFG:<"namespace">

OK

When <"key"> and subsequent parameters are omitted, it returns:

+SYSMFG:<"namespace">,<"key">,<type>

OK

In other cases, it returns:

+SYSMFG:<"namespace">,<"key">,<type>,<length>,<value>

OK

Parameters

  • <operation>:

    • 0: erase operation

    • 1: read operation

    • 2: write operation

  • <”namespace”>: namespace name.

  • <”key”>: key name.

  • <offset>: The offset of the value.

  • <length>: The length of the value.

  • <type>: The type of the value.

    • 1: u8

    • 2: i8

    • 3: u16

    • 4: i16

    • 5: u32

    • 6: i32

    • 7: string

    • 8: binary

  • <value>: The data of the value.

Note

Example

// Read all namespaces
AT+SYSMFG=1

// Read all key-value pairs of client_cert namespace
AT+SYSMFG=1,"client_cert"

// Read the value of client_cert.0 key in client_cert namespace
AT+SYSMFG=1,"client_cert","client_cert.0"

// Read the value of client_cert.0 key in client_cert namespace, from offset: 100 place, read 200 bytes
AT+SYSMFG=1,"client_cert","client_cert.0",100,200

Write a key-value pair to a namespace

Set Command

Command:

AT+SYSMFG=<operation>,<"namespace">,<"key">,<type>,<value>

Response:

OK

Parameters

  • <operation>:

    • 0: erase operation

    • 1: read operation

    • 2: write operation

  • <”namespace”>: namespace name.

  • <”key”>: key name.

  • <type>: The type of the value.

    • 1: u8

    • 2: i8

    • 3: u16

    • 4: i16

    • 5: u32

    • 6: i32

    • 7: string

    • 8: binary

  • <value>: It means differently depending on the parameter <type>:

    • If <type> is between 1-6, <value> represents the real value.

    • If <type> is between 7-8, <value> represents the length of the value. After you send the command, AT will return >. This symbol indicates that AT is ready for receiving data. You should enter the data of designated length. When the data length reaches the <value> value, the key-value pair will be written to the namespace immediately.

Note

  • Please refer to the Non-Volatile Storage (NVS) documentation to understand the concept of namespace and key-value pairs.

  • Before writing, you do not need to manually erase namespaces or key-value pairs (NVS will automatically erase key-value pairs as needed).

  • If you want to modify some data in the “mfg_nvs” partition, please use the AT+SYSMFG command (key-value pairs operation). If you want to modify total “mfg_nvs” partition, please use the AT+SYSFLASH command (partition operation).

Example

// Write a new value for client_cert.0 key into client_cert namespace (That is, update the 0th client certificate)
AT+SYSMFG=2,"client_cert","client_cert.0",8,1164

// Wait until AT command port returns ``>``, and then write 1164 bytes

AT+RFPOWER: Query/Set RF TX Power

Query Command

Function:

Query the RF TX Power.

Command:

AT+RFPOWER?

Response:

+RFPOWER:<wifi_power>
OK

Set Command

Command:

AT+RFPOWER=<wifi_power>

Response:

OK

Parameters

  • <wifi_power>: the unit is 0.25 dBm. For example, if you set the value to 78, the actual maximum RF Power value is 78 * 0.25 dBm = 19.5 dBm. After you configure it, please confirm the actual value by entering the command AT+RFPOWER?.

    • For ESP32-C2 devices, the range is [40,84]:

      set value

      get value

      actual value

      actual dBm

      [40,80]

      <set value>

      <set value>

      <set value> * 0.25

      [81,84]

      <set value>

      80

      20

Note

  • When Wi-Fi is turned off or not initialized, the AT+RFPOWER command cannot set or query the RF TX Power of Wi-Fi. Similarly, when Bluetooth LE is not initialized, the command cannot set or query that of Bluetooth LE, either.

  • Since the RF TX Power is actually divided into several levels, and each level has its own value range, the wifi_power value queried by the esp_wifi_get_max_tx_power may differ from the value set by esp_wifi_set_max_tx_power and is no larger than the set value.

  • It is recommended to set the two parameters <ble_scan_power> and <ble_conn_power> to the same value as the <ble_adv_power> parameter. Otherwise, they will be automatically adjusted to the value of <ble_adv_power>.

AT+SYSROLLBACK: Roll Back to the Previous Firmware

Execute Command

Command:

AT+SYSROLLBACK

Response:

OK

Note

  • ESP32C2-4MB AT firmware supports this command, but ESP32C2-2MB AT firmware does not due to the compressed OTA firmware.

  • This command will not upgrade via OTA. It only rolls back to the firmware which is in the other OTA partition.

AT+SYSTIMESTAMP: Query/Set Local Time Stamp

Query Command

Function:

Query the time stamp.

Command:

AT+SYSTIMESTAMP?

Response:

+SYSTIMESTAMP:<Unix_timestamp>
OK

Set Command

Function:

Set local time stamp. It will be the same as SNTP time when the SNTP time is updated.

Command:

AT+SYSTIMESTAMP=<Unix_timestamp>

Response:

OK

Parameter

  • <Unix-timestamp>: Unix timestamp. Unit: second.

Example

AT+SYSTIMESTAMP=1565853509    //2019-08-15 15:18:29

AT+SYSLOG: Enable or Disable the AT Error Code Prompt

Query Command

Function:

Query whether the AT error code prompt is enabled or not.

Command:

AT+SYSLOG?

Response:

+SYSLOG:<status>

OK

Set Command

Function:

Enable or disable the AT error code prompt.

Command:

AT+SYSLOG=<status>

Response:

OK

Parameter

  • <status>: enable or disable

    • 0: disable

    • 1: enable

Example

// enable AT error code prompt
AT+SYSLOG=1

OK
AT+FAKE
ERR CODE:0x01090000

ERROR
// disable AT error code prompt
AT+SYSLOG=0

OK
AT+FAKE
// No `ERR CODE:0x01090000`

ERROR

The error code is a 32-bit hexadecimal value and defined as follows:

category

subcategory

extension

bit32 ~ bit24

bit23 ~ bit16

bit15 ~ bit0

  • category: stationary value 0x01.

  • subcategory: error type.

    Subcategory of Error Code

    Error Type

    Error Code

    Description

    ESP_AT_SUB_OK

    0x00

    OK

    ESP_AT_SUB_COMMON_ERROR

    0x01

    reserved

    ESP_AT_SUB_NO_TERMINATOR

    0x02

    terminator character not found (“rn” expected)

    ESP_AT_SUB_NO_AT

    0x03

    Starting AT not found (or at, At or aT entered)

    ESP_AT_SUB_PARA_LENGTH_MISMATCH

    0x04

    parameter length mismatch

    ESP_AT_SUB_PARA_TYPE_MISMATCH

    0x05

    parameter type mismatch

    ESP_AT_SUB_PARA_NUM_MISMATCH

    0x06

    parameter number mismatch

    ESP_AT_SUB_PARA_INVALID

    0x07

    the parameter is invalid

    ESP_AT_SUB_PARA_PARSE_FAIL

    0x08

    parse parameter fail

    ESP_AT_SUB_UNSUPPORT_CMD

    0x09

    the command is not supported

    ESP_AT_SUB_CMD_EXEC_FAIL

    0x0A

    the command execution failed

    ESP_AT_SUB_CMD_PROCESSING

    0x0B

    processing of previous command is in progress

    ESP_AT_SUB_CMD_OP_ERROR

    0x0C

    the command operation type is error

  • extension: error extension information. There are different extensions for different subcategory. For more information, please see the components/at/include/esp_at.h.

For example, the error code ERR CODE:0x01090000 means the command is not supported.

AT+SLEEPWKCFG: Set the Light-sleep Wakeup Source and Awake GPIO

Set Command

Command:

AT+SLEEPWKCFG=<wakeup source>,<param1>[,<param2>]

Response:

OK

Parameters

  • <wakeup source>:

    • 0: reserved, not supported now.

    • 1: reserved, not supported now.

    • 2: wakeup by GPIO.

  • <param1>:

    • If the wakeup source is a timer, it means the time before wakeup. Unit: millisecond.

    • If the wakeup source is GPIO, it means the GPIO number.

  • <param2>:

    • If the wakeup source is GPIO, it means the wakeup level:

    • 0: low level.

    • 1: high level.

Example

// GPIO12 wakeup, low level
AT+SLEEPWKCFG=2,12,0

AT+SYSSTORE: Query/Set Parameter Store Mode

Query Command

Function:

Query the AT parameter store mode.

Command:

AT+SYSSTORE?

Response:

+SYSSTORE:<store_mode>

OK

Set Command

Command:

AT+SYSSTORE=<store_mode>

Response:

OK

Parameter

  • <store_mode>:

    • 0: command configuration is not stored into flash.

    • 1: command configuration is stored into flash. (Default)

Examples

AT+SYSSTORE=0
AT+CWMODE=1  // Not stored into flash
AT+CWJAP="test","1234567890" // Not stored into flash

AT+SYSSTORE=1
AT+CWMODE=3  // Stored into flash
AT+CWJAP="test","1234567890" // Stored into flash

AT+SYSREG: Read/Write the Register

Set Command

Command:

AT+SYSREG=<direct>,<address>[,<write value>]

Response:

+SYSREG:<read value>    // Only in read mode
OK

Parameters

  • <direct>: read or write register.

    • 0: read register.

    • 1: write register.

  • <address>: (uint32) register address. You can refer to Technical Reference Manuals.

  • <write value>: (uint32) write value (only in write mode).

Note

  • AT does not check address. Make sure that the registers you are operating on are valid.