1. Introduction
This article mainly introduces the AT command set and how to use it. The command set includes: basic AT commands, Wi-Fi function AT commands, TCP/IP toolbox AT commands, and Bluetooth® LE related AT commands.
Type | Format | Description |
---|---|---|
Query instruction | AT+<x>? | This instruction is used to return the value of the current parameter |
Set instruction | AT+<x>=<···> | This instruction is used to set user-defined parameters |
Execute instructions | AT+<x> | This instruction is used to execute the function of variable parameter immutability inside the module |
- Not every AT command has the three types mentioned above.
- Currently, only strings and integer numbers are supported as input parameters in AT commands.
- Angle brackets < > designate parameters that can not be omitted.
- Square brackets [ ] designate optional parameters that can be omitted. The default value of the parameter will be used instead when you omit it.
- If the parameter you want to omit is followed by a parameter(s), you must give a , to indicate it. for example: AT+CWJAP="ssid","password",,1.
- String values need to be included in double quotation marks, such as: AT+CWSAP="AP-NAME","12345678".
- Each AT command should not exceed 256 bytes in length.
- AT commands end with a new-line (CR-LF), so the serial tool should be set to 'New Line Mode'.
1.1. AT Messages
There are two types of AT messages returned from the AT command port: AT responses messages and AT message reports.
1.1.1. Response Messages
Each AT command input returns response messages to tell the sender the result of the AT command. The last message of a response will always be either "OK" or "ERROR".
AT Response Messages | Description |
---|---|
OK | AT command process done and return OK |
ERROR | AT command error or error occurred during the execution |
SEND OK | Data has been sent to the protocol stack |
SEND FAIL | Error occurred during sending the data to the protocol stack |
+<Command Name>:...
|
Response to the sender that describes AT command process results in details |
1.1.2. Message Reports
AT will report important state changes or messages in the system.
AT Message Report | Description |
---|---|
ready | The AT firmware is ready |
busy p... | Busy processing. The system is in process of handling the previous command, thus CANNOT accept the new input |
ERR CODE:<0x%08x>
|
Error code for different commands |
+CW:CONNECTING | Wi-Fi station interface is connecting to an AP |
+CW:CONNECTED | Wi-Fi station interface has connected to an AP |
+CW:ERROR | Wi Fi station interface connection to AP failed |
+CW:GOTIP | Wi-Fi station interface has got the IPv4 address |
+CW:DISCONNECTED | Wi-Fi station interface has disconnected from an AP |
+CW:STA_CONNECTED <sta_mac> | A station has connected to the Wi-Fi softAP interface of AT |
+CW:STA_DISCONNECTED <sta_mac> | A station disconnected from the Wi-Fi softAP interface of AT |
+CW:DIST_STA_IP <sta_mac>,<sta_ip> | The Wi-Fi softAP interface of AT distributes an IP address to the station |
+CW:SCAN_DONE | Wi-Fi scan completion event |
+CIP:[<conn_id>,]CONNECTED | A network connection of which ID is <conn_id> is established (ID=0 by default)
|
+CIP:[<conn_id>,]DISCONNECTED | A network connection of which ID is <conn_id> ends (ID=0 by default)
|
+LINK_CONN | Detailed connection information of TCP/UDP/SSL |
> | AT is waiting for more data to be received |
Recv <xxx> bytes
|
AT has already received <xxx> bytes from the AT command port
|
+IPD | In non-passthrough mode, AT has received data from the network. The specific data format is shown below the table |
+MQTT:CONNECTED,<linkid> | MQTT has connected to Brokers |
+MQTT:DISCONNECTED,<linkid> | MQTT has been disconnected from Brokers |
+MQTT:SUBRECV,<LinkID>,<topic_length>,<data_length>,<"topic">,<data> | When AT receives MQTT messages of the subscribed topic |
Data in passthrough mode | In passthrough mode, data has been received from the network or Bluetooth |
SEND CANCELLED | Cancel sending data in Wi-Fi normal transmission mode |
+BLE:CONNECTED | A Bluetooth LE connection established |
+BLE:DISCONNECTED | A Bluetooth LE connection ends |
+BLE:CONNPARAM | A Bluetooth LE connection parameters update |
+BLE:GATTREAD | A read operation from Bluetooth LE connection |
+BLE:GATTWRITE | A write operation from Bluetooth LE connection |
+BLE:SRV | Bluetooth LE connection services found |
+BLE:SRVCHAR | Bluetooth LE connection characteristics found |
+BLE:INDICATION | Bluetooth service indication status: 0: disable 1: enable 2: ack |
+BLE:NOTIFICATION | Bluetooth service notification status |
+BLE:NOTIDATA | Bluetooth service recv notification/indication data |
+BLE:MTUSIZE | Bluetooth MTU SIZE update |
+BLE:PAIRINGFAILED | Bluetooth Pairing failed |
+BLE:PAIRINGCOMPLETED | Bluetooth Pairing completed |
+BLE:PAIRINGCONFIRM | Bluetooth Pairing confirm notification |
+BLE:PASSKEYENTRY | Bluetooth Pairing passkey notification |
+BLE:PASSKEYDISPLAY | Bluetooth Pairing passkey display notification |
+BLE:BASLEVEL | Bluetooth BAS profile level |
+QUITT | AT quits from the Wi-Fi Passthrough Mode |
In non-passthrough mode, the format of data received from the network by AT:
If AT+CIPMUX=0 and AT+CIPRECVTYPE=1, print: +IPD:<length>
If AT+CIPMUX=1 and AT+CIPRECVTYPE=<link_id>,1, print: +IPD:<link_id>,<length>
If AT+CIPMUX=0, AT+CIPRECVTYPE=0, and AT+CIPDINFO=0, print: +IPD:<length>,<data>
If AT+CIPMUX=1, AT+CIPRECVTYPE=<link_id>,0, AT+CIPDINFO=0, print: +IPD:<link_id>,<length>,<data>
If AT+CIPMUX=0, AT+CIPRECVTYPE=0, AT+CIPDINFO=1, print: +IPD:<length>,<"remote_ip">,<remote_port>,<data>
If AT+CIPMUX=1, AT+CIPRECVTYPE=<link_id>,0, AT+CIPDINFO=1, print: +IPD:<link_id>,<length>, <"remote_ip">, <remote_port>,<data>
link_id refers to the connection ID, length represents the data length, remote_ip indicates the remote IP address, remote_port represents the remote port number, and data represents the data.
When it is an SSL connection, in the passive receive mode (AT+CIPRECVTYPE=1), the length returned by the AT command may not match the actual readable SSL data length. This is because AT prioritizes returning the readable data length at the SSL layer. If the readable data length at the SSL layer is 0, AT will return the readable data length at the socket layer.
2. Basic AT commands
2.1. Overview of basic AT commands
Command | Description |
---|---|
AT | Test AT startup |
AT+GMR | View version information |
AT+CMD? | List all AT commands and types supported in current firmware |
AT+RST | Restart the module |
AT+RESTORE | Reset |
ATE | Configure AT commands echoing |
AT+SYSRAM? | Query current remaining heap size and lwip remaining heap size |
AT+SYSMSG? | Query/Set system prompt information |
AT+SYSLOG? | Enable or disable the AT error code prompt |
AT+SYSSTORE? | Query/Set parameter store mode |
AT+TEMP? | Query the temperature of the chip |
AT+EFUSE-W | Efuse write operation |
AT+EFUSE-R | Efuse read operation |
AT+EFUSE-CFM | Efuse write confirmation will directly write into Efuse |
AT+FLASH-W | Flash write operation |
AT+FLASH-R | Flash read operation |
AT+FLASH-E | Flash erase operation |
AT+IOPUPD | Initialize GPIO pins as pull-up/pull-down mode |
AT+IOOUT | Set GPIO output high/low level |
AT+IOIN | Query/Set GPIO in the input mode |
AT+IORST | Reset a GPIO's analog input mode |
AT+PART | Get information about the partitions |
AT+OTASTART | Start OTA transmission |
AT+OTASEND | Send OTA data |
AT+OTAFIN | OTA transmission completed |
AT+FS | Filesystem Operations |
AT+GMAC | Query the MAC addresses of 3 slots in efuse |
AT+PN | Query the part number |
AT+VBAT | Query the voltage value at the supply pin (unit: mV) |
2.2. Basic AT command description
2.2.1. AT
Function: Test AT startup.
2.2.1.1. Execute Command
Command:
AT
Response:
OK
2.2.2. AT+GMR
Function: View version information.
2.2.2.1. Execute Command
Command:
AT+GMR
Response:
<AT version info> <macsw version info> <phyrf version info> <bthost version info> <btblecontroller version info> <SDK version info> <compile time> OK
2.2.2.2. Parameters
- <AT version info>: AT version information
- <macsw version info>: macsw component version information
- <phyrf version info>: phyrf component version information
- <bthost version info>: bthost component version information
- <btblecontroller version info>: btblecontroller component version information
- <SDK version info>: SDK version information
- <compile time>: Compile time
2.2.2.3. Example
AT+GMR AT version:1.0.0.1(Apr 30 2025 11:47:03) component_version_macsw_1.6.38 lib_version_phyrf_00f7ad715 component_version_btble_1.8.25 lib_version_btblecontroller_1.6.89 component_version_sdk_2.0.75 compile time:Apr 30 2025 11:46:58 OK
2.2.3. AT+RST
Function: Restart the module.
2.2.3.1. Execute Command
Command:
AT+RST
Response:
OK
2.2.4. AT+RESTORE
Function: Restore factory settings.
2.2.4.1. Execute Command
Command:
AT+RESTORE
Response:
OK
2.2.5. AT+CMD?
Function: List all AT commands and types supported in current firmware.
2.2.5.1. Query Command
Command:
AT+CMD?
Response:
+CMD:<index>,<AT command name>,<support test command>,<support query command>,<support set command>,<support execute command> OK
2.2.5.2. 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.
2.2.5.3. Example
AT+CMD? +CMD:0,\"AT\",0,0,0,1 +CMD:1,\"AT+RST\",0,0,0,1 +CMD:2,\"AT+GMR\",0,0,0,1 +CMH:3,\"AT+CMD\",0,1,0,0 +CMD:4,\"ATE0\",0,0,0,1 +CMD:5,\"ATE1\",0,0,0,1 +CMD:6,\"AT+RESTORE\",0,0,0,1 +CMD:7,\"AT+SLEEP\",0,1,1,0 OK
2.2.6. ATE
Function: Configure AT Commands Echoing.
2.2.6.1. Execute Command
Command:
ATE0
or
ATE1
Response:
OK
2.2.6.2. Parameters
- ATE0: Switch echo off.
- ATE1: Switch echo on.
2.2.7. AT+SYSRAM?
Function: Query current remaining Heap Size and lwip remaining Heap Size.
2.2.7.1. Query Command
Command:
AT+SYSRAM?
Response:
+SYSRAM:<remaining RAM size>,<lwip heap size> OK
2.2.7.2. Parameters
- <remaining RAM size>: current system remaining heap size. Unit: byte.
- <lwip heap size>: current lwip remaining heap size. Unit: byte.
2.2.7.3. Example
AT+SYSRAM? +SYSRAM:148408,84044 OK
2.2.8. AT+SYSMSG?
Function: Query/Set system prompt information.
2.2.8.1. Query Command
Function:
Query the current system prompt information state.
Command:
AT+SYSMSG?
Response:
+SYSMSG:<state> OK
2.2.8.2. Set Command
Function:
Configure system prompt information.
Command:
AT+SYSMSG=<state>
Response:
OK
2.2.8.3. Parameter
- <state>:
Bit0: Prompt information when quitting Wi-Fi :term: Passthrough Mode.
- 0: Print no prompt information when quitting Wi-Fi :term: Passthrough Mode.
- 1: Print
+QUITT
when quitting Wi-Fi :term: Passthrough Mode.
Bit1: Connection prompt information type.
- 0: Use simple prompt information, such as
+CIP:XX,CONNECTED
. - 1: Use detailed prompt information, such as
+LINK_CONN:status_type,link_id,ip_type,terminal_type,remote_ip,remote_port,local_port
.
- 0: Use simple prompt information, such as
Bit2: Connection status prompt information for Wi-Fi :term: 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:
- "+CIP:CONNECTED\r\n" or the message prefixed with "+LINK_CONN:" - "+CIP:DISCONNECTED\r\n" - "+CW:CONNECTING\r\n" - "+CW:CONNECTED\r\n" - "+CW:GOTIP\r\n" - "+CW:ERROR\r\n" - "+CW:DISCONNECTED\r\n" - "+CW:SCAN_DONE\r\n" - the message prefixed with "+CW:STA_CONNECTED" - the message prefixed with "+CW:STA_DISCONNECTED" - the message prefixed with "+CW:DIST_STA_IP" - the message prefixed with "+CW:SCAN_DONE" - the message prefixed with "+BLECONN" - the message prefixed with "+BLEDISCONN"
2.2.8.4. Notes
- The configuration changes will be saved in the easyflash area if
AT+SYSSTORE=1
. - If you set Bit0 to 1, it will prompt "+QUITT" when you quit Wi-Fi :term: 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 "+CIP:XX,CONNECTED".
2.2.8.5. 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
2.2.9. AT+SYSLOG?
Function: Enable or Disable the AT Error Code Prompt.
2.2.9.1. Query Command
Function:
Query whether the AT error code prompt is enabled or not.
Command:
AT+SYSLOG?
Response:
+SYSLOG:<status> OK
2.2.9.2. Set Command
Function:
Enable or disable the AT error code prompt.
Command:
AT+SYSLOG=<status>
Response:
OK
2.2.9.3. Parameter
- <status>: enable or disable
- 0: disable
- 1: enable
2.2.9.4. 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 AT_SUB_OK 0x00 OK AT_SUB_COMMON_ERROR 0x01 reserved AT_SUB_NO_TERMINATOR 0x02 terminator character not found ("rn" expected) AT_SUB_NO_AT 0x03 Starting AT not found (or at, At or aT entered) AT_SUB_PARA_LENGTH_MISMATCH 0x04 parameter length mismatch AT_SUB_PARA_TYPE_MISMATCH 0x05 parameter type mismatch AT_SUB_PARA_NUM_MISMATCH 0x06 parameter number mismatch AT_SUB_PARA_VALUE_INVALID 0x07 the parameter value is out of range AT_SUB_PARA_PARSE_FAIL 0x08 parse parameter fail AT_SUB_UNSUPPORT_CMD 0x09 the command is not supported AT_SUB_CMD_EXEC_FAIL 0x0A the command execution failed AT_SUB_CMD_PROCESSING 0x0B processing of previous command is in progress AT_SUB_CMD_OP_ERROR 0x0C the command operation type is error AT_SUB_NO_MEMORY 0x0D Memory allocation error AT_SUB_NO_RESOURCE 0x0E Resource allocation error AT_SUB_TIMEOUT 0x0F Operation timed out AT_SUB_NOT_ALLOWED 0x10 Operation not allowed AT_SUB_NOT_INIT 0x11 Operation not initialized AT_SUB_IO_ERROR 0x12 Device IO error AT_SUB_OP_ADDR_ERROR 0x13 Operation address error AT_SUB_HANDLE_INVALID 0x14 Invalid handle for operation
2.2.10. AT+SYSSTORE?
Function: Query/Set parameter store mode.
2.2.10.1. Query Command
Function:
Query the AT parameter store mode.
Command:
AT+SYSSTORE?
Response:
+SYSSTORE:<store_mode> OK
2.2.10.2. Set Command
Command:
AT+SYSSTORE=<store_mode>
Response:
OK
2.2.10.3. Parameter
- <store_mode>:
- 0: command configuration is not stored into flash.
- 1: command configuration is stored into flash. (Default)
2.2.10.4. Note
- This command affects set commands only. Query commands are always fetched from RAM.
2.2.10.5. 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
2.2.11. AT+TEMP?
Function: Query the temperature of the chip.
2.2.11.1. Query Command
Function:
Query the AT parameter store mode.
Command:
AT+TEMP?
Response:
+TEMP:<temperature> OK
2.2.11.2. Parameter
- <temperature>: The temperature of the chip (Unit:°C).
2.2.12. AT+EFUSE-W
Function: Efuse write operation. The data will be written into the Efuse after the write confirmation operation is performed.
2.2.12.1. Set Command
Command:
AT+EFUSE-W=<nbytes>,<addr>
Response:
OK >
This response indicates that AT is ready for receiving serial data. You should enter the data and when the data length reaches the <nbytes>
value, the transmission of data starts.
If the connection cannot be established or is disrupted during data transmission, the system returns:
ERROR
If the data has been successfully sent to the protocol stack (It does not mean that the data has been sent to the opposite end), the system returns:
SEND OK
2.2.12.2. Parameter
- <nbytes>: The number of btyes to be written needs to be aligned to 4 bytes. Maximum: 8192 bytes.
- <addr>: This is the address of Efuse, it needs to be filled in as a string.
2.2.13. AT+EFUSE-R
Function: Efuse read operation.
2.2.13.1. Set Command
Function:
Read the content of the Efuse at the specified address.
Command:
AT+EFUSE-R=<nbytes>,<addr>,<reload>
Response:
+EFUSE-R:<nbytes>,[data] OK
2.2.13.2. Notes
- Among these parameters, 'nbytes' and 'addr' are mandatory inputs, while others are optional.
- The number of bytes read needs to be aligned to 4 bytes, with a maximum length of 8192 bytes.
2.2.13.3. Example
AT+EFUSE-R=4,"0x1c"
Response:
+EFUSE-R:<nbytes>,[data] OK
2.2.13.4. Parameter
- <nbytes>: The number of btyes to be read.
- <addr>: This is the address of Efuse, it needs to be filled in as a string.
- <reload>: The read operation reload from the Efuse address.
- 0: Indicates no reloading, the read data may be from the Efuse backup area.
- 1: Indicates reloading.
2.2.13.5. Example
// read Efuse cmd AT+EFUSE-R=4,"0x1c" // Response +EFUSE-R:1234 OK // write Efuse cmd AT+EFUSE-W=4,"0x1c" // Response OK // write data aaaa // Response SEND OK // read Efuse cmd AT+EFUSE-R=4,"0x1c" // Response +EFUSE-R:4,aaaa OK // read Efuse cmd AT+EFUSE-R=4,"0x1c",1 // Response +EFUSE-R:0000 OK
2.2.14. AT+EFUSE-CFM
Function: Efuse write confirmation operation.
2.2.14.1. Set Command
Function:
Efuse write confirmation will directly write into Efuse.
Command:
AT+EFUSE-CFM
Response:
OK
2.2.14.2. Example
// write Efuse cmd AT+EFUSE-W=4,"0x1c" // Response OK // write data aaaa // Response SEND OK // write Efuse confirmation cmd AT+EFUSE-CFM // Response OK // read Efuse cmd AT+EFUSE-R=4,"0x1c" // Response +EFUSE-R:aaaa OK
2.2.15. AT+FLASH-W
Function: Flash write operation.
2.2.15.1. Set Command
Command:
AT+FLASH-W=<nbytes>,<addr>
Response:
OK >
This response indicates that AT is ready for receiving serial data. You should enter the data, and when the data length reaches the <nbytes>
value, the transmission of data starts.
If the connection cannot be established or is disrupted during data transmission, the system returns:
ERROR
If the data has been successfully sent to the protocol stack (It does not mean that the data has been sent to the opposite end), the system returns:
SEND OK
2.2.15.2. Parameter
- <nbytes>: The number of btyes to be written. Maximum: 8192 bytes.
- <addr>: This is the address of Flash, it needs to be filled in as a string.
2.2.16. AT+FLASH-R
Function: Flash read operation.
2.2.16.1. Set Command
Function:
Read the content of the Flash at the specified address.
Command:
AT+FLASH-R=<nbytes>,<addr>
Response:
+FLASH-R:[data] OK
2.2.16.2. Example
// flash read cmd AT+FLASH-R=4,"0x210000" // Response +FLASH-R:ffff OK
2.2.16.3. Parameter
- <nbytes>: The number of btyes to be read.
- <addr>: This is the address of Flash, it needs to be filled in as a string.
2.2.17. AT+FLASH-E
Function: Flash erase operation.
2.2.17.1. Set Command
Function:
Erase the content of the Flash at the specified address.
Command:
AT+FLASH-E=<nbytes>,<addr>
Response:
OK
2.2.17.2. Example
// flash erase cmd AT+FLASH-E=4096,"0x210000" // Response OK
2.2.17.3. Parameter
- <nbytes>: The number of btyes to be erase.
- <addr>: This is the address of Flash, it needs to be filled in as a string.
2.2.18. AT+IOPUPD
Function: Initialize GPIO pins as pull-up/pull-down mode.
2.2.18.1. Set Command
Command:
AT+IOPUPD=<pin>,<state>
Response:
OK
2.2.18.2. Example
// Initialize GPIO cmd AT+IOPUPD=15,1 //Response OK
2.2.18.3. Parameter
- <pin>: The pin numbers for ST67W611M1.
- <state>: Requires initialization as pull-up, pull-down or float.
- 0: float.
- 1: Pull-up.
- 2: Pull-down.
2.2.19. AT+IOOUT
Function: Set the GPIO output to high/low level.
2.2.19.1. Set Command
Command:
AT+IOOUT=<pin>,<state>
Response:
OK
2.2.19.2. Example
// Set GPIO cmd AT+IOOUT=15,1 //Response OK
2.2.19.3. Parameter
- <pin>: The pin numbers for ST67W611M1.
- <state>: The GPIO output to high/low level.
- 0: low level.
- 1: high level.
2.2.20. AT+IOIN
Function: Query/Set the GPIO input mode.
2.2.20.1. Set Command
Command:
AT+IOIN=<pin>,<pull_state>
Response:
OK
2.2.20.2. Query Command
Command:
AT+IOIN=<pin>?
Response:
+IOIN=<pin>:<state> OK
2.2.20.3. Example
// Set GPIO input cmd AT+IOIN=15 //Response OK // Query GPIO input state AT+IOIN=15? //Response +IOIN=15:1 OK
2.2.20.4. Parameter
- <pin>: The pin numbers for ST67W611M1.
- <state>: Requires initialization as pull-up, pull-down or float.
- 0: float.
- 1: Pull-up.
- 2: Pull-down.
2.2.21. AT+IORST
Function: Restore GPIO to floating input state.
2.2.21.1. Set Command
Command:
AT+IORST=<pin>
Response:
OK
2.2.21.2. Example
// Reset GPIO cmd AT+IORST=15 //Response OK
2.2.21.3. Parameter
- <pin>: The pin numbers for ST67W611M1.
2.2.22. AT+PART
Function: Get information about the partitions.
2.2.22.1. Query Command
Command:
AT+PART?
Response:
+PART:<active_idx>,<age>,<"name">,<addr0>,<addr1>,<len0>,<len1> +PART:<active_idx>,<age>,<"name">,<addr0>,<addr1>,<len0>,<len1> ... OK
2.2.22.2. Example
// Reset GPIO cmd AT+PART? //Response +PART=0,0," Boot2",0x00000000,0x00000000,57344,0 +PART=0,0," FW",0x00010000,0x00210000,2097152,1474560 +PART=0,0," mfg",0x00210000,0x00000000,1474560,0 +PART=0,0," media",0x00378000,0x00000000,462848,0 +PART=0,0," PSM",0x003e9000,0x00000000,32768,0 OK
2.2.22.3. Parameter
<active_idx>:
- 0: The current active partition index is 0.
- 1: The current active partition index is 1.
<age>: The number of updates for this partition. For example, when the "FW" partition is updated via OTA, the age will increase with each OTA update.
<name>: The partition name.
<addr0>: The address of partition index 0.
<addr1>: The address of partition index 1.
<len0>: The length of partition index 0.
<len1>: The length of partition index 1.
2.2.23. AT+OTASTART
Function: Start OTA transmission.
2.2.23.1. Set Command
Command:
AT+OTASTART=<enable>
2.2.23.2. Parameter
<enable>:
- 0: Terminate OTA transmission.
- 1: Start OTA transmission.
Response:
ERROR
or
OK
2.2.24. AT+OTASEND
Send OTA data. This command will write the data to the OTA partition in real time and perform validation.
2.2.24.1. Set Command
Command:
AT+OTASEND=<length>
Response:
OK >
The symbol > indicates that AT is ready for receiving serial data, and you can enter the data now. When the requirement of message length determined by the parameter <length> is met, the transmission starts.
If the transmission is successful, AT returns:
SEND OK
Otherwise, it returns:
SEND FAIL
2.2.24.2. Parameters
- <length>: OTA data length. The maximum length is equal to the system allocable heap size.
2.2.25. AT+OTAFIN
Function: Verify and reboot from another partition.
2.2.25.1. Set Command
Command:
AT+OTAFIN
Response:
If the OTA has already written to the corresponding partition and verified the integrity successfully, and is about to reboot, return:
OK
If the reboot fails, return:
ERROR
2.2.26. AT+FS
Function: Filesystem Operations.
2.2.26.1. Set Command
Command:
AT+FS=<type>,<operation>,<filename>[,<offset>][,<length>]
Response:
OK
2.2.26.2. Parameters
<type>: only LittleFS is currently supported.
- 0: LittleFS
<operation>:
- 0: delete file.
- 1: create file.
- 2: write file.
- 3: read file.
- 4: query the size of the file.
- 5: list files in a specific directory. Only root directory is currently supported.
<filename>: the file name that needs to be operated on.
<offset>: apply to writing and reading operations only.
<length>: data length, applying to writing and reading operations only.
2.2.26.3. Example
// Query the list of files in the current directory '.' AT+FS=0,5,"." // Response +FS:LIST . .. ca_1.crt ca_1.key ca_2.crt ca_2.key client_1.crt client_1.key client_2.crt client_2.key server_1.crt server_1.key server_2.crt server_2.key OK
2.2.27. AT+GMAC
Function: Query the MAC addresses of 3 slots in efuse.
2.2.27.1. Query Command
Command:
AT+GMAC?
Response:
+GMACSLOT0:<mac_addr> +GMACSLOT1:<mac_addr> +GMACSLOT2:<mac_addr> OK
2.2.27.2. Parameters
- <mac_addr>: MAC address in efuse.
2.2.27.3. Example
// Query the MAC addresses of 3 slots in efuse. AT+GMAC? // Response +GMACSLOT0:9c:b7:93:0c:c1:26 +GMACSLOT1:00:00:00:00:00:00 +GMACSLOT2:00:b7:00:00:00:00 OK
2.2.28. AT+PN
Function: Query the part number.
2.2.28.1. Query Command
Command:
AT+PN?
Response:
+PN:<pn_num> OK
2.2.28.2. Parameters
- <pn_num>: The part number in efuse.
2.2.28.3. Example
AT+PN? // Response +PN:CP90-79196-2 OK
2.2.29. AT+VBAT
Function: Query the voltage value at the supply pin.
2.2.29.1. Query Command
Command:
AT+VBAT?
Response:
+VBAT:<vbat_val> OK
2.2.29.2. Parameters
- <vbat_val>: The voltage value at the supply pin (unit: mV).
2.2.29.3. Example
AT+VBAT? // Response +VBAT:3326 OK
3. Wi-Fi function AT command
Command | Description |
---|---|
AT+WIFISP | Query/Set enable/disable WLAN radio |
AT+CWMODE | Set Wi-Fi mode |
AT+CWNETMODE | Query device to work in NCP/RCP mode. |
AT+CWSTATE | Query the Wi-Fi state and Wi-Fi information |
AT+CWJAP | Connect to AP |
AT+CWRECONNCFG | Query/Set the Wi-Fi reconnecting configuration |
AT+CWLAPOPT | Set AT+CWLAP command scan result attributes |
AT+CWLAP | Scan nearby AP |
AT+CWQAP | Disconnect AP |
AT+CWSAP | Query/Set the configuration of an SoftAP |
AT+CWLIF | Obtain IP address of the station that connects to an SoftAP |
AT+CWQIF | Disconnect stations from an SoftAP |
AT+CWDHCP | Enable/disable DHCP |
AT+CWDHCPS | Query/Set the IP addresses allocated by an SoftAP DHCP server |
AT+CWAUTOCONN | Set up automatic reconnection |
AT+CIPSTAMAC | Query/Set the MAC address of an station |
AT+CIPAPMAC | Query/Set the MAC address of an SoftAP |
AT+CIPSTA | Query/Set the IP address of an station |
AT+CIPAP | Query/Set the IP address of an SoftAP |
AT+CWHOSTNAME | Query/Set the host name of an station |
AT+CWCOUNTRY | Query/Set the Wi-Fi Country Code |
AT+CWMONITOR | Set WiFi to enter monitor mode |
AT+CWSTAPROTO | Query/Set the 802.11 b/g/n/ax Protocol Standard of Station Mode |
AT+CWAPPROTO | Query/Set the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode |
AT+WPS | Enable the WPS function. |
AT+CWANTENABLE | Enable/Disable Antenna Diversity Function. |
AT+CWANTNUM | Get the maximum number of antennas for the current device. |
AT+CWANT | Set/Query the currently used antenna. |
3.1. Basic AT command description
3.1.1. AT+WIFISP
Function: Query/Set enable/disable wlan radio.
3.1.1.1. Query Command
Function:
Query the wlan radio enablement status.
Command:
AT+WIFISP?
Response:
+WIFISP:<enable> OK
3.1.1.2. Set Command
Function:
Enable/disable wlan radio.
Command:
AT+WIFISP=<enable>
Response:
OK
3.1.1.3. Parameters
- <enable>:
- 0: Disable wlan radio.
- 1: Enable wlan radio.
3.1.2. AT+CWMODE
Function: Query/set Wi-Fi mode.
3.1.2.1. Query Command
Function:
Query the Wi-Fi mode of devices.
Command:
AT+CWMODE?
Response:
+CWMODE:<mode> OK
3.1.2.2. Set Command
Function:
Set the Wi-Fi mode of devices.
Command:
AT+CWMODE=<mode>[,<auto_connect>]
Response:
OK
3.1.2.3. Parameters
- <mode>:
- 0: Null mode. Wi-Fi RF will be disabled.
- 1: Station mode.
- 2: SoftAP mode.
- 3: SoftAP+Station mode.
- <auto_connect>: Enable or disable automatic connection to an AP when you change the mode of the device from the SoftAP mode or null mode to the station mode. Default: 1. If you omit the parameter, the default value will be used, i.e. automatically connecting to an AP.
- 0: The device will not automatically connect to an AP.
- 1: The device will automatically connect to an AP if the configuration to connect to the AP has already been saved in flash before.
3.1.2.4. Note
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- SoftAP+Station mode requires AP and STA to be on the same channel
3.1.2.5. Example
AT+CWMODE=1
3.1.3. AT+CWNETMODE
Function: Query device working in NCP/RCP mode.
3.1.3.1. Query Command
Function:
Query whether the device is operating in NCP/RCP mode.
Command:
AT+CWNETMODE?
Response:
+CWNETMODE:<netmode> OK
3.1.3.2. Parameters
- <netmode>:
- 0: RCP mode.
- 1: NCP mode.
3.1.3.3. Note
- When the device is in RCP mode, all network and MQTT-related AT commands become invalid.
3.1.4. AT+CWSTATE
Function: Query the Wi-Fi state and Wi-Fi information.
3.1.4.1. Query Command
Function:
Query the Wi-Fi state and Wi-Fi information of devices.
Command:
AT+CWSTATE?
Response:
+CWSTATE:<state>,<"ssid"> OK
3.1.4.2. Parameters
- <state>: current Wi-Fi state.
- 0: station has not started any Wi-Fi connection.
- 1: station has connected to an AP, but does not get an IPv4 address yet.
- 2: station has connected to an AP, and got an IPv4 address.
- 3: station is in Wi-Fi connecting or reconnecting state.
- 4: station is in Wi-Fi disconnected state.
- <"ssid">: the SSID of the target AP.
3.1.4.3. Note
- When station is not connected to an AP, it is recommended to use this command to query Wi-Fi information; after station is connected to an AP, it is recommended to use AT+CWJAP to query Wi-Fi information.
3.1.5. AT+CWJAP
Function: Connect to an AP.
3.1.5.1. Query Command
Function:
Query the AP to which the Station is already connected.
Command:
AT+CWJAP?
Response:
+CWJAP:<ssid>,<bssid>,<channel>,<rssi>,<wep_en> OK
3.1.5.2. Set Command
Function:
Connect an station to a targeted AP.
Command:
AT+CWJAP=[<ssid>],[<pwd>][,<bssid>][,<wep_en>]
3.1.5.3. Notes
- Among these parameters, 'ssid' and 'pwd' are mandatory inputs, while others are optional.
Response:
+CW:CONNECTED +CW:GOTIP OK
or
+CW:CONNECTING OK +CW:ERROR,<reason_code>
or
+CWJAP:<error code> ERROR
3.1.5.4. Execute Command
Function:
Connect an station to a targeted AP with last Wi-Fi configuration.
Command:
AT+CWJAP
Response:
+CW:CONNECTED +CW:GOTIP OK
or
+CWJAP:<error code> ERROR
3.1.5.5. Parameters
- <ssid>: the SSID of the target AP.
- Escape character syntax is needed if SSID or password contains special characters, such
,
,"
, or\\
.
- Escape character syntax is needed if SSID or password contains special characters, such
- <pwd>: password, MAX: 64-byte ASCII.
- <bssid>: the MAC address of the target AP. It cannot be omitted when multiple APs have the same SSID.
- <channel>: channel.
- <rssi>: signal strength.
- <wep_en>: Is the connected AP using WEP encryption?
- 0: Not WEP encryption.
- 1: It's WEP encryption.
- <error code>: (for reference only)
- 1: connection timeout.
- 2: wrong password.
- 3: cannot find the target AP.
- 4: connection failed.
- others: unknown error occurred.
- <reason_code>:
- 1: Failure to allocate memory for transmitting an authentication frame.
- 2: Authentication process failed.
- 3: The authentication algorithm was not accepted or failed.
- 4: Failure to allocate memory for transmitting an association frame.
- 5: Association process with the access point failed.
- 6: Deauthentication by the access point occurred when not connected.
- 7: Deauthentication by the access point occurred while connected.
- 8: A timeout occurred during the 4-way handshake, likely due to PSK (Pre-Shared Key) issues.
- 9: Failed to transmit a deauthentication frame during the 4-way handshake.
- 10: Failed to allocate memory for a deauthentication frame during the 4-way handshake.
- 11: Timeout waiting for authentication or association response.
- 12: No BSSID or channel found during the scan process.
- 13: Failed to create a channel context when attempting to join a network.
- 14: Failure to join a network.
- 15: Failed to add a station (STA) to the network.
- 16: Beacon loss occurred, potentially leading to disconnection.
- 17: The network security settings do not match.
- 18: An error occurred due to an incorrect WEP key length.
- 19: User-initiated disconnection with deauthentication.
- 20: User-initiated disconnection without sending a deauthentication frame.
- 21: Disconnection occurred because the firmware failed to send a power-save null frame.
- 22: Traffic loss was detected.
- 23: Switching to a new channel failed.
- 24: Confirmation of authentication or association response failed.
- 25: Reassociation process is starting.
3.1.5.6. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- This command requires Station mode to be enabled.
- The parameter
<reconn_interval>
of this command is the same as<interval_second>
of the command AT + CWRECONNCFG . Therefore, if you omit<reconn_interval>
when running this command, the interval between Wi-Fi reconnections will use the default value 1. - If the
<ssid>
and<password>
parameter are omitted, AT will use the last configuration. - Execute command has the same maximum timeout to setup command. The default value is 15 seconds, but you can change it by setting the parameter
<jap_timeout>
.
3.1.5.7. Example
// If the target AP's SSID is "abc" and the password is "0123456789", the command should be: AT+CWJAP="abc","0123456789" // If the target AP's SSID is "ab\,c" and the password is "0123456789"\", the command should be: AT+CWJAP="ab\\\,c","0123456789\"\\" // If multiple APs all have the SSID of "abc", the target AP can be found by BSSID: AT+CWJAP="abc","0123456789","ca:d7:19:d8:a6:44" // If at is required that connect to a AP by protected management frame, the command should be: AT+CWJAP="abc","0123456789",,,,,,,3
3.1.6. AT+CWRECONNCFG
Function: Query/Set the Wi-Fi Reconnecting Configuration.
3.1.6.1. Query Command
Function:
Query the configuration of Wi-Fi reconnect.
Command:
AT+CWRECONNCFG?
Response:
+CWRECONNCFG:<interval_second>,<repeat_count> OK
3.1.6.2. Set Command
Function:
Set the configuration of Wi-Fi reconnect.
Command:
AT+CWRECONNCFG=<interval_second>,<repeat_count>
Response:
OK
3.1.6.3. Parameters
- <interval_second>: the interval between Wi-Fi reconnections. Unit: second. Default: 0. Maximum: 7200.
- 0: The station will not reconnect to the AP when disconnected.
- [1,7200]: The station will reconnect to the AP at the specified interval when disconnected.
- <repeat_count>: the number of attempts the device makes to reconnect to the AP. This parameter only works when the parameter
<interval_second>
is not 0. Default: 0. Maximum: 1000.- 0: The station will always try to reconnect to AP.
- [1,1000]: The station will attempt to reconnect to AP for the specified times.
3.1.6.4. Example
// The station tries to reconnect to AP at the interval of one second for 100 times. AT+CWRECONNCFG=1,100 // The station will not reconnect to AP when disconnected. AT+CWRECONNCFG=0,0
3.1.6.5. Notes
- The parameter
<interval_second>
of this command is the same as the parameter[<reconn_interval>]
of the command AT+CWJAP. - This command works for passive disconnection from APs, Wi-Fi mode switch, and Wi-Fi auto connect after power on.
3.1.7. AT+CWLAPOPT
Function: Set the Configuration for the Command AT+CWLAP.
3.1.7.1. Set Command
Command:
AT+CWLAPOPT=<sort_enable>,<print mask>[,<rssi filter>][,<authmode mask>][,<max_count>]
Response:
OK
or
ERROR
3.1.7.2. Parameters
- <sort_enable>: Enable/Disable sorting scan results by RSSI (default sorting).
- <print mask>: determine whether the following parameters are shown in the result of AT+CWLAP. Default: 0x7FF. If you set them to 1, it means showing the corresponding parameters; if you set them as 0, it means NOT showing the corresponding parameters.
- bit 0: determine whether <ecn> will be shown.
- bit 1: determine whether <ssid> will be shown.
- bit 2: determine whether <rssi> will be shown.
- bit 3: determine whether <mac> will be shown.
- bit 4: determine whether <channel> will be shown.
- bit 5: determine whether <freq_offset> will be shown.
- bit 6: determine whether <freqcal_val> will be shown.
- bit 7: determine whether <pairwise_cipher> will be shown.
- bit 8: determine whether <group_cipher> will be shown.
- bit 9: determine whether <bgn> will be shown.
- bit 10: determine whether <wps> will be shown.
- [<rssi filter>]: determine whether the result of the command AT+CWLAP will be filtered according to
rssi filter
. In other words, the result of the command will NOT show the APs whose signal strength is belowrssi filter
. Unit: dBm. Default: –100. Range: [–100,40]. - [<authmode mask>]: determine whether APs with the following authmodes are shown in the result of AT+CWLAP. Default: 0xFFFF. If you set
bit x
to 1, the APs with the corresponding authmode will be shown. If you setbit x
to 0, the APs with the corresponding authmode will NOT be shown;- bit 0: determine whether APs with
OPEN
authmode will be shown. - bit 1: determine whether APs with
WEP
authmode will be shown. - bit 2: determine whether APs with
WPA_PSK
authmode will be shown. - bit 3: determine whether APs with
WPA2_PSK
authmode will be shown. - bit 4: determine whether APs with
WPA_WPA2_PSK
authmode will be shown. - bit 5: determine whether APs with
WPA2_ENTERPRISE
authmode will be shown. - bit 6: determine whether APs with
WPA3_PSK
authmode will be shown. - bit 7: determine whether AP with
WPA2_WPA3_PSK
authmode will be shown.
- bit 0: determine whether APs with
- [<max_count>]: The maximum number of WiFi networks scanned is 50 by default, meaning the CWLAP command response can include up to 50 scanned results. Range: (0,50].
3.1.7.3. Example
// The first parameter is 1, meaning that the result of the command AT+CWLAP will be ordered according to RSSI; // The second parameter is 31, namely 0x1F, meaning that the corresponding bits of <print mask> are set to 1. All parameters will be shown in the result of AT+CWLAP. AT+CWLAPOPT=1,31 AT+CWLAP // Just show the AP which authmode is OPEN AT+CWLAPOPT=1,31,-100,1 AT+CWLAP
3.1.8. AT+CWLAP
Function: List Available APs.
3.1.8.1. Set Command
Function:
Query the APs with specified parameters, such as the SSID, MAC address, or channel.
Command:
AT+CWLAP=[<scan_type>,<ssid>,<mac>,<channel>,<scan_time_min>,<scan_time_max>]
3.1.8.2. Execute Command
Function:
List all available APs.
Command:
AT+CWLAP
Response:
+CWLAP:<ecn>,<ssid>,<rssi>,<mac>,<channel>,<freq_offset>,<freqcal_val>,<pairwise_cipher>,<group_cipher>,<bgn>,<wps> OK
3.1.8.3. Parameters
- <ecn>: encryption method.
- 0: OPEN
- 1: WEP
- 2: WPA_PSK
- 3: WPA2_PSK
- 4: WPA_WPA2_PSK
- 5: WPAx_ENTERPRISE
- 6: WPA3_PSK
- 7: WPA2_WPA3_PSK
- <scan_type>: Wi-Fi scan type:
- 0: active scan
- 1: passive scan
- <ssid>: string parameter showing SSID of the AP.
- <rssi>: signal strength.
- <mac>: string parameter showing MAC address of the AP.
- <channel>: channel.
- <scan_time_min>: the minimum active scan time per channel. Unit: millisecond. Range [0,1500]. If the scan type is passive, this parameter is invalid.
- <scan_time_max>: the maximum active scan time per channel. Unit: millisecond. Range [0,1500]. If this parameter is 0, the firmware will use the default time: 120 ms for active scan; 360 ms for passive scan.
- <freq_offset>: frequency offset (reserved item).
- <freqcal_val>: frequency calibration value (reserved item).
- <pairwise_cipher>: pairwise cipher type.
- 0: None
- 1: WEP40
- 2: WEP104
- 3: TKIP
- 4: CCMP
- 5: TKIP and CCMP
- 6: AES-CMAC-128
- 7: Unknown
- <group_cipher>: group cipher type, same enumerated value to
<pairwise_cipher>
. - <bgn>: 802.11 b/g/n. If the corresponding bit is 1, the corresponding mode is enabled; if the corresponding bit is 0, the corresponding mode is disabled.
- bit 0: bit to identify if 802.11b mode is enabled or not
- bit 1: bit to identify if 802.11g mode is enabled or not
- bit 2: bit to identify if 802.11n mode is enabled or not
- bit 3: bit to identify if 802.11ax mode is enabled or not
- <wps>: wps flag.
- 0: WPS disabled
- 1: WPS enabled
3.1.8.4. Example
AT+CWLAP=0,"Wi-Fi","ca:d7:19:d8:a6:44",6,0,400,1000 // Search for APs with a designated SSID: AT+CWLAP=0,"Wi-Fi"
3.1.9. AT+CWQAP
Function: Disconnect from an AP.
3.1.9.1. Execute Command
Command:
AT+CWQAP=[<restore>]
Response:
OK
Command:
AT+CWQAP
Response:
OK
3.1.9.2. Parameters
- Optional <restore>: flag to erase the saved SSID and password information.
- 0: Do not erase the saved SSID and password information (default).
- 1: Erase the saved SSID and password information.
3.1.10. AT+CWSAP
Function: Query/Set the configuration of an SoftAP.
3.1.10.1. Query Command
Function:
Query the configuration parameters of an SoftAP.
Command:
AT+CWSAP?
Response:
+CWSAP:<ssid>,<pwd>,<channel>,<ecn>,<max conn>,<ssid hidden> OK
3.1.10.2. Set Command
Function:
Set the configuration of an SoftAP.
Command:
AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>[,<max conn>][,<ssid hidden>]
Response:
OK
3.1.10.3. Parameters
- <ssid>: string parameter showing SSID of the AP.
- <pwd>: string parameter showing the password. Length: 8 ~ 64 bytes ASCII.
- <channel>: channel ID.
- <ecn>: encryption method; WEP is not supported.
- 0: OPEN
- 2: WPA_PSK
- 3: WPA2_PSK
- 4: WPA3_PSK
- [<max conn>]: maximum number of stations that SoftAP can connect. Range: [1,4].
- [<ssid hidden>]:
- 0: broadcasting SSID (default).
- 1: not broadcasting SSID.
3.1.10.4. Notes
- This command works only when AT+CWMODE=2 or AT+CWMODE=3.
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
3.1.11. AT+CWLIF
Function: Obtain IP Address of the Station That Connects to an SoftAP.
3.1.11.1. Execute Command
Command:
AT+CWLIF
Response:
+CWLIF:<ip addr>,<mac> OK
3.1.11.2. Parameters
- <ip addr>: IP address of the station that connects to the SoftAP.
- <mac>: MAC address of the station that connects to the SoftAP.
3.1.11.3. Note
- This command cannot get a static IP. It works only when DHCP of both the SoftAP and the connected station are enabled.
3.1.12. AT+CWQIF
Function: Disconnect Stations from an SoftAP.
3.1.12.1. Execute Command
Function:
Disconnect all stations that are connected to the SoftAP.
Command:
AT+CWQIF
Response:
OK
3.1.12.2. Set Command
Function:
Disconnect a specific station from the SoftAP.
Command:
AT+CWQIF=<mac>
3.1.12.3. Example
AT+CWQIF="18:b9:05:ed:59:cc"
Response:
OK
3.1.12.4. Parameter
- <mac>: MAC address of the station to disconnect.
3.1.13. AT+CWDHCP
Function: Enable/Disable DHCP.
3.1.13.1. Query Command
Command:
AT+CWDHCP?
Response:
<state>
3.1.13.2. Set Command
Function:
Enable/disable DHCP.
Command:
AT+CWDHCP=<operate>,<mode>
Response:
OK
3.1.13.3. Parameters
- <operate>:
- 0: disable
- 1: enable
- <mode>:
- Bit0: Station DHCP
- Bit1: SoftAP DHCP
- <state>: the status of DHCP
- Bit0:
- 0: Station DHCP is disabled.
- 1: Station DHCP is enabled.
- Bit1:
- 0: SoftAP DHCP is disabled.
- 1: SoftAP DHCP is enabled.
- Bit0:
3.1.13.4. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- This Set Command correlates with the commands that set static IP, such as AT+CIPSTA and AT+CIPAP:
- If DHCP is enabled, static IP address will be disabled;
- If static IP address is enabled, DHCP will be disabled;
- The last configuration overwrites the previous configuration.
3.1.13.5. Example
// Enable Station DHCP. If the last DHCP mode is 2, the current DHCP mode will be 3. AT+CWDHCP=1,1 // Disable SoftAP DHCP. If the last DHCP mode is 3, the current DHCP mode will be 1. AT+CWDHCP=0,2
3.1.14. AT+CWDHCPS
Function:Query/Set the IP Addresses Allocated by an SoftAP DHCP Server.
3.1.14.1. Query Command
Command:
AT+CWDHCPS?
Response:
+CWDHCPS=<lease time>,<start IP>,<end IP> OK
3.1.14.2. Set Command
Function:
Set the IP address range of the SoftAP DHCP server.
Command:
AT+CWDHCPS=<enable>,<lease time>,<start IP>,<end IP>
Response:
OK
3.1.14.3. Parameters
- <enable>:
- 1: Enable DHCP server settings. The parameters below have to be set.
- 0: Disable DHCP server settings and use the default IP address range.
- <lease time>: lease time. Unit: minute. Range [1,2880].
- <start IP>: start IP address of the IP address range that can be obtained from SoftAP DHCP server.
- <end IP>: end IP address of the IP address range that can be obtained from SoftAP DHCP server.
3.1.14.4. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- This AT command works only when both SoftAP and DHCP server are enabled for devices.
- The IP address should be in the same network segment as the IP address of SoftAP.
3.1.14.5. Example
AT+CWDHCPS=1,3,"192.168.4.10","192.168.4.15" AT+CWDHCPS=0 // Disable the settings and use the default IP address range.
3.1.15. AT+CWAUTOCONN
Function:Automatically Connect to an AP When Powered on
3.1.15.1. Set Command
Command:
AT+CWAUTOCONN=<enable>
Response:
OK
3.1.15.2. Parameters
- <enable>:
- 1: Enable automatic connection to an AP when powered on. (Default)
- 0: Disable automatic connection to an AP when powered on.
3.1.15.3. Note
- The configuration changes will be saved in the easyflash area.
3.1.15.4. Example
AT+CWAUTOCONN=1
3.1.16. AT+CIPSTAMAC
Function: Query/Set the MAC Address of an ST67W611M1 Station
3.1.16.1. Query Command
Function:
Query the MAC address of the Station.
Command:
AT+CIPSTAMAC?
Response:
+CIPSTAMAC:<mac> OK
3.1.16.2. Set Command
Function:
Set the MAC address of an station.
Command:
AT+CIPSTAMAC=<mac>
Response:
OK
3.1.16.3. Parameters
- <mac>: string parameter showing MAC address of an station.
3.1.16.4. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- The MAC address of SoftAP is the same as Station, and when Station MAC is set, SoftAP's MAC will also be automatically updated.
- Bit 0 of the 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 address and cannot be set.
3.1.16.5. Example
AT+CIPSTAMAC="1a:fe:35:98:d3:7b"
3.1.17. AT+CIPAPMAC
Function: Query/Set the MAC Address of an SoftAP
3.1.17.1. Query Command
Function:
Query the MAC address of the SoftAP.
Command:
AT+CIPAPMAC?
Response:
+CIPAPMAC:<mac> OK
3.1.17.2. Set Command
Function:
Set the MAC address of the SoftAP.
Command:
AT+CIPAPMAC=<mac>
Response:
OK
3.1.17.3. Parameters
- <mac>: string parameter showing MAC address of the SoftAP.
3.1.17.4. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- The MAC address of SoftAP is the same as Station, and when SoftAP MAC is set, Station's MAC will also be automatically updated.
- Bit 0 of the 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.
3.1.17.5. Example
AT+CIPAPMAC="18:fe:35:98:d3:7b"
3.1.18. AT+CIPSTA
Function: Query/Set the IP Address of an Station
3.1.18.1. Query Command
Function:
Query the IP address of the Station.
Command:
AT+CIPSTA?
Response:
+CIPSTA:ip:<"ip"> +CIPSTA:gateway:<"gateway"> +CIPSTA:netmask:<"netmask"> +CIPSTA:ip6ll:<"ipv6 addr"> +CIPSTA:ip6gl:<"ipv6 addr"> OK
3.1.18.2. Set Command
Function:
Set the IPv4 address of the station.
Command:
AT+CIPSTA=<"ip">[,<"gateway">,<"netmask">,<"dns">]
Response:
OK
3.1.18.3. Parameters
- <"ip">: string parameter showing the IPv4 address of the station.
- <"gateway">: gateway.
- <"netmask">: netmask.
- <”ipv6 addr”>: string parameter showing the IPv6 address of the ST67W611M1 station.
3.1.18.4. Notes
- For the query command, only when the station is connected to an AP or the static IP address is configured can its IP address be queried.
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- The Set Command correlates with the commands that set DHCP, such as AT+CWDHCP.
- If static IP address is enabled, DHCP will be disabled;
- If DHCP is enabled, static IP address will be disabled;
- The last configuration overwrites the previous configuration.
3.1.18.5. Example
AT+CIPSTA="192.168.6.100","192.168.6.1","255.255.255.0"
3.1.19. AT+CIPAP
Function: Query/Set the IP Address of an SoftAP
3.1.19.1. Query Command
Function:
Query the IP address of the SoftAP.
Command:
AT+CIPAP?
Response:
+CIPAP:ip:<"ip"> +CIPAP:gateway:<"gateway"> +CIPAP:netmask:<"netmask"> OK
3.1.19.2. Set Command
Function:
Set the IPv4 address of the SoftAP.
Command:
AT+CIPAP=<"ip">[,<"gateway">,<"netmask">]
Response:
OK
3.1.19.3. Parameters
- <"ip">: string parameter showing the IPv4 address of the SoftAP.
- <"gateway">: gateway.
- <"netmask">: netmask.
3.1.19.4. Notes
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1.
- The set command correlates with the commands that set DHCP, such as AT+CWDHCP.
- If static IP address is enabled, DHCP will be disabled;
- If DHCP is enabled, static IP address will be disabled;
- The last configuration overwrites the previous configuration.
3.1.19.5. Example
AT+CIPAP="192.168.5.1","192.168.5.1","255.255.255.0"
3.1.20. AT+CWHOSTNAME
Function: Query/Set the Host Name of an Station
3.1.20.1. Query Command
Function:
Query the host name of Station.
Command:
AT+CWHOSTNAME?
Response:
+CWHOSTNAME:<hostname> OK
3.1.20.2. Set Command
Function:
Set the host name of Station.
Command:
AT+CWHOSTNAME=<hostname>
Response:
OK
If the Station mode is not enabled, the command will return:
ERROR
3.1.20.3. Parameters
- <hostname>: the host name of the Station. Maximum length: 32 bytes.
3.1.20.4. Note
- The configuration changes are not saved in the flash.
3.1.20.5. Example
AT+CWMODE=3 AT+CWHOSTNAME="my_test"
3.1.21. AT+CWCOUNTRY
Function: Query/Set the Wi-Fi Country Code
3.1.21.1. Query Command
Function:
Query Wi-Fi country code information.
Command:
AT+CWCOUNTRY?
Response:
+CWCOUNTRY:<country_policy>,<country_code> OK
3.1.21.2. Set Command
Function:
Set the Wi-Fi country code information.
Command:
AT+ CWCOUNTRY=<country_policy>,<country_code>
Response:
OK
3.1.21.3. Parameters
- <country_policy>:
- 0: will change the county code to be the same as the AP that the device is connected to.
- 1: the country code will not change, always be the one set by command.
- <country_code>: country code. Maximum length: 3 characters.
3.1.21.4. Note
- The configuration changes are not saved in the flash.
3.1.21.5. Example
AT+CWMODE=3 AT+CWCOUNTRY=1,"CN"
3.1.22. AT+CWMONITOR
Function: Set WiFi to enter monitor mode
3.1.22.1. Set Command
Function:
Set WiFi to enter monitor mode.
Command:
AT+ CWMONITOR=<enable>,<channel>,[<min_pkg_len>],[<max_pkg_len>]
Response:
OK +CWMONITOR,<channel>,<pkg_len>:<data> ...
3.1.22.2. Parameters
- <enable>:
- 0: Stop the monitor mode.
- 1: Set WiFi to enter monitor mode.
- <channel>: Channels that need to be monitored.
- <min_pkg_len>: Filter and receive packets with the minimum length.
- <max_pkg_len>: Filter and receive packets with the maximum length.
- <pkg_len>: Received packet length.
- <data>: Received raw data packet, displayed in hexadecimal format.
3.1.22.3. Note
- The monitored channel needs to be within the channel range set by the AT+CWCOUNTRY.
3.1.22.4. Example
AT+CWMONITOR=1,6 OK +CWMONITOR,6,177:xxxxxxxxxxxxxx ...
3.1.23. AT+CWSTAPROTO
Function: Query/Set the 802.11 b/g/n/ax Protocol Standard of Station Mode
3.1.23.1. Query Command
Function:
Query the 802.11 b/g/n/ax Protocol Standard of Station Mode.
Command:
AT+CWSTAPROTO?
Response:
+CWSTAPROTO:<protocol> OK
3.1.23.2. Set Command
Function:
Set the 802.11 b/g/n/ax Protocol Standard of Station Mode.
Command:
AT+CWSTAPROTO=<protocol>
Response:
OK
3.1.23.3. Parameters
- <enable>:
- bit0: 802.11b protocol standard.
- bit1: 802.11g protocol standard.
- bit2: 802.11n protocol standard.
- bit3: 802.11ax protocol standard.
3.1.23.4. Note
- It will only take effect on the next connection.
- By default, PHY mode of ST67W611M1 is 802.11bgn/ax mode.
3.1.23.5. Example
AT+CWSTAPROTO=1 OK AT+CWMODE=1 OK AT+CWJAP="SSID","12345678" ...
3.1.24. AT+CWAPPROTO
Query/Set the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode
3.1.24.1. Query Command
Function:
Query the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode.
Command:
AT+CWAPPROTO?
Response:
+CWAPPROTO:<protocol> OK
3.1.24.2. Set Command
Function:
Set the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode.
Command:
AT+CWAPPROTO=<protocol>
Response:
OK
3.1.24.3. Parameters
- <enable>:
- bit0: 802.11b protocol standard.
- bit1: 802.11g protocol standard.
- bit2: 802.11n protocol standard.
- bit3: 802.11ax protocol standard.
3.1.24.4. Note
- It will only take effect on the next connection.
- By default, PHY mode of ST67W611M1 is 802.11bgn/ax mode.
3.1.24.5. Example
AT+CWAPPROTO=1 OK AT+CWMODE=2 OK AT+CWSAP="AP_SSID","12345678",1,3,10,0 ...
3.1.25. AT+WPS
Enable the WPS function
3.1.25.1. Set Command
Function:
Enable the WPS function.
Command:
AT+WPS=<enable>[,<auth floor>]
Response:
OK
3.1.25.2. Parameters
- <enable>:
- 1: Enable WPS (Wi-Fi Protected Setup) that uses PBC (Push Button Configuration) mode.
- 0: Disable WPS that uses PBC mode.
- <auth floor>:
- 0: Auth open(Default).
- 1: Auth WEP.
- 2: Auth WPA PSK.
- 3: Auth WPA2 PSK.
- 4: Auth WPA/WPA2 PSK.
3.1.25.2.1. Notes
- WPS can only be used when the ST67W611M1 station is enabled.
- WPS does not support WEP (Wired-Equivalent Privacy) encryption.
3.1.25.3. Example
AT+CWMODE=1 OK AT+WPS=1 OK ...
3.1.26. AT+CWANTENABLE
Enable/Disable Antenna Diversity Function.
3.1.26.1. Query Command
Function:
Query whether the antenna diversity function is enabled. Command:
AT+CWANTENABLE?
Response:
+CWANTENABLE:<dynamic_enable>,<static_enable>,<pin> OK
3.1.26.2. Set Command
Function:
Enable Antenna Diversity Function.
Command:
AT+CWANTENABLE=<dynamic_enable>,<static_enable>[,<pin>]
Response:
OK
3.1.26.3. Parameters
- <dynamic_enable>:
- 1: Enable Dynamic Antenna Diversity Function.
- 0: Disable Dynamic Antenna Diversity Function.
- <static_enable>:
- 1: Enable Static Antenna Diversity Function.
- 0: Disable Static Antenna Diversity Function.
- <pin>: Pin Number.
3.1.26.4. Example
AT+CWANTENABLE=1,1,0 OK AT+RST OK AT+CWMODE=1 OK AT+CWJAP="SSID","password" OK ...
3.1.26.5. Note
- This parameter takes effect after a restart.
3.1.27. AT+CWANTNUM
Get the maximum number of antennas for the current device.
3.1.27.1. Query Command
Function:
Get the maximum number of antennas for the current device.
Command:
AT+CWANTNUM?
Response:
+CWANTNUM:<numbers> OK
3.1.28. AT+CWANT
Set/Query the currently used antenna.
3.1.28.1. Query Command
Function:
Query the currently used antenna.
Command:
AT+CWANT?
Response:
+CWANT:<ant_id> OK
3.1.28.2. Set Command
Function:
Enable Automatic Antenna Diversity Function.
Command:
AT+CWANT=<ant_id>
Response:
OK
3.1.28.3. Parameters
- <ant_id>:
- Antenna Number ID.
3.1.28.4. Example
AT+CWANT=1 OK AT+CWANT=0 OK
Instruction | Description |
---|---|
AT+CIPV6 | Enable/disable the network of Internet Protocol Version 6 (IPv6) |
AT+CIFSR | Obtain the local IP address and MAC address |
AT+CIPDOMAIN | Resolve a Domain Name |
AT+CIPDNS | Query/Set DNS Server Information |
AT+CIPSTATE | Obtain the TCP/UDP/SSL connection information |
AT+CIPRECVBUF | Query/Set the TCP/UDP/SSL receive buffer size |
AT+CIPSTART | Establish TCP connection, UDP transmission, or SSL connection |
AT+CIPSTARTEX | Establish TCP connection, UDP transmission, or SSL connection with an automatically assigned ID |
AT+CIPTCPOPT | Query/Set the socket options |
AT+CIPCLOSE | Close TCP/UDP/SSL connection |
AT+CIPSEND | Send data in the normal transmission mode or Wi-Fi passthrough mode |
AT+CIPSENDL | Send long data in paraller in the normal transmission mode |
AT+CIPSENDLCFG | Set the configuration for the command AT+CIPSENDL |
AT+CIPSENDEX | Send data in the normal transmission mode in expanded ways |
AT+CIPDINFO | Set "+IPD" message mode |
AT+CIPMUX | Enable/disable the multiple connections mode |
AT+CIPSERVER | Delete/create a TCP/SSL server |
AT+CIPSERVERMAXCONN | Query/Set the maximum connections allowed by a server |
AT+CIPSTO | Query/Set the local TCP Server Timeout |
AT+SAVETRANSLINK | Set whether to enter Wi-Fi passthrough mode on power-up |
AT+CIPSNTPCFG | Query/Set the time zone and SNTP server |
AT+CIPSNTPTIME | Query the SNTP time |
AT+CIPSNTPINTV | Query/Set the SNTP time synchronization interval |
AT+CIPRECONNINTV | Query/Set the TCP/UDP/SSL reconnection interval for the Wi-Fi passthrough mode |
AT+CIPRECVMODE | Query/Set socket receiving mode |
AT+CIPRECVDATA | Obtain socket data in passive receiving mode |
AT+CIPRECVLEN | Obtain socket data length in passive receiving mode |
AT+PING | Ping the remote host |
AT+CIPEVT | Turn on or off the event message notification prefixed with +CIP. |
AT+CWEVT | Turn on or off the event message notification prefixed with +CW. |
AT+CIPSSLCCONF | Query/Set SSL Clients. |
AT+CIPSSLCSNI | Query/Set SSL Client Server Name. |
AT+CIPSSLCALPN | Query/Set SSL Client Application Layer Protocol Negotiation (ALPN). |
AT+CIPSSLCPSK | Query/Set SSL Client Pre-shared Key (PSK) in String Format. |
AT+CIPSSLCPSKHEX | Query/Set SSL Client Pre-shared Key (PSK) in Hexadecimal Format. |
AT+IPERF | Test throughput of the ST67W611M1 in standalone mode. |
AT+IPERFSTOP | Stop test throughput of the ST67W611M1. |
4.1. Basic AT command description
4.1.1. AT+CIPV6
Function: Enable/disable the network of Internet Protocol Version 6 (IPv6).
4.1.1.1. Query Command
Function:
Query whether IPv6 is enabled.
Command:
AT+CIPV6?
Response:
+CIPV6:<enable> OK
4.1.1.2. Set Command
Function:
Enable/Disable IPv6 network.
Command:
AT+CIPV6=<enable>
Response:
OK
4.1.1.3. Parameters
<enable>: status of IPv6 network. Default: 0.
- 0: disable IPv6 network.
- 1: enable IPv6 network.
4.1.2. AT+CIFSR
Function: Obtain the Local IP Address and MAC Address.
4.1.2.1. Execute Command
Command:
AT+CIFSR
Response:
// AP mode // AT+CWMODE=2 +CIFSR:APIP,<"APIP"> +CIFSR:APIP6LL,<"APIP6LL"> +CIFSR:APMAC,<"APMAC"> // STA mode // AT+CWMODE=1 +CIFSR:STAIP,<"STAIP"> +CIFSR:STAIP6LL,<"STAIP6LL"> +CIFSR:STAIP6GL,<"STAIP6GL"> +CIFSR:STAMAC,<"STAMAC"> OK
4.1.2.2. Parameters
- <"APIP">: IPv4 address of Wi-Fi softAP interface
- <”APIP6GL”>: Global IPv6 address of Wi-Fi softAP interface
- <"APMAC">: MAC address of Wi-Fi softAP interface
- <"STAIP">: IPv4 address of Wi-Fi station interface
- <”STAIP6LL”>: Linklocal IPv6 address of Wi-Fi station interface
- <”STAIP6GL”>: Global IPv6 address of Wi-Fi station interface
- <"STAMAC">: MAC address of Wi-Fi station interface
4.1.3. AT+CIPDOMAIN
Function: Resolve a Domain Name.
4.1.3.1. Set Command
Command:
AT+CIPDOMAIN=<"domain name">[,<ip network>]
Response:
+CIPDOMAIN:<"IP address"> OK
4.1.3.2. Parameter
- <"domain name">: the domain name.
- <ip network>: preferred IP network. Default: 1.
- 1: preferred resolution of IPv4 address
- 2: resolve IPv4 address only
- 3: resolve IPv6 address only
- <"IP address">: the resolved IPv4 address or IPv6 address.
4.1.3.3. Example
AT+CWMODE=1 // set the station mode AT+CWJAP="SSID","password" // access to the internet AT+CIPDOMAIN="www.google.com" // Domain Name Resolution function // Domain Name Resolution Function for IPv4 address only AT+CIPDOMAIN="www.google.com",2 // Domain Name Resolution Function for IPv6 address only AT+CIPDOMAIN="www.google.com",3
4.1.4. AT+CIPDNS
Function: Set/Query the current DNS server information.
4.1.4.1. Query Command
Function:
Query the current DNS server information.
Command:
AT+CIPDNS?
Response:
+CIPDNS:<enable>[,<"DNS IP1">][,<"DNS IP2">][,<"DNS IP3">] OK
4.1.4.2. Set Command
Function:
Set DNS server information.
Command:
AT+CIPDNS=<enable>[,<"DNS IP1">][,<"DNS IP2">][,<"DNS IP3">]
Response:
OK
or
ERROR
4.1.4.3. Parameter
- <enable>: the domain name.
- **; 0: Enable automatic DNS server settings from DHCP. The DNS will be restored to 208.67.222.222 and 8.8.8.8.
- Only when the ST67W611M1 station completes the DHCP process, the DNS server of the ST67W611M1 station could be updated.
- 1: Enable manual DNS server settings. If you do not set a value for <DNS IPx>, it will use 208.67.222.222 and 8.8.8.8 by default.
- **; 0: Enable automatic DNS server settings from DHCP. The DNS will be restored to 208.67.222.222 and 8.8.8.8.
- <”DNS IP1”>: the first DNS server IP address. For the set command, this parameter only works when you set <enable> to 1, i.e. enable manual DNS settings. If you set <enable> to 1 and a value for this parameter, the ST67W611M1-AT will return this parameter as the current DNS setting when you run the query command.
- <”DNS IP2”>: the second DNS server IP address. For the set command, this parameter only works when you set <enable> to 1, i.e. enable manual DNS settings. If you set <enable> to 1 and a value for this parameter, the ST67W611M1-AT will return this parameter as the current DNS setting when you run the query command.
- <”DNS IP3”>: the third DNS server IP address. For the set command, this parameter only works when you set <enable> to 1, i.e. enable manual DNS settings. If you set <enable> to 1 and a value for this parameter, the ST67W611M1-AT will return this parameter as the current DNS setting when you run the query command.
4.1.4.4. Notes
- The configuration changes will be saved in the NVS area if AT+SYSSTORE=1.
- The three parameters cannot be set to the same server.
- When <enable> is set to 1, the DNS server may change according to the configuration of the router which the ST67W611M1 is connected to.
4.1.4.5. Example
AT+CIPDNS=0 AT+CIPDNS=1,"114.114.114.114"
4.1.5. AT+CIPSTATE
Function: Obtain the TCP/UDP/SSL Connection Information.
4.1.5.1. Query Command
Command:
AT+CIPSTATE?
Response:
When there is a connection, AT returns:
+CIPSTATE:<link ID>,<"type">,<"remote IP">,<remote port>,<local port>,<tetype> OK
When there is no connection, AT returns:
OK
4.1.5.2. Parameters
- <link ID>: ID of the connection (0~4), used for multiple connections.
- <"type">: string parameter showing the type of transmission: "TCP", "TCPv6", "UDP", "UDPv6", "SSL", or "SSLv6".
- <"remote IP">: string parameter showing the remote IPv4 address.
- <remote port>: the remote port number.
- <local port>: the local port number.
- <tetype>:
- 0: ST67W611M1 runs as a client.
- 1: ST67W611M1 runs as a server.
4.1.6. AT+CIPRECVBUF
Function: Query/Set the TCP/UDP/SSL receive buffer size.
4.1.6.1. Set Command
Command:
// Single connection (AT+CIPMUX=0): AT+CIPRECVBUF=<size> // Multiple connection (AT+CIPMUX=1): AT+CIPRECVBUF=<linkid>,<size>
Response:
This command needs to be used when there is no connection with this ID; otherwise, it will return an ERROR.
+CIPRECVBUF OK
4.1.6.2. Parameters
- <linkid>: ID of the connection (0~4), used for multiple connections.
- <size>: Set the size of the buffer, unit bytes.
4.1.6.3. Quert Command
Command:
// Single connection (AT+CIPMUX=0): AT+CIPRECVBUF? // Multiple connection (AT+CIPMUX=1): AT+CIPRECVBUF=<linkid>?
Response:
Return the buffer size for the linkid, with default buffer size being 2920.
+CIPRECVBUF:<size> OK
4.1.7. AT+CIPSTART
Function: Establish TCP Connection, UDP Transmission, or SSL Connection.
4.1.7.1. Establish TCP Connection
4.1.7.1.1. Set Command
Command:
// Single connection (AT+CIPMUX=0): AT+CIPSTART=<"type">,<"remote host">,<remote port>[,<keep_alive>][,<"local IP">][,<timeout>] // Multiple Connections (AT+CIPMUX=1): AT+CIPSTART=<link ID>,<"type">,<"remote host">,<remote port>[,<keep_alive>][,<"local IP">][,<timeout>]
Response:
For single connection, it returns:
+CIP:CONNECTED OK
For multiple connections, it returns:
+CIP:<link ID>,CONNECTED OK
4.1.7.1.2. Parameters
- <link ID>: ID of network connection (0~4), used for multiple connections.
- <"type">: string parameter showing the type of transmission: "TCP","TCPv6","UDP","UDPv6","SSL","SSLv6". Default: "TCP".
- <"remote host">: IPv4/IPv6 address, or domain name of remote host. The maximum length is 64 bytes. If you need to use a domain name and the length of the domain name exceeds 64 bytes, use the AT+CIPDOMAIN command to obtain the IP address corresponding to the domain name, and then use the IP address to establish a connection.
- <remote port>: the remote port number.
- <keep_alive>: It configures the SO_KEEPALIVE option for socket. Unit: second.
- Range: [0,7200].
- 0: disable keep-alive function (default).
- 1 ~ 7200: enable keep-alive function. TCP_KEEPIDLE value is <keep_alive>, TCP_KEEPINTVL value is 1, and TCP_KEEPCNT value is 3.
- This parameter of this command is the same as the
<keep_alive>
parameter of AT+CIPTCPOPT command. It always takes the value set later by either of the two commands. If it is omitted or not set, the last configured value is used by default.
- Range: [0,7200].
- <"local IP">: the local IPv4 address or IPv6 address that the connection binds. This parameter is useful when you are using multiple network interfaces or multiple IP addresses. By default, it is disabled. If you want to use it, you should specify it first. Null is also valid.
- <timeout>: Command timeout. Unit: milliseconds. Default value: 0. Range: [0,20000]. When set to 0, the command timeout depends on the network and lwIP protocol stack; when set to a non-zero value, the command will return within the specified timeout.
4.1.7.1.3. Notes
- To establish a TCP connection based on an IPv6 network, do as follows:
- Make sure that the AP supports IPv6
- Set AT+CIPV6=1
- Obtain an IPv6 address through the AT+CWJAP command
- (Optional) Check whether ST67W611M1 has obtained an IPv6 address using the AT+CIPSTA? command
4.1.7.1.4. Example
AT+CIPSTART="TCP","192.168.101.110",1000 AT+CIPSTART="TCP","192.168.101.110",2500,60 AT+CIPSTART="TCP","192.168.101.110",1000,,"192.168.101.100" AT+CIPSTART="TCPv6","test-ipv6.com",80 AT+CIPSTART="TCPv6","fe80::860d:8eff:fe9d:cd90",1000,,"fe80::411c:1fdb:22a6:4d24"
4.1.7.1.5. Query Command
Command:
AT+CIPSTART?
Response:
For single connection, it returns:
+CIPSTART:<link ID>,<"type">,<"ip">,<remote_port>,<local_port>,<tetype> OK
4.1.7.2. Parameters
- <link ID>: ID of the connection (0~4), used for multiple connections.
- <"type">: string parameter showing the type of transmission: "TCP", "TCPv6", "UDP", "UDPv6", "SSL", or "SSLv6".
- <"remote IP">: string parameter showing the remote IPv4 address.
- <remote port>: the remote port number.
- <local port>: the local port number.
- <tetype>:
- 0: ST67W611M1 runs as a client.
- 1: ST67W611M1 runs as a server.
4.1.8. AT+CIPSTARTEX
Function: Establish TCP connection, UDP transmission, or SSL connection with an Automatically Assigned ID.
This command is similar to AT+CIPSTART except that you do not need to assign an ID by yourself in multiple connections mode (AT+CIPMUX=1). The system will assign an ID to the new connection automatically.
4.1.9. [Data Mode Only] +++ : Exit from Data Mode
4.1.9.1. Special Execute Command
Function:
Exit from Data Mode and enter the Command Mode.
Command:
// Only for data mode +++
4.1.9.1.1. Notes
- This special execution command consists of three identical
+
characters (0x2b ASCII), and no CR-LF appends to the command tail. - Make sure there is more than 20 ms interval before the first
+
character, more than 20 ms interval after the third+
character, less than 20 ms interval among the three+
characters. Otherwise, the+
characters will be sent out as normal data. - This command returns no reply.
- Please wait for at least one second before sending the next AT command.
4.1.10. AT+CIPTCPOPT
Function: Query/Set the Socket Options.
4.1.10.1. Query Command
Function:
Query current socket options.
Command:
AT+CIPTCPOPT?
Response:
+CIPTCPOPT:<link_id>,<so_linger>,<tcp_nodelay>,<so_sndtimeo>,<keepalive> OK
4.1.10.2. Set Command
Command:
// Single TCP connection (AT+CIPMUX=0): AT+CIPTCPOPT=[<so_linger>],[<tcp_nodelay>],[<so_sndtimeo>],[<keepalive>] // Multiple TCP Connections (AT+CIPMUX=1): AT+CIPTCPOPT=<link ID>,[<so_linger>],[<tcp_nodelay>],[<so_sndtimeo>],[<keepalive>]
Response:
OK
or
ERROR
4.1.10.3. Parameters
- <link_id>: ID of the connection (0 ~ max). For multiple connections, if the value is max, it means all connections. By default, max is 5.
- <so_linger>: configure the
SO_LINGER
options for the socket (refer to SO_LINGER description). Unit: second. Default: -1.- = -1: off
- = 0: on, linger time = 0
- > 0: on, linger time = <so_linger>
- <tcp_nodelay>: configure the
TCP_NODELAY
option for the socket (refer to TCP_NODELAY description). Default: 0.- 0: disable TCP_NODELAY
- 1: enable TCP_NODELAY
- <so_sndtimeo>: configure the
SO_SNDTIMEO
option for socket (refer to SO_SNDTIMEO description). Unit: millisecond. Default: 0. - <keepalive>: It configures the SO_KEEPALIVE option for socket. Unit: second.
- Range: [0,7200].
- 0: disable keep-alive function (default).
- 1 ~ 7200: enable keep-alive function. TCP_KEEPIDLE value is <keepalive>, TCP_KEEPINTVL value is 1, and TCP_KEEPCNT value is 3.
- This parameter of this command is the same as the
<keepalive>
parameter of AT+CIPTCPOPT command. It always takes the value set later by either of the two commands. If it is omitted or not set, the last configured value is used by default. Setting a low keepalive value in low-power mode will result in increased power consumption.
- Range: [0,7200].
4.1.10.4. Notes
- Before configuring these socket options, please make sure you fully understand the function of them and the possible impact after configuration.
- The SO_LINGER option is not recommended to be set to a large value. For example, if you set SO_LINGER value to 60, then AT+CIPCLOSE command will block for 60 seconds if ST67W611M1 cannot receive TCP FIN packet from the remote TCP peer due to network issues, so ST67W611M1 is unable to respond to any other AT commands. Therefore, it is recommended to keep the default value of the SO_LINGER option.
- The TCP_NODELAY option is used for situations with small throughput but high real-time requirements. If this option is enabled, LwIP will speed up TCP transmission, but in a poor network environment, the throughput will be reduced due to retransmission. Therefore, it is recommended to keep the default value of the TCP_NODELAY option.
- The SO_SNDTIMEO option is used for situations where the keepalive parameter is not configured in AT+CIPSTART command. After this option is configured, AT+CIPSEND , AT+CIPSENDL , and AT+CIPSENDEX commands will exit within this timeout, regardless of whether data are sent successfully or not. Here, SO_SNDTIMEO is recommended to be set to 5 ~ 10 seconds.
- The SO_KEEPALIVE option is used for actively and regularly detecting whether the connection is disconnected. It is generally recommended to configure this option when AT is used as a TCP server. After this option is configured, additional network bandwidth will be cost. Recommended value of SO_KEEPALIVE should be not less than 60 seconds. Setting a low keepalive value in low-power mode will result in increased power consumption.
4.1.11. AT+CIPCLOSE
Function: Close TCP/UDP/SSL Connection.
4.1.11.1. Set Command
Function:
Close TCP/UDP/SSL connection in the multiple connections mode.
Command:
AT+CIPCLOSE=<link ID>
Response:
<link ID>,CLOSED OK
4.1.11.2. Execute Command
Function:
Close TCP/UDP/SSL connection in the single connection mode.
AT+CIPCLOSE
Response:
CLOSED OK
4.1.11.3. Parameter
- <link ID>: ID of the connection that you want to close. If you set it to 5, all connections will be closed.
4.1.12. AT+CIPSEND
Function: Send Data in the Normal Transmission Mode or Wi-Fi Passthrough Mode
4.1.12.1. Set Command
Function:
Set the data length to be send in the Normal Transmission Mode. If the length of data you need to send exceeds 8192 bytes, please use the AT+CIPSENDL command.
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSEND=<length> // Multiple connections: (AT+CIPMUX=1) AT+CIPSEND=<link ID>,<length> // Remote host and port can be set for UDP transmission: AT+CIPSEND=[<link ID>,]<length>[,<"remote host">,<remote port>]
Response:
OK >
This response indicates that AT is ready for receiving serial data. You should enter the data, and when the data length reaches the <length>
value, the transmission of data starts.
If the connection cannot be established or is disrupted during data transmission, the system returns:
ERROR
If the data has been successfully sent to the protocol stack (It does not mean that the data has been sent to the opposite end), the system returns:
SEND OK
4.1.12.2. Execute Command
Function:
Enter the Wi-Fi Passthrough Mode.
Command:
AT+CIPSEND
Response:
OK >
or
ERROR
Enter the Wi-Fi Passthrough Mode. The ST67W611M1 can receive 8192 bytes and send 2920 bytes at most each time. If the data received by ST67W611M1 reaches or exceeds 2920 bytes, the data will be immediately sent in chunks of 2920 bytes. Otherwise, it will wait for 20 milliseconds before being sent (You can configure this interval using AT+TRANSINTVL command). When a single packet containing +++ is received, the ST67W611M1 will exit the data sending mode under the Wi-Fi Passthrough Mode. Please wait for at least one second before sending the next AT command.
This command can only be used for single connection in the Wi-Fi Passthrough Mode. For UDP Wi-Fi passthrough, the <mode>
parameter has to be 0 when using AT+CIPSTART.
4.1.12.3. Parameters
- <link ID>: ID of the connection (0~4), for multiple connections.
- <length>: data length. Maximum: 8192 bytes.
- <"remote host">: IPv4 address, or domain name of remote host. It can be set in UDP transmission.
- <remote port>: the remote port number.
4.1.12.4. Notes
- You can use AT+CIPTCPOPT command to configure socket options for each TCP connection. For example, setting <so_sndtimeo> to 5000 will enable TCP send operation to return results within 5 seconds, regardless of success or failure. This can save the time that the MCU waits for AT command response.
4.1.13. AT+CIPSENDL
Function: Send Long Data in Parallel in the Normal Transmission Mode.
4.1.13.1. Set Command
Function:
In the Normal Transmission Mode, set the data length to be sent, and then send data to remote host in parallel (the AT command port receives data in parallel with the AT sending data to the remote host). You can use the AT+CIPSENDLCFG command to configure this command. If the length of data you need to send is less than 8192 bytes, you also can use the AT+CIPSEND command.
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSENDL=<length> // Multiple connections: (AT+CIPMUX=1) AT+CIPSENDL=<link ID>,<length> // Remote host and port can be set for UDP transmission: AT+CIPSENDL=[<link ID>,]<length>[,<"remote host">,<remote port>]
Response:
OK >
This response indicates that AT enters the Data Mode and AT command port is ready to receive data. You can enter the data now. Once the port receives data, it will be pushed to underlying protocol stack and the transmission starts.
If the transmission starts, the system reports message according to AT+CIPSENDLCFG configuration:
+CIPSENDL:<had sent len>,<port recv len>
If the transmission is cancelled by +++ command, the system returns:
SEND CANCELLED
If not all the data has been sent out, the system finally returns:
SEND FAIL
If the data has been successfully sent to the protocol stack (It does not mean that the data has been sent to the opposite end), the system finally returns:
SEND OK
When the connection is disconnected, you can send +++ command to cancel the transmission, then the ST67W611M1 will exit from the Data Mode, otherwise, the Data Mode will not end until the AT command port receives all the data of the specified <length>
.
4.1.13.2. Parameters
- <link ID>: ID of the connection (0~4), for multiple connections.
- <length>: data length. Maximum: 2 31 - 1 bytes.
- <"remote host">: IPv4 address, or domain name of remote host. It can be set in UDP transmission.
- <remote port>: the remote port number.
- <had sent len>: the length of data successfully sent to the underlying protocol stack.
- <port recv len>: data length received by AT command port.
4.1.13.3. Notes
- It is recommended to use UART flow control, because if the UART receives data at a faster rate than the network sends, data loss may occur.
- You can use AT+CIPTCPOPT command to configure socket options for each TCP connection. For example, setting <so_sndtimeo> to 5000 will enable TCP send operation to return results within 5 seconds, regardless of success or failure. This can save the time that the MCU waits for AT command response.
4.1.14. AT+CIPSENDLCFG
Function: Set the Configuration for the Command AT+CIPSENDL.
4.1.14.1. Query Command
Function:
Query the configuration of AT+CIPSENDL
Command:
AT+CIPSENDLCFG?
Response:
+CIPSENDLCFG:<report size>,<transmit size> OK
4.1.14.2. Set Command
Function:
Set the configuration of AT+CIPSENDL.
Command:
AT+CIPSENDLCFG=<report size>[,<transmit size>]
Response:
OK
4.1.14.3. Parameters
- <report size>: report block size for AT+CIPSENDL. Default: 1024. Range: [100,2 20]. For example, set
<report size>
to 100,<had sent len>
report sequence in the response of AT+CIPSENDL will be (100, 200, 300, 400, ...). The final<had sent len>
report is always equal to the data length that had been sent out. - <transmit size>: transmit block size of AT+CIPSENDL. It specifies the size of the data block sent to the underlying protocol stack. Default: 2920. Range: [100,2920]. If the data received by ST67W611M1 reaches or exceeds
<transmit size>
bytes, the data will be immediately sent in chunks of<transmit size>
bytes. Otherwise, it will wait for 20 milliseconds before being sent (You can configure this interval using AT+TRANSINTVL command).
4.1.14.3.1. Note
- For devices with small throughput but high real-time requirements, it is recommended to set a smaller
<transmit size>
. It is also recommended to setTCP_NODELAY
by AT+CIPTCPOPT command. - For devices with large throughput, it is recommended to set a larger
<transmit size>
.
4.1.15. AT+CIPSENDEX
Function: Send Data in the Normal Transmission Mode in Expanded Ways.
4.1.15.1. Set Command
Function:
Set the data length to be send in Normal Transmission Mode, or use \0
(0x5c, 0x30 ASCII) to trigger data transmission.
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSENDEX=<length> // Multiple connections: (AT+CIPMUX=1) AT+CIPSENDEX=<link ID>,<length> // Remote host and port can be set for UDP transmission: AT+CIPSENDEX=[<link ID>,]<length>[,<"remote host">,<remote port>]
Response:
OK >
This response indicates that AT is ready for receiving data. You should enter the data of designated length. When the data length reaches the <length>
value, or when the string \0
appears in the data, the transmission starts.
If the connection cannot be established or gets disconnected during transmission, the system returns:
ERROR
If the data has been successfully sent to the protocol stack (It does not mean that the data has been sent to the opposite end), the system returns:
SEND OK
4.1.15.2. Parameters
- <link ID>: ID of the connection (0~4), for multiple connections.
- <length>: data length. Maximum: 8192 bytes.
- <"remote host">: IPv4 address, or domain name of remote host. It can be set in UDP transmission.
- <remote port>: remote port can be set in UDP transmission.
4.1.15.3. Notes
- When the requirement of data length is met, or when the string
\0
(0x5c, 0x30 in ASCII) appears, the transmission of data starts. Go back to the normal command mode and wait for the next AT command. - If the data contains the
\<any>
, it means that drop backslash symbol and only use<any>
character. - When sending
\0
, please use a backslash to escape it as\\0
. - You can use AT+CIPTCPOPT command to configure socket options for each TCP connection. For example, setting <so_sndtimeo> to 5000 will enable TCP send operation to return results within 5 seconds, regardless of success or failure. This can save the time that the MCU waits for AT command response.
4.1.16. AT+CIPDINFO
Function: Set "+IPD" Message Mode.
4.1.16.1. Query Command
Command:
AT+CIPDINFO?
Response:
+CIPDINFO:true OK
or
+CIPDINFO:false OK
4.1.16.2. Set Command
Command:
AT+CIPDINFO=<mode>
Response:
OK
4.1.16.3. Parameters
- <mode>:
- 0: does not show the remote host and port in "+IPD" messages.
- 1: show the remote host and port in "+IPD" messages.
4.1.16.4. Example
AT+CIPDINFO=1
4.1.17. AT+CIPMUX
Function: Enable/disable Multiple Connections.
4.1.17.1. Query Command
Function:
Query the connection type.
Command:
AT+CIPMUX?
Response:
+CIPMUX:<mode> OK
4.1.17.2. Set Command
Function:
Set the connection type.
Command:
AT+CIPMUX=<mode>
Response:
OK
4.1.17.3. Parameter
- <mode>: connection mode. Default: 0.
- 0: single connection.
- 1: multiple connections.
4.1.17.4. Notes
- This mode can only be changed after all connections are disconnected.
- If you want to set the single connection mode when the TCP/SSL server is running, you should delete the server first. (AT+CIPSERVER=0).
4.1.17.5. Example
AT+CIPMUX=1
4.1.18. AT+CIPSERVER
Function: Delete/create a TCP/SSL Server.
4.1.18.1. Query Command
Function:
Query the TCP/SSL server status.
Command:
AT+CIPSERVER?
Response:
+CIPSERVER:<mode>[,<port>,<"type">][,<CA enable>][,<keepalive>] OK
4.1.18.2. Set Command
Command:
AT+CIPSERVER=<mode>[,<param2>][,<"type">][,<CA enable>][,<keepalive>]
Response:
OK
4.1.18.3. Parameters
- <mode>:
- 0: delete a server.
- 1: create a server.
- <param2>: It means differently depending on the parameter
<mode>
:
* If
<mode>
is 1,<param2>
represents the port number. Default: 333.
- If
<mode>
is 0,<param2>
represents whether the server closes all connections. Default: 0.
- 0: shutdown the server and keep existing connections.
- 1: shutdown the server and close all connections.
- <"type">: server type: "TCP", "TCPv6", "SSL", or "SSLv6". Default: "TCP".
- <CA enable>:
- 0: disable CA.
- 1: enable CA.
- <keepalive>: It configures the SO_KEEPALIVE option for socket. Unit: second.
- Range: [0,7200].
- 0: disable keep-alive function (default).
- 1 ~ 7200: enable keep-alive function. TCP_KEEPIDLE value is <keepalive>, TCP_KEEPINTVL value is 1, and TCP_KEEPCNT value is 3.
- This parameter of this command is the same as the
<keepalive>
parameter of AT+CIPTCPOPT command. It always takes the value set later by either of the two commands. If it is omitted or not set, the last configured value is used by default. Setting a low keepalive value in low-power mode will result in increased power consumption.
- Range: [0,7200].
4.1.18.4. Notes
- A TCP/SSL server can only be created when multiple connections are activated (AT+CIPMUX=1).
- A server monitor will be created automatically when the server is created. Only one server can be created at most.
- When a client is connected to the server, it will take up one connection and be assigned an ID.
- Parameters
<\"type\">
and<CA enable>
must be omitted when delete a server.
4.1.18.5. Example
// To create a TCP server AT+CIPMUX=1 AT+CIPSERVER=1,80 // To create an SSL server AT+CIPMUX=1 AT+CIPSERVER=1,443,"SSL",1 // To delete an server and close all clients AT+CIPSERVER=0,1
4.1.19. AT+CIPSERVERMAXCONN
Function: Query/Set the Maximum Connections Allowed by a Server.
4.1.19.1. Query Command
Function:
Obtain the maximum number of clients allowed to connect to the TCP/SSL server.
Command:
AT+CIPSERVERMAXCONN?
Response:
+CIPSERVERMAXCONN:<num> OK
4.1.19.2. Set Command
Function:
Set the maximum number of clients allowed to connect to the TCP/SSL server.
Command:
AT+CIPSERVERMAXCONN=<num>
Response:
OK
4.1.19.3. Parameter
- <num>: the maximum number of clients allowed to connect to the TCP/SSL server. Range: [1,5]. For how to change the upper limit of this range, please refer to the description of the
<link ID>
parameter of the AT+CIPSTART command.
4.1.19.4. Note
- You should call the command
AT+CIPSERVERMAXCONN=<num>
before creating a server.
4.1.19.5. Example
AT+CIPMUX=1 AT+CIPSERVERMAXCONN=2 AT+CIPSERVER=1,80
4.1.20. AT+CIPSTO
Function: Query/Set the local TCP/SSL Server Timeout.
4.1.20.1. Query Command
Function:
Query the local TCP/SSL server timeout.
Command:
AT+CIPSTO?
Response:
+CIPSTO:<time> OK
4.1.20.2. Set Command
Function:
Set the local TCP/SSL server timeout.
Command:
AT+CIPSTO=<time>
Response:
OK
4.1.20.3. Parameter
- <time>: local TCP/SSL server timeout. Unit: second. Range: [0,7200].
4.1.20.4. Notes
- When a TCP/SSL client does not communicate with the ST67W611M1 server within the
<time>
value, the server will terminate this connection. - If you set
<time>
to 0, the connection will never timeout. This configuration is not recommended. - When the client initiates a communication with the server or the server initiate a communication with the client within the set time, the timer will restart. After the timeout expires, the client is closed.
4.1.20.5. Example
AT+CIPMUX=1 AT+CIPSERVER=1,1001 AT+CIPSTO=10
4.1.21. AT+SAVETRANSLINK
Function: Set Whether to Enter Wi-Fi Passthrough Mode on Power-up.
4.1.21.1. For TCP/SSL Single Connection
4.1.21.1.1. Set Command
Command:
AT+SAVETRANSLINK=<mode>,<"remote host">,<remote port>[,<"type">,<keep alive>]
Response:
OK
4.1.21.1.2. Parameters
- <mode>:
- 0: ST67W611M1 will NOT enter Wi-Fi Passthrough Mode on power-up.
- 1: ST67W611M1 will enter Wi-Fi Passthrough Mode on power-up.
- <"remote host">: string parameter showing the IPv4 address or domain name of remote host.
- <remote port>: the remote port number.
- <"type">: string parameter showing the type of transmission: "TCP", "TCPv6", "SSL", or "SSLv6". Default: "TCP".
- <keep alive>: TCP keep-alive interval. Default: 0.
- 0: disable the keep-alive function.
- 1 ~ 7200: detection interval. Unit: second.
4.1.21.1.3. Notes
- This command will save the Wi-Fi Passthrough Mode configuration in the easyflash area. If
<mode>
is set to 1, ST67W611M1 device will enter the Wi-Fi Passthrough Mode in any subsequent power cycles. The configuration will take effect after ST67W611M1 reboots. - As long as the remote host and port are valid, the configuration will be saved in flash.
4.1.21.1.4. Example
AT+SAVETRANSLINK=1,"192.168.6.110",1002,"TCP" AT+SAVETRANSLINK=1,"www.google.com",443,"SSL" AT+SAVETRANSLINK=1,"240e:3a1:2070:11c0:55ce:4e19:9649:b75",8080,"TCPv6" AT+SAVETRANSLINK=1,"240e:3a1:2070:11c0:55ce:4e19:9649:b75",8080,"SSLv6"
4.1.21.2. For UDP Transmission
4.1.21.2.1. Set Command
Command:
AT+SAVETRANSLINK=<mode>,<"remote host">,<remote port>,[<"type">,<local port>]
Response:
OK
4.1.21.2.2. Parameters
- <mode>:
- 0: ST67W611M1 will NOT enter Wi-Fi Passthrough Mode on power-up.
- 1: ST67W611M1 will enter Wi-Fi Passthrough Mode on power-up.
- <"remote host">: string parameter showing the IPv4 address or domain name of remote host.
- <remote port>: the remote port number.
- <"type">: string parameter showing the type of transmission: "UDP" or "UDPv6". Default: "TCP".
- <local port>: local port when UDP Wi-Fi passthrough is enabled on power-up.
4.1.21.2.3. Notes
- This command will save the Wi-Fi Passthrough Mode configuration in the easyflash area. If
<mode>
is set to 1, ST67W611M1 device will enter the Wi-Fi Passthrough Mode in any subsequent power cycles. The configuration will take effect after ST67W611M1 reboots. - As long as the remote host and port are valid, the configuration will be saved in flash.
4.1.21.2.4. Example
AT+SAVETRANSLINK=1,"192.168.6.110",1002,"UDP",1005 AT+SAVETRANSLINK=1,"240e:3a1:2070:11c0:55ce:4e19:9649:b75",8081,"UDPv6",1005
4.1.22. AT+CIPSNTPCFG
Function: Query/Set the Time Zone and the SNTP Server.
4.1.22.1. Query Command
Command:
AT+CIPSNTPCFG?
Response:
+CIPSNTPCFG:<enable>,<timezone>,<SNTP server1>[,<SNTP server2>,<SNTP server3>] OK
4.1.22.2. Set Command
Command:
AT+CIPSNTPCFG=<enable>,<timezone>[,<SNTP server1>,<SNTP server2>,<SNTP server3>]
Response:
OK
4.1.22.3. Parameters
- <enable>: configure the SNTP server:
- 1: the SNTP server is configured.
- 0: the SNTP server is not configured.
- <timezone>: support the following two formats:
- The first format range is [-12,14]. It marks most of the time zones by offset from Coordinated Universal Time (UTC) in whole hours (UTC–12:00 to UTC+14:00).
- The second format is
UTC offset
. TheUTC offset
specifies the time value you must add to the UTC time to get a local time value. It has syntax like[+|-][hh]mm
. This is negative if the local time zone is on the west of the Prime Meridian and positive if it is on the east. The hour (hh) must be between -12 and 14, and the minute(mm) between 0 and 59. For example, if you want to set the timezone to New Zealand (Chatham Islands) which is inUTC+12:45
, you should set the parameter<timezone>
to1245
. Please refer to UTC offset wiki for more information.
- [<SNTP server1>]: the first SNTP server.
- [<SNTP server2>]: the second SNTP server.
- [<SNTP server3>]: the third SNTP server.
4.1.22.4. Note
- If the three SNTP servers are not configured, one of the following default servers will be used: "cn.ntp.org.cn", "ntp.sjtu.edu.cn", and "us.pool.ntp.org".
- For the query command,
<timezone>
parameter in the response may be different from the<timezone>
parameter in set command. Because the<timezone>
parameter supports the secondUTC offset
format, for example, setAT+CIPSNTPCFG=1,015
, for query command, ST67W611M1-AT ignores the leading zero of the<timezone>
parameter, and the valid value is15
. It does not belong to the first format, so it is parsed according to the secondUTC offset
format, that is,UTC+00:15
, that is,timezone
is 0 in the response.
4.1.22.5. Example
// Enable SNTP server, set timezone to New York of the United States (UTC–05:00) AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" or AT+CIPSNTPCFG=1,-500,"0.pool.ntp.org","time.google.com" // Enable SNTP server, set timezone to New Zealand (Chatham Islands, UTC+12:45) AT+CIPSNTPCFG=1,1245,"0.pool.ntp.org","time.google.com"
4.1.23. AT+CIPSNTPTIME
Function: Query the SNTP Time.
4.1.23.1. Query Command
Command:
AT+CIPSNTPTIME?
Response:
+CIPSNTPTIME:<asctime style time> OK
4.1.23.2. Note
- The asctime style time is defined at asctime man page.
- When ST67W611M1 enters Light-sleep or Deep-sleep mode and then wakes up, the system time may become inaccurate. It is recommended to resend the AT+CIPSNTPCFG command to obtain the new time from the NTP server.
4.1.23.3. Example
AT+CWMODE=1 AT+CWJAP="AP_TEST","1234567890" AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" AT+CIPSNTPTIME? +CIPSNTPTIME:Tue Oct 19 17:47:56 2021 OK or AT+CWMODE=1 AT+CWJAP="AP_TEST","1234567890" AT+CIPSNTPCFG=1,530 AT+CIPSNTPTIME? +CIPSNTPTIME:Tue Oct 19 15:17:56 2021 OK
4.1.24. AT+CIPSNTPINTV
Function: Query/Set the SNTP time synchronization interval.
4.1.24.1. Query Command
Command:
AT+CIPSNTPINTV?
Response:
+CIPSNTPINTV:<interval second> OK
4.1.24.2. Set Command
Command:
AT+CIPSNTPINTV=<interval second>
Response:
OK
4.1.24.2.1. Parameters
- <interval second>: the SNTP time synchronization interval. Unit: second. Range: [15,4294967].
4.1.24.3. Notes
- It configures interval for synchronization, which means that it sets interval how often ST67W611M1 connects to NTP servers to get new time.
4.1.24.4. Example
AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" OK // synchronize SNTP time every hour AT+CIPSNTPINTV=3600 OK
4.1.25. AT+CIPRECONNINTV
Function: Query/Set the TCP/UDP/SSL reconnection Interval for the Wi-Fi Passthrough Mode.
4.1.25.1. Query Command
Function:
Query the automatic connect interval for the Wi-Fi Passthrough Mode.
Command:
AT+CIPRECONNINTV?
Response:
+CIPRECONNINTV:<interval> OK
4.1.25.2. Set Command
Function:
Set the automatic reconnecting interval when TCP/UDP/SSL transmission breaks in the Wi-Fi Passthrough Mode.
Command:
AT+CIPRECONNINTV=<interval>
Response:
OK
4.1.25.3. Parameter
- <interval>: the duration between automatic reconnections. Unit: 100 milliseconds. Default: 1. Range: [1,36000].
4.1.25.4. Note
- The configuration changes will be saved in the easyflash area if AT+SYSSTORE=1 .
4.1.25.5. Example
AT+CIPRECONNINTV=10
4.1.26. AT+CIPRECVMODE
Function: Query/Set Socket Receiving Mode.
4.1.26.1. Query Command
Function:
Query the socket receiving mode.
Command:
AT+CIPRECVMODE?
Response:
+CIPRECVMODE:<mode> OK
4.1.26.2. Set Command
Command:
AT+CIPRECVMODE=<mode>
Response:
OK
4.1.26.3. Parameter
<mode>: the receive mode of socket data. Default: 0.
- 0: active mode. ST67W611M1-AT will send all the received socket data instantly to the host MCU with the header “+IPD”. (The socket receive window is 2920 bytes by default. The maximum valid bytes sent to MCU is 2920 bytes each time.)
- 1: passive mode. ST67W611M1-AT will keep the received socket data in an internal buffer (socket receive window, 2920 bytes by default), and wait for the host MCU to read. If the buffer is full, the socket transmission will be blocked for TCP/SSL connections, or data will be lost for UDP connections.
4.1.26.4. Note
The configuration can not be used in the Wi-Fi Passthrough Mode. If it is a UDP transmission in passive mode, data will be lost when the buffer is full.
When ST67W611M1-AT receives socket data in passive mode, it will prompt the following messages in different scenarios:
For multiple connections mode (AT+CIPMUX=1), the message is +IPD:<link ID>,<len>.
For single connection mode (AT+CIPMUX=0), the message is +IPD:<len>.
<len> is the total length of socket data in the buffer.
You should read data by running AT+CIPRECVDATA once there is a +IPD reported. Otherwise, the next +IPD will not be reported to the host MCU until the previous +IPD has been read.
When the connection is disconnected, the cache will be cleared.
4.1.26.5. Example
AT+CIPRECVMODE=1
4.1.27. AT+CIPRECVDATA
Obtain socket data in passive receiving mode.
4.1.27.1. Set Command
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPRECVDATA=<len> // Multiple connections: (AT+CIPMUX=1) AT+CIPRECVDATA=<link_id>,<len>
Response:
+CIPRECVDATA:<actual_len>,<data> OK
4.1.27.2. Parameter
- <mode>: the receive mode of socket data. Default: 0.
- <link_id>: connection ID in multiple connections mode.
- <len>: the max value is 0x7fffffff. If the actual length of the received data is less than len, the actual length will be returned.
- <actual_len>: length of the data you actually obtain.
- <data>: the data you want to obtain.
4.1.27.3. Example
AT+CIPRECVMODE=1 // For example, if host MCU gets a message of receiving 100-byte data in connection with No.0, // the message will be "+IPD:0,100". // Then you can read those 100-byte data by using the command below. AT+CIPRECVDATA=0,100
4.1.28. AT+CIPRECVLEN
Function: Obtain Socket Data Length in Passive Receiving Mode.
4.1.28.1. Query Command
Function:
Query the length of the entire data buffered for the connection.
Command:
AT+CIPRECVLEN?
Response:
\:
// Single connection: (AT+CIPMUX=0) +CIPRECVLEN:<data length of link> OK // Multiple connections: (AT+CIPMUX=1) +CIPRECVLEN:<data length of link0>,<data length of link1>,<data length of link2>,<data length of link3>,<data length of link4> OK
4.1.28.2. Note
- For SSL connections, the data length returned by ST67W611M1-AT may be less than the actual data length.
4.1.28.3. Example
AT+CIPRECVLEN? // Multiple connections: (AT+CIPMUX=1) +CIPRECVLEN:100,0,0,0,0, // Single connection: (AT+CIPMUX=0) +CIPRECVLEN:100 OK
4.1.29. AT+PING
Function: Ping the Remote Host.
4.1.29.1. Set Command
Function:
Ping the remote host.
Command:
AT+PING=<"host"> AT+PING=<"host">,[<len>,<count>,<interval>]
Response:
+PING:<time> OK
or
+PING:TIMEOUT // at returns this response only when the domain name resolution failure or ping timeout ERROR
4.1.29.2. Parameters
- <"host">: String parameter showing the host IPv4 or IPV6 address or domain name.
- <len>: the length of the ping packet. Unit: byte. Range: (0,65535).
- <count>: the count of the ping packet.
- <interval>: the interval between ping packets. Unit: millisecond. Range: (0,65535).
- <time>: the response time of ping. Unit: millisecond. Range: (0,1000).
4.1.29.3. Notes
- If the remote host is a domain name string, ping will first resolve the domain name (IPv4 address preferred) from DNS (domain name server) and then ping the remote IP address.
4.1.29.4. Example
AT+PING="192.168.1.1" AT+PING="www.google.com" AT+PING="192.168.1.1",64,8,500 // China Future Internet Engineering Center AT+PING="240c::6666"
4.1.30. AT+CIPEVT
Function: Turn on or off the event message notification prefixed with +CIP.
4.1.30.1. Set Command
Function:
Turn on or off the event message notification prefixed with +CIP.
Command:
AT+CIPEVT=<enable>
Response:
+CIPEVT OK
4.1.30.2. Parameters
<enable>: Turn on or off the event message notification prefixed with +CIP.
- 1: Enable printing of "+CIP" events.
- 0: Disable printing of "+CIP" events.
4.1.30.3. Query Command
Function:
Query event message notifications with prefix+CIP.
Command:
AT+CIPEVT?
Response:
+CIPEVT:<enable> OK
4.1.31. AT+CWEVT
Function: Turn on or off the event message notification prefixed with +CW.
4.1.31.1. Set Command
Function:
Turn on or off the event message notification prefixed with +CW.
Command:
AT+CWEVT=<enable>
Response:
+CWEVT OK
4.1.31.2. Parameters
<enable>: Turn on or off the event message notification prefixed with +CW.
- 1: Enable printing of "+CW" events.
- 0: Disable printing of "+CW" events.
4.1.31.3. Query Command
Function:
Query event message notifications with prefix+CW.
Command:
AT+CWEVT?
Response:
+CWEVT:<enable> OK
4.1.32. AT+CIPSSLCCONF
Function: Query/Set SSL Clients.
4.1.32.1. Query Command
Function:
Query the configuration of each connection where the ST67W611M1 runs as an SSL client.
Command:
AT+CIPSSLCCONF?
Response:
+CIPSSLCCONF:<linkid>,<auth_mode>,"<cert_name>","<key_name>","<ca_name>" OK
4.1.32.2. Set Command
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSSLCCONF=<auth_mode>[,"<cert_name>"][,"<key_name>"][,"<ca_name>"] // Multiple connections: (AT+CIPMUX=1) AT+CIPSSLCCONF=<linkid>,<auth_mode>[,"<cert_name>"][,"<key_name>"][,"<ca_name>"]
Response:
OK
4.1.32.3. Parameters
<linkid>: ID of the connection (0~4), used for multiple connections.
<auth_mode>:
- 0: no authentication. In this case <pki_number> and <ca_number> are not required.
- 1: the client provides the client certificate for the server to verify.
- 2: the client loads CA certificate to verify the server’s certificate.
- 3: mutual authentication.
<cert_name>: The file name of the certificate.
<key_name>: The file name of the private key.
<ca_name>: The file name of CA used by the client to verify the server.
4.1.32.4. Example
// Single connection: (AT+CIPMUX=0) AT+CIPSSLCCONF=3,"cert_01.crt","private_01.key","ca_01.crt" // No auth (AT+CIPMUX=1) AT+CIPSSLCCONF=0,0 // Client auth (AT+CIPMUX=1) AT+CIPSSLCCONF=0,1,"","","ca_01.crt" // Server auth (AT+CIPMUX=1) AT+CIPSSLCCONF=0,2,"cert_01.crt","private_01.key" // Both auth (AT+CIPMUX=1) AT+CIPSSLCCONF=0,3,"cert_01.crt","private_01.key","ca_01.crt"
4.1.32.5. Notes
- If you want this configuration to take effect immediately, run this command before establishing an SSL connection.
- When downloading AT firmware, it is necessary to download the littlefs file system, and the default file system is mounted to /lfs.
- If you need to dynamically modify the certificate content, you can refer to the command:`AT+FS_`.
- If <auth_mode> is configured to 2 or 3, in order to check the server certificate validity period, please make sure ST67W611M1 has obtained the current time before sending the AT+CIPSTART command. (You can send AT+CIPSNTPCFG command to configure SNTP and obtain the current time, and send AT+CIPSNPTIME? command to query the current time.)
4.1.33. AT+CIPSSLCSNI
Function: Query/Set SSL Client Server Name Indication (SNI).
4.1.33.1. Query Command
Function:
Query the SNI configuration of each connection.
Command:
AT+CIPSSLCSNI?
Response:
+CIPSSLCSNI:<link ID>,<"sni"> OK
4.1.33.2. Set Command
Command:
//Single connection: (AT+CIPMUX=0) AT+CIPSSLCSNI=<"sni"> // Multiple connections: (AT+CIPMUX=1) AT+CIPSSLCSNI=<link ID>,<"sni">
Response:
OK
4.1.33.3. Parameters
- <linkid>: ID of the connection (0~4), used for multiple connections.
- *; <”sni”>: the Server Name Indication in ClientHello, this parameter is used to verify the Common Name in the certificate sent by the server.
- The maximum length of sni is 64 bytes.
4.1.33.4. Notes
- If you want this configuration to take effect immediately, run this command before establishing an SSL connection.
- When downloading AT firmware, it is necessary to download the romfs file system, and the default file system is mounted to /romfs.
4.1.34. AT+CIPSSLCALPN
Function: Query/Set SSL Client Application Layer Protocol Negotiation (ALPN).
4.1.34.1. Query Command
Function:
Query the ALPN configuration of each connection where the ST67W611M1 runs as an SSL client.
Command:
AT+CIPSSLCALPN?
Response:
+CIPSSLCALPN:<link ID>[,<"alpn">][,<"alpn">][,<"alpn">] OK
4.1.34.2. Set Command
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSSLCALPN=<counts>[,<"alpn">][,<"alpn">][,<"alpn">] // Multiple connections: (AT+CIPMUX=1) AT+CIPSSLCALPN=<link ID>,<counts>[,<"alpn">][,<"alpn">][,<"alpn">]
Response:
OK
4.1.34.3. Parameters
<linkid>: ID of the connection (0~4), used for multiple connections.
<counts>: the number of ALPNs. Range: [0,5].
- 0: clean the ALPN configuration.
- [1,5]: set the ALPN configuration.
<"alpn">: A string parameter showing the ALPN in ClientHello. The maximum length of alpn is limited by the command length.
4.1.34.4. Notes
- If you want this configuration to take effect immediately, run this command before establishing an SSL connection.
4.1.35. AT+CIPSSLCPSK
Function: Query/Set SSL Client Pre-shared Key (PSK) in String Format.
4.1.35.1. Query Command
Function:
Query the PSK configuration of each connection where the ST67W611M1 runs as an SSL client.
Command:
AT+CIPSSLCPSK?
Response:
+CIPSSLCPSK:<link ID>,<"psk">,<"hint"> OK
4.1.35.2. Set Command
Command:
// Single connection: (AT+CIPMUX=0) AT+CIPSSLCPSK=<"psk">,<"hint"> // Multiple connections: (AT+CIPMUX=1) AT+CIPSSLCPSK=<link ID>,<"psk">,<"hint">
Response:
OK
4.1.35.3. Parameters
- <linkid>: ID of the connection (0~4), used for multiple connections.
- <"psk">: The pre-shared key in string format. Maximum length: 32. Please use AT+CIPSSLCPSKHEX command if your <"psk"> parameter contains 0 characters.
- <"hint">: The pre-shared key identity. Maximum length: 32.
4.1.35.4. Notes
- If you want this configuration to take effect immediately, run this command before establishing an SSL connection.
4.1.36. AT+CIPSSLCPSKHEX
Function: Query/Set SSL Client Pre-shared Key (PSK) in Hexadecimal Format.
4.1.36.1. Notes
- Similar to the AT+CIPSSLCPSK command, this command also sets or queries the SSL Client PSK, but its <"psk"> is in hexadecimal format rather than in string format. So, 0 in the <"psk"> parameter means 00.
4.1.36.2. Example
// Single connection: (AT+CIPMUX=0), pre-shared key is "psk", pre-shared key identity is "myhint". AT+CIPSSLCPSKHEX="70736b","myhint" // Multiple connections: (AT+CIPMUX=1), pre-shared key is "psk", pre-shared key identity is "myhint". AT+CIPSSLCPSKHEX=0,"70736b","myhint"
4.1.37. AT+IPERF
Function: Test throughput of the ST67W611M1 in standalone mode.
4.1.37.1. Set Command
Command:
AT+IPERF=<"direct">,<"type">,[<"ipaddr">],[<time>],[<port>]
Response:
OK
4.1.37.2. Parameters
- <"direct">: The direction of iperf, "TX" or "RX".
- <"type">: The type of connection, "TCP" or "UDP".
- <"ipaddr">: Target ip address. If acting as a client, this parameter must be set.
- <"time">: The duration of iperf, default value 10S.(Unit seconds)
- <"port">: The port number of iperf, default value 5001.
4.1.37.3. Example
AT+IPERF="RX","TCP" AT+IPERF="TX","TCP","192.168.1.2",1000 AT+IPERF="TX","TCP","192.168.1.2",1000,5001
4.1.38. AT+IPERFSTOP
Function: Stop test throughput of the ST67W611M1.
4.1.38.1. Set Command
Command:
AT+IPERFSTOP
Response:
OK
4.1.38.2. Example
AT+IPERF="TX","TCP","192.168.1.2",1000 AT+IPERFSTOP
5. MQTT AT commands
Instruction | Description |
---|---|
AT+MQTTUSERCFG | Get/Set MQTT user configuration |
AT+MQTTCLIENTID | Get/Set MQTT client ID |
AT+MQTTUSERNAME | Get/Set MQTT username |
AT+MQTTPASSWORD | Get/Set MQTT password |
AT+MQTTCONNCFG | Get/Set configuration of MQTT connection |
AT+MQTTALPN | Get/Set MQTT Application Layer Protocol Negotiation (ALPN) |
AT+MQTTSNI | Get/Set MQTT Server Name Indication (SNI) |
AT+MQTTCONN | Connect to MQTT Brokers |
AT+MQTTPUB | Publish MQTT Messages in string |
AT+MQTTPUBRAW | Publish long MQTT messages |
AT+MQTTSUB | Subscribe to MQTT topics |
AT+MQTTUNSUB | Unsubscribe from MQTT topics |
AT+MQTTCLEAN | Close MQTT connections |
5.1. MQTT AT command description
5.1.1. AT+MQTTUSERCFG
Get/Set MQTT user configuration.
5.1.1.1. Query Command
Query MQTT User Configuration.
Command:
AT+MQTTUSERCFG?
Response:
+MQTTUSERCFG:<LinkID>,<scheme>,<"client_id">,<"username">,<"password">,<"cert_file">,<"key_file">,<"ca_file"> OK
5.1.1.2. Set Command
Set MQTT User Configuration.
Command:
AT+MQTTUSERCFG=<LinkID>,<scheme>,<"client_id">,<"username">,<"password">[,<"cert_file">][,<"key_file">][,<"ca_file">]
Response:
OK
5.1.1.3. Parameters
<LinkID>: currently only supports link ID 0.
<scheme>:
- 0: MQTT over TCP.
- 1: MQTT over TLS (no certificate verify).
- 2: MQTT over TLS (verify server certificate).
- 3: MQTT over TLS (provide client certificate).
- 4: MQTT over TLS (verify server certificate and provide client certificate).
<client_id>: MQTT client ID. Maximum length: 23 bytes.
<username>: The username to login to the MQTT broker. Maximum length: 128 bytes.
<password>: The password to login to the MQTT broker. Maximum length: 128 bytes.
<"cert_file">: The file name of the certificate.
<"key_file">: The file name of the private key.
<"ca_file">: The file name of CA used by the client to verify the server.
5.1.1.4. Notes
- The length of the entire AT command should be less than 256 bytes.
- If <scheme> is configured to 3, 5, 8, or 10, in order to check the server certificate validity period, please make sure ST67W611M1 has obtained the current time before sending the AT+MQTTCONN command. (You can send AT+CIPSNTPCFG command to configure SNTP and obtain the current time, and send AT+CIPSNPTIME? command to query the current time.)
5.1.2. AT+MQTTCLIENTID
Get/Set MQTT client ID.
5.1.2.1. Query Command
Query MQTT client ID.
Command:
AT+MQTTCLIENTID?
Response:
+MQTTCLIENTID:<LinkID>,<"client_id"> OK
5.1.2.2. Notes
- The maximum length of the query command does not exceed 128 bytes (limited to AT length)
5.1.2.3. Set Command
Set MQTT client ID.
Command:
AT+MQTTLONGCLIENTID=<LinkID>,<length>
Response:
OK >
This response indicates that AT is ready for receiving MQTT Client ID. You should enter the Client ID, and when the Client ID length reaches the <length> value, the system returns:
OK
5.1.2.4. Parameters
- <LinkID>: currently only supports link ID 0.
- <length>: MQTT client ID length. Range: [1,23].
5.1.2.5. Notes
The command AT+MQTTUSERCFG can also set MQTT client ID. The differences between the two commands include:
- You can use AT+MQTTLONGCLIENTID to set a relatively long client ID since there is a limitation on the length of the AT+MQTTUSERCFG command.
- You should set AT+MQTTLONGCLIENTID after setting the AT+MQTTUSERCFG command.
5.1.3. AT+MQTTUSERNAME
Get/Set MQTT username.
5.1.3.1. Query Command
Query MQTT username.
Command:
AT+MQTTUSERNAME?
Response:
+MQTTUSERNAME:<LinkID>,<"user_name"> OK
5.1.3.2. Notes
- The maximum length of the query command does not exceed 128 bytes (limited to AT length)
5.1.3.3. Set Command
Set MQTT username.
Command:
AT+MQTTUSERNAME=<LinkID>,<length>
Response:
OK >
This response indicates that AT is ready for receiving MQTT username. You should enter the MQTT username, and when the MQTT username length reaches the <length> value, the system returns:
OK
5.1.3.4. Parameters
- <LinkID>: currently only supports link ID 0.
- <length>: MQTT username length. Range: [1,128].
5.1.3.5. Notes
The command AT+MQTTUSERCFG can also set MQTT username. The differences between the two commands include:
- You can use AT+MQTTLONGUSERNAME to set a relatively long username since there is a limitation on the length of the AT+MQTTUSERCFG command.
- You should set AT+MQTTLONGUSERNAME after setting the command AT+MQTTUSERCFG.
5.1.4. AT+MQTTPASSWORD
Get/Set MQTT password.
5.1.4.1. Query Command
Query MQTT password.
Command:
AT+MQTTPASSWORD?
Response:
+MQTTPASSWORD:<LinkID>,<"password"> OK
5.1.4.2. Notes
- The maximum length of the query command does not exceed 128 bytes (limited to AT length)
5.1.4.3. Set Command
Set MQTT password.
Command:
AT+MQTTPASSWORD=<LinkID>,<length>
Response:
OK >
This response indicates that AT is ready for receiving MQTT password. You should enter the MQTT password, and when the MQTT password length reaches the <length> value, the system returns:
OK
5.1.4.4. Parameters
- <LinkID>: currently only supports link ID 0.
- <length>: MQTT password length. Range: [1,128].
5.1.4.5. Notes
The command AT+MQTTUSERCFG can also set MQTT password. The differences between the two commands include:
- You can use AT+MQTTLONGPASSWORD to set a relatively long password since there is a limitation on the length of the AT+MQTTUSERCFG command.
- You should set AT+MQTTLONGPASSWORD after setting the command AT+MQTTUSERCFG.
5.1.5. AT+MQTTCONNCFG
Get/Set configuration of MQTT connection.
5.1.5.1. Query Command
Query configuration of MQTT connection.
Command:
AT+MQTTCONNCFG?
Response:
+MQTTCONNCFG:<LinkID>,<keepalive>,<disable_clean_session>,<"lwt_topic">,<"lwt_msg">,<lwt_qos>,<lwt_retain> OK
5.1.5.2. Set Command
Set configuration of MQTT Connection.
Command:
AT+MQTTCONNCFG=<LinkID>,<keepalive>,<disable_clean_session>,<"lwt_topic">,<"lwt_msg">,<lwt_qos>,<lwt_retain>
Response:
OK
5.1.5.3. Parameters
<LinkID>: currently only supports link ID 0.
<keepalive>: timeout of MQTT ping. Unit: second. Range [0,7200]. The default value is 0, which will be force-changed to 120 s.
<disable_clean_session>: set MQTT clean session. For more details about this parameter, please refer to the section Clean Session in MQTT Version 3.1.1.
- 0: enable clean session.
- 1: disable clean session.
<lwt_topic>: LWT (Last Will and Testament) message topic. Maximum length: 128 bytes.
<lwt_msg>: LWT message. Maximum length: 128 bytes.
<lwt_qos>: LWT QoS, which can be set to 0, 1, or 2. Default: 0.
<lwt_retain>: LWT retain, which can be set to 0 or 1. Default: 0.
5.1.6. AT+MQTTALPN
Get/Set MQTT Application Layer Protocol Negotiation (ALPN).
5.1.6.1. Query Command
Query MQTT Application Layer Protocol Negotiation (ALPN).
Command:
AT+MQTTALPN?
Response:
+MQTTALPN:<LinkID>[,<"alpn">][,<"alpn">][,<"alpn">] OK
5.1.6.2. Set Command
Set MQTT Application Layer Protocol Negotiation (ALPN).
Command:
AT+MQTTALPN=<LinkID>,<alpn_counts>[,<"alpn">][,<"alpn">][,<"alpn">]
Response:
OK
5.1.6.3. Parameters
<LinkID>: Currently only supports link ID 0.
<alpn_counts>: The number of <”alpn”> parameters. Range: [0,5].
- 0: clean the MQTT ALPN configuration.
- [1,5]: set the MQTT ALPN configuration.
<"alpn">: You can send more than one ALPN in ClientHello to the server.
5.1.6.4. Notes
- The length of the entire AT command should be less than 256 bytes.
- MQTT ALPN will be effective only if the MQTT connection is based on TLS or WSS.
- You should set AT+MQTTALPN after setting the command AT+MQTTUSERCFG.
5.1.6.5. Example
AT+CWMODE=1 AT+CWJAP="ssid","password" AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" AT+MQTTUSERCFG=0,4,"ST67W611M","user","123456789","client_1.crt","client_1.key","ca_1.crt" AT+MQTTALPN=0,2,"mqtt-ca.cn","mqtt-ca.us" AT+MQTTCONN=0,"192.168.31.112",8883,1
5.1.7. AT+MQTTSNI
Get/Set MQTT Server Name Indication (SNI).
5.1.7.1. Query Command
Query MQTT Server Name Indication (SNI).
Command:
AT+MQTTSNI?
Response:
+MQTTSNI:<LinkID>,<"sni"> OK
5.1.7.2. Set Command
Set MQTT Server Name Indication (SNI).
Command:
AT+MQTTSNI=<LinkID>,<"sni">
Response:
OK
5.1.7.3. Parameters
- <LinkID>: Currently only supports link ID 0.
- <"sni">: MQTT Server Name Indication. You can send it in ClientHello to the server.
5.1.7.4. Notes
- The length of the entire AT command should be less than 256 bytes.
- MQTT SNI will be effective only if the MQTT connection is based on TLS or WSS.
- You should set AT+MQTTSNI after setting the command AT+MQTTUSERCFG.
5.1.7.5. Example
AT+CWMODE=1 AT+CWJAP="ssid","password" AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" AT+MQTTUSERCFG=0,4,"ST67W611M","user","123456789","client_1.crt","client_1.key","ca_1.crt" AT+MQTTSNI=0,"my_specific_prefix.iot.my_aws_region.amazonaws.com" AT+MQTTCONN=0,"192.168.31.112",8883,1
5.1.8. AT+MQTTCONN
Connect to MQTT Brokers.
5.1.8.1. Query Command
Query MQTT Brokers that have already been connected.
Command:
AT+MQTTCONN?
Response:
+MQTTCONN:<LinkID>,<state>,<scheme><"host">,<port>,<reconnect> OK
5.1.8.2. Set Command
Connect to MQTT Brokers.
Command:
AT+MQTTCONN=<LinkID>,<"host">,<port>,<reconnect>
Response:
OK +MQTT:CONNECTED,0
or
+MQTT:DISCONNECTED,0
5.1.8.3. Parameters
<LinkID>: Currently only supports link ID 0.
<"host">: MQTT broker domain. Maximum length: 128 bytes.
<port>: MQTT broker port. Maximum: port 65535.
<reconnect>:
- 0: MQTT will not reconnect automatically. If MQTT connection established and then disconnected, you cannot use this command to reestablish MQTT connection. Please send AT+MQTTCLEAN=0 command to clean MQTT connection first, reconfigure the connection parameters, and then establish a new MQTT connection.
- 1: MQTT will reconnect automatically. It takes more resources.
<state>:
- 0: MQTT uninitialized.
- 1: already set AT+MQTTUSERCFG.
- 2: already set AT+MQTTCONNCFG.
- 3: connection disconnected.
- 4: connection established.
- 5: connected, but did not subscribe to any topic.
- 6: connected, and subscribed to MQTT topics.
<scheme>:
- 0: MQTT over TCP.
- 1: MQTT over TLS (no certificate verify).
- 2: MQTT over TLS (verify server certificate).
- 3: MQTT over TLS (provide client certificate).
- 4: MQTT over TLS (verify server certificate and provide client certificate).
5.1.9. AT+MQTTPUB
Publish MQTT Messages in string.
5.1.9.1. Set Command
Function:
Publish MQTT messages in string to a defined topic. If the amount of data you publish is relatively large, and the length of a single AT command has exceeded the threshold of 256, please use the AT+MQTTPUBRAW command.
Command:
AT+MQTTPUB=<LinkID>,<"topic">,<"data">,<qos>,<retain>
Response:
OK
5.1.9.2. Parameters
- <LinkID>: Currently only supports link ID 0.
- <"topic">: MQTT topic. Maximum length: 128 bytes.
- <"data">: MQTT message in string.
- <qos>: QoS of message, which can be set to 0, 1, or 2. Default: 0.
- <retain>: retain flag.
5.1.9.3. Notes
- The length of the entire AT command should be less than 256 bytes.
- This command cannot send data 0. If you need to send 0, please use the command AT+MQTTPUBRAW instead.
5.1.9.4. Example
AT+CWMODE=1 AT+CWJAP="ssid","password" AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com" AT+MQTTUSERCFG=0,4,"ST67W611M","user","123456789","client_1.crt","client_1.key","ca_1.crt" AT+MQTTALPN=0,2,"mqtt-ca.cn","mqtt-ca.us" AT+MQTTCONN=0,"192.168.31.112",8883,1 AT+MQTTPUB=0,"topic","\"{\"timestamp\":\"20201121085253\"}\"",0,0 // When sending this command, please pay attention to whether special characters need to be escaped.
5.1.10. AT+MQTTPUBRAW
Publish Long MQTT Messages.
5.1.10.1. Set Command
Function:
Publish long MQTT messages to a defined topic. If the amount of data you publish is relatively small, and the length of a single AT command is not greater than the threshold of 256, you also can use the AT+MQTTPUB command.
Command:
AT+MQTTPUBRAW=<LinkID>,<"topic">,<length>,<qos>,<retain>
Response:
OK >
The symbol > indicates that AT is ready for receiving serial data, and you can enter the data now. When the requirement of message length determined by the parameter <length> is met, the transmission starts.
If the transmission is successful, AT returns:
SEND OK
Otherwise, it returns:
SEND FAIL
5.1.10.2. Parameters
- <LinkID>: Currently only supports link ID 0.
- <"topic">: MQTT topic. Maximum length: 128 bytes.
- <length>: length of MQTT message. The maximum length is limited by available memory.
- <qos>: QoS of the published message, which can be set to 0, 1, or 2. Default is 0.
- <retain>: retain flag.
5.1.11. AT+MQTTSUB
Subscribe to MQTT topics.
5.1.11.1. Query Command
Query subscribed MQTT topics.
Command:
AT+MQTTSUB?
Response:
+MQTTSUB:<LinkID>,<state>,<"topic1">,<qos> +MQTTSUB:<LinkID>,<state>,<"topic2">,<qos> +MQTTSUB:<LinkID>,<state>,<"topic3">,<qos> ... OK
5.1.11.2. Set Command
Function:
Subscribe to defined MQTT topics with defined QoS. It supports subscribing to multiple topics.
Command:
AT+MQTTSUB=<LinkID>,<"topic">,<qos>
Response:
OK
If the topic has been subscribed before, it will prompt:
+MQTTSUB,ALREADY_SUBSCRIBE OK
When AT receives MQTT messages of the subscribed topic, it will prompt:
+MQTT:SUBRECV,<LinkID>,<topic_length>,<data_length>,<"topic">,<data>
5.1.11.3. Parameters
<LinkID>: Currently only supports link ID 0.
<state>:
- 0: MQTT uninitialized.
- 1: already set AT+MQTTUSERCFG.
- 2: already set AT+MQTTCONNCFG.
- 3: connection disconnected.
- 4: connection established.
- 5: connected, but subscribe to no topic.
- 6: connected, and subscribed to MQTT topics.
<topic>: the topic that is subscribed to.
<qos>: the QoS that is subscribed to.
5.1.12. AT+MQTTUNSUB
Unsubscribe from MQTT topics.
5.1.12.1. Set Command
Function:
Unsubscribe the client from defined topics. This command can be called multiple times to unsubscribe from different topics.
Command:
AT+MQTTUNSUB=<LinkID>,<"topic">
Response:
OK
If the topic has been subscribed before, it will prompt:
+MQTTUNSUB:NO_UNSUBSCRIBE OK
5.1.12.2. Parameters
- <LinkID>: Currently only supports link ID 0.
- <topic>: MQTT topic. Maximum length: 128 bytes.
5.1.13. AT+MQTTCLEAN
Close MQTT connections.
5.1.13.1. Set Command
Function:
Close the MQTT connection and release the resource.
Command:
AT+MQTTCLEAN=<LinkID>
Response:
OK
5.1.13.2. Parameters
- <LinkID>: Currently only supports link ID 0.
Instruction | Description |
---|---|
AT+BLEINIT | Initialize BLE |
AT+BLEADDR | BLE address |
AT+BLENAME | Set BLE device name |
AT+BLESCANPARAM | Set BLE scanning parameters |
AT+BLESCAN | Enable BLE scanning |
AT+BLESCANRSPDATA | Set BLE SCAN Response data |
AT+BLEADVPARAM | Set BLE advertising parameters |
AT+BLEADVDATA | Set BLE advertising data |
AT+BLEADVSTART | Enable BLE advertising |
AT+BLEADVSTOP | Stop BLE advertising |
AT+BLECONN | Establish BLE connection |
AT+BLECONNPARAM | Update BLE connection parameters |
AT+BLEDISCONN | End BLE connection |
AT+BLEDATALEN | Set BLE packet length |
AT+BLEEXCHANGEMTU | Exchange the size of BLE MTU |
AT+BLEGATTSSRV | GATTS discover services |
AT+BLEGATTSSRVCRE | GATTS create services |
AT+BLEGATTSSRVDEL | GATTS delete services |
AT+BLEGATTSREGISTER | GATTS services Register/Unregister |
AT+BLEGATTSCHAR | GATTS discover characteristics |
AT+BLEGATTSCHARCRE | GATTS create characteristics |
AT+BLEGATTSNTFY | GATTS characteristics notify |
AT+BLEGATTSIND | GATTS characteristics indicate |
AT+BLEGATTSRD | GATTS characteristics read |
AT+BLEGATTCSRVDIS | GATTC discover services |
AT+BLEGATTCCHARDIS | GATTC discover characteristics |
AT+BLEGATTCWR | GATTC characteristics write |
AT+BLEGATTCRD | GATTC characteristics read |
AT+BLEGATTCSUBSCRIBE | GATTC subscribe server |
AT+BLEGATTCUNSUBSCRIBE | GATTC unsubscribe server |
AT+BLETXPWR | BLE TX power |
AT+BLESECPARAM | Set/Query BLE security parameter |
AT+BLESECCANNEL | BLE Cannel Pairing |
AT+BLESECPASSKEYCONFIRM | BLE Pairing passkey confirm |
AT+BLESECPAIRINGCONFIRM | BLE Pairing confirm |
AT+BLESECPASSKEY | BLE Pairing pass entry |
AT+BLESECGETLTKLIST | Query BLE Paired deviceList |
AT+BLESECUNPAIR | BLE unpairing |
AT+BLESECSTART | BLE start pairing |
AT+BLEBASINIT | BLE BAS profile init |
AT+BLEBASDEINIT | BLE BAS profile deinit |
AT+BLEBASLVLGET | GET BLE BAS profile level |
AT+BLEBASLVLSET | SET BLE BAS profile level |
AT+BLEIASINIT | BLE IAS profile init |
AT+BLEIASDEINIT | BLE IAS profile deinit |
AT+BLEDISINIT | BLE DIS profile init |
AT+BLEDISDEINIT | BLE DIS profile deinit |
AT+BLEDISSET | BLE DIS profile setting |
6.1. BLE AT command description
6.1.1. AT+BLEINIT
Function: BLE initialization.
6.1.1.1. Query Command
Function:
Check the initialization status of BLE.
Command:
AT+BLEINIT?
Response:
If BLE is initialized, AT will return:
+BLEINIT:<role> OK
If BLE is not initialized, AT will return:
+BLEINIT:0 OK
6.1.1.2. Set Command
Function:
Initialize BLE.
Command:
AT+BLEINIT=<init>
Response:
OK
6.1.1.3. Parameter
- <init>:
- 0: deinit BLE
- 1: client role
- 2: server role
6.1.2. AT+BLEADDR
Function: Query/Set the BLE address.
6.1.2.1. Query Command
Function:
Query the BLE device address.
Command:
AT+BLEADDR?
Response:
+BLEADDR:<BLE_public_addr> OK
6.1.2.2. Set Command
Function:
Set the BLE device address.
Command:
AT+BLEADDR=<BLE_public_addr>
Response:
OK
6.1.2.3. Parameter
- <BLE_public_addr>:
6.1.3. AT+BLENAME
Function: Query/Set the BLE device name.
6.1.3.1. Query Command
Function:
Query the BLE device name.
Command:
AT+BLENAME?
Response:
+BLENAME:<device_name> OK
6.1.3.2. Set Command
Function:
Set the BLE device name.
Command:
AT+BLENAME=<device_name>
Response:
OK
6.1.3.3. Parameter
- <device_name>: the BLE device name. The maximum length is 29.
6.1.4. AT+BLESCANPARAM
Function: Query/Set the parameters of BLE scanning.
6.1.4.1. Query Command
Function:
Query the parameters of BLE scanning.
Command:
AT+BLESCANPARAM?
Response:
+BLESCANPARAM:<scan_type>,<own_addr_type>,<filter_policy>,<scan_interval>,<scan_window> OK
6.1.4.2. Set Command
Function:
Set the parameters of BLE scanning.
Command:
AT+BLESCANPARAM=<scan_type>,<own_addr_type>,<filter_policy>,<scan_interval>,<scan_window>
Response:
OK
6.1.4.3. Parameters
- <scan_type>:
- 0: passive scan
- 1: active scan
- <own_addr_type>:
- 0: Public Address
- 1: Random Address
- 2: RPA Public Address
- 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. It should be more than or equal to the value of <scan_window>. The range of this parameter is [0x0004,0x4000]. The scan interval equals this parameter multiplied by 0.625 ms, so the range for the actual scan interval is [2.5,10240] ms.
- <scan_window>: scan window. It should be less than or equal to the value of <scan_interval>. The range of this parameter is [0x0004,0x4000]. The scan window equals this parameter multiplied by 0.625 ms, so the range for the actual scan window is [2.5,10240] ms.
6.1.5. AT+BLESCAN
Function: Enable BLE scanning.
6.1.5.1. Set Command
Function:
Enable/disable scanning.
Command:
AT+BLESCAN=<enable>
Response:
+BLESCAN:<addr>,<rssi>,<adv_data>,<scan_rsp_data>,<addr_type> OK
6.1.5.2. Parameters
- <enable>:
- 1: enable continuous scanning.
- 0: disable continuous scanning.
- <addr>: BLE address.
- <rssi>: signal strength.
- <adv_data>: advertising data.
- <scan_rsp_data>: scan response data.
- <addr_type>: the address type of broadcasters.
6.1.5.3. Example
AT+BLEINIT=1 // Role: client AT+BLESCAN=1 // start scanning AT+BLESCAN=0 // stop scanning
6.1.6. AT+BLESCANRSPDATA
Function: Set BLE SCAN Response data.
6.1.6.1. Set Command
Function:
Set scan response.
Command:
AT+BLESCANRSPDATA=<scan_rsp_data>
Response:
OK
6.1.6.2. Parameter
- <scan_rsp_data>: scan response data is a HEX string. For example, if you want to set the response data to “02010606095757575757”, the command should be AT+BLESCANRSPDATA="02010606095757575757". BT_DATA_NAME_COMPLETE DATA index must be 2,like AT+BLESCANRSPDATA="02010606095757575757".
6.1.6.3. Example
AT+BLEINIT=2 // Role: server AT+BLESCANRSPDATA="02010606095757575757"
6.1.7. AT+BLEADVPARAM
Function: Query/Set Parameters of BLE Advertising.
6.1.7.1. Query Command
Function:
Query the parameters of advertising.
Command:
AT+BLEADVPARAM?
Response:
+BLEADVPARAM:<adv_int_min>,<adv_int_max>,<adv_type>,<channel_map> OK
6.1.7.2. Set Command
Function:
Set the parameters of advertising.
Command:
AT+BLEADVPARAM=<adv_int_min>,<adv_int_max>,<adv_type>,<channel_map>
Response:
OK
6.1.7.3. Parameters
- <adv_int_min>: minimum advertising interval. The range of this parameter is [0x0020,0x4000]. The actual advertising interval equals this parameter multiplied by 0.625 ms, so the range for the actual minimum interval is [20, 10240] ms. It should be less than or equal to the value of <adv_int_max>.
- <adv_int_max>: maximum advertising interval. The range of this parameter is [0x0020,0x4000]. The actual advertising interval equals this parameter multiplied by 0.625 ms, so the range for the actual maximum interval is [20, 10240] ms. It should be more than or equal to the value of <adv_int_min>.
- <adv_type>:
- 0: ADV_TYPE_IND
- 1: ADV_TYPE_SCAN_IND
- 2: ADV_TYPE_NONCONN_IND
- <channel_map>: channel of advertising.
- 1: ADV_CHNL_37
- 2: ADV_CHNL_38
- 4: ADV_CHNL_39
- 7: ADV_CHNL_ALL
6.1.7.4. Example
AT+BLEINIT=2 // Role: server AT+BLEADVPARAM=160,320,0,7
6.1.8. AT+BLEADVDATA
Function: Set BLE Advertising data.
6.1.8.1. Set Command
Function:
Set advertising data.
Command:
AT+BLEADVDATA=<adv_data>
Response:
OK
6.1.8.2. Parameter
- <adv_data>: advertising data in HEX string. For example, to set the advertising data to “02010606095757575757”, the command should be AT+BLEADVDATA="02010606095757575757". The maximum length is 31 bytes.
6.1.8.3. Example
AT+BLEINIT=2 // Role: server AT+BLEADVDATA="02010606095757575757"
6.1.9. AT+BLEADVSTART
Function: Start BLE advertising.
6.1.9.1. Execute Command
Function:
Start advertising.
Command:
AT+BLEADVSTART
Response:
OK
6.1.9.2. Example
AT+BLEINIT=2 // Role: server AT+BLEADVSTART
6.1.10. AT+BLEADVSTOP
Function: Stop BLE advertising.
6.1.10.1. Execute Command
Function:
Stop advertising.
Command:
AT+BLEADVSTOP
Response:
OK
6.1.10.2. Example
AT+BLEINIT=2 // Role: server AT+BLEADVSTART AT+BLEADVSTOP
6.1.11. AT+BLECONN
Function: Establish BLE connection.
6.1.11.1. Query Command
Function:
Query the Bluetooth LE connection.
Command:
AT+BLECONN?
Response:
+BLECONN:<conn_index>,<remote_address> OK
If the connection has not been established, there will be no <conn_index> and <remote_address> in the response.
6.1.11.2. Set Command
Function:
Establish the BLE connection.
Command:
AT+BLECONN=<conn_index>,<remote_address>[,<addr_type>,<timeout>]
Response:
If the connection is established successfully, it will prompt:
+BLECONN:<conn_index>,<remote_address> OK
If the connection fails, it will prompt:
+BLECONN:<conn_index>,-1 ERROR
If the connection fails due to parameters error or other reasons, it will prompt:
ERROR
6.1.11.3. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <remote_address>: remote BLE address.
- <addr_type>: the address type of broadcasters:
- 0: Public Address
- 1: Random Address
- <timeout> :connection req timeout (option).[3,30].
6.1.11.4. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10
6.1.12. AT+BLECONNPARAM
Function: Query/Update parameters of BLE connection.
6.1.12.1. Query Command
Function:
Query the parameters of BLE connection.
Command:
AT+BLECONNPARAM?
Response:
+BLECONNPARAM:<conn_index>,<min_interval>,<max_interval>,<cur_interval>,<latency>,<timeout> OK
6.1.12.2. Set Command
Function:
Update the parameters of BLE connection.
Command:
AT+BLECONNPARAM=<conn_index>,<min_interval>,<max_interval>,<latency>,<timeout>
Response:
OK
If the setting fails, it will prompt the message below:
+BLECONNPARAM: <conn_index>,-1
6.1.12.3. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <min_interval>: minimum connecting interval. It should be less than or equal to the value of <max_interval>. The range of this parameter is [0x0006,0x0C80]. The actual connecting interval equals this parameter multiplied by 1.25 ms, so the range for the actual minimum interval is [7.5,4000] ms.
- <max_interval>: maximum connecting interval. It should be more than or equal to the value of <min_interval>. The range of this parameter is [0x0006,0x0C80]. The actual connecting interval equals this parameter multiplied by 1.25 ms, so the range for the actual maximum interval is [7.5,4000] ms.
- <cur_interval>: current connecting interval.
- <latency>: latency. Range: [0x0000,0x01F3].
- <timeout>: timeout. The range of this parameter is [0x000A,0x0C80]. The actual timeout equals this parameter multiplied by 10 ms, so the range for the actual timeout is [100,32000] ms.
6.1.12.4. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLECONNPARAM=0,12,14,1,500
6.1.13. AT+BLEDISCONN
Function: End BLE connection.
6.1.13.1. Execute Command
Function:
End the BLE connection.
Command:
AT+BLEDISCONN=<conn_index>
Response:
OK // The AT+BLEDISCONN command is received. +BLEDISCONN:<conn_index>,<remote_address> // The command is successful.
6.1.13.2. Parameters
- <conn_index>:index of BLE connection. Range: [0,1].
- <remote_address>: remote BLE address.
6.1.13.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEDISCONN=0
6.1.14. AT+BLEDATALEN
Function: Set the length of BLE data packet.
6.1.14.1. Query Command
Function:
Set the length of BLE data packet.
Command:
AT+BLEDATALEN=<conn_index>,<tx_octets>,<tx_time>
Response:
OK
6.1.14.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <tx_octets>: data packet’s length. Range: [27,251].
- <tx_time>: data packet transition time.
Note
The BLE connection has to be established first.
6.1.14.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEDATALEN=0,251,2120
6.1.15. AT+BLEEXCHANGEMTU
Function: Exchange BLE MTU Length.
6.1.15.1. Set Command
Function:
Set the length of the maximum transmission unit (MTU).
Command:
AT+BLEEXCHANGEMTU=<conn_index>
Response:
OK
6.1.15.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
6.1.15.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 BLEEXCHANGEMTU=0
6.1.16. AT+BLEGATTSSRV
Function: GATTS Discovers Services.
6.1.16.1. Query Command
Function:
GATTS Discovers Services.
Command:
AT+BLEGATTSSRV?
Response:
+BLEGATTSSRV:<srv_index>,<srv_uuid>,<srv_type>,<uuid_type> OK
6.1.16.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <srv_uuid>: service’s UUID
- <srv_type>: service’s type
- 0: not primary service
- 1: primary service
- <uuid_type>: uuid’s type
- 0: 16-bit UUID
- 2: 128-bit UUID
6.1.16.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRV?
6.1.17. AT+BLEGATTSSRVCRE
Function: GATTS Creates Services.
6.1.17.1. Set Command
Function:
The Generic Attributes Server (GATTS) creates BLE services.
Command:
AT+BLEGATTSSRVCRE=<srv_index>,<srv_uuid>,<srv_type>,<uuid_type>
Response:
OK
6.1.17.2. Parameters
- <srv_index>: service’s index starting from 0 to 1
- <srv_uuid>: service’s UUID
- <srv_type>: service’s type
- 0: not primary service
- 1: primary service
- <uuid_type>: uuid’s type
- 0: 16-bit UUID
- 2: 128-bit UUID
6.1.17.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2
6.1.18. AT+BLEGATTSSRVDEL
Function: GATTS Delete Services.
6.1.18.1. Set Command
Function:
The Generic Attributes Server (GATTS) delete BLE services.
Command:
AT+BLEGATTSSRVDEL=<srv_index>
Response:
OK
6.1.18.2. Parameter
- <srv_index>: service’s index starting from 0 to 2
6.1.18.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVDEL=0
6.1.19. AT+BLEGATTSREGISTER
Function: GATTS services Register/Unregister.
6.1.19.1. Set Command
Function:
GATTS services Register/Unregister..
Command:
AT+BLEGATTSREGISTER=<enable>
Response:
OK
6.1.19.2. Parameter
- <enable>: 1 : Register 0: Unregister
6.1.19.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2 //create service first AT+BLEGATTSCHARCRE=0,0,"01020304010203040102030401020305",2,3,2 //write property(read) (read|write) AT+BLEGATTSREGISTER=1 //Register Service
6.1.20. AT+BLEGATTSCHAR
Function: GATTS Discovers Characteristics.
6.1.20.1. Query Command
Function:
GATTS discovers characteristics.
Command:
AT+BLEGATTSCHAR?
Response:
+BLEGATTSCHAR:<srv_index>,<char_index>,<char_uuid>,<char_prop>,<uuid_type> OK
6.1.20.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <char_index>: characteristic’s index starting from 0 to 4
- <char_uuid>: characteristic’s UUID
- <char_prop>: characteristic’s property
- 2: characteristic read property
- 4: characteristic write without response property
- 8: characteristic write with response property
- 16: characteristic notify property
- 32: characteristic indicate property
- <uuid_type>: uuid’s type
- 0: 16-bit UUID
- 2: 128-bit UUID
6.1.21. AT+BLEGATTSCHARCRE
Function: GATTS Creates Characteristics.
6.1.21.1. Set Command
Function:
The Generic Attributes Server (GATTS) creates BLE servic's characteristics.
Command:
AT+BLEGATTSCHARCRE=<srv_index>,<char_index>,<char_uuid>,<char_prop>,<char_perm>,<uuid_type>
Response:
OK
6.1.21.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <char_index>: characteristic’s index starting from 0 to 4
- <char_uuid>: characteristic’s UUID
- <char_prop>: characteristic’s property
- 2: characteristic read property
- 4: characteristic write without response property
- 8: characteristic write with response property
- 16: characteristic notify property
- 32: characteristic indicate property
- <char_perm>: characteristic’s permissions
- 1: read permissions
- 2: write permissions
- <uuid_type>: uuid’s type
- 0: 16-bit UUID
- 2: 128-bit UUID
6.1.21.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2 //create service first AT+BLEGATTSCHARCRE=0,0,"01020304010203040102030401020305",2,3,2 //write property(read) (read|write)
6.1.22. AT+BLEGATTSNTFY
Function: Notify the Characteristic Value from the Server to a Client.
6.1.22.1. Set Command
Function:
Notify the Characteristic Value from the Server to a Client.
Command:
AT+BLEGATTSNTFY=<srv_index>,<char_index>,<length>
Response:
>
The symbol > indicates that AT is ready for receiving serial data, and you can enter data now. When the requirement of data length determined by the parameter <length> is met, the notification starts.
If the data transmission is successful, AT returns:
OK
6.1.22.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <char_index>: characteristic’s index starting from 0 to 4
- <length>: maximum data length is 244.
6.1.22.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2//create service first AT+BLEGATTSCHARCRE=0,0,"01020304010203040102030401020305",8,2 //notify property AT+BLEGATTSNTFY=0,0,4 // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically.
6.1.23. AT+BLEGATTSIND
Function: Indicate the Characteristic Value from the Server to a Client.
6.1.23.1. Set Command
Function:
Indicate the Characteristic Value from the Server to a Client.
Command:
AT+BLEGATTSIND=<srv_index>,<char_index>,<length>
Response:
>
The symbol > indicates that AT is ready for receiving serial data, and you can enter data now. When the requirement of data length determined by the parameter <length> is met, the notification starts.
If the data transmission is successful, AT returns:
OK
6.1.23.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <char_index>: characteristic’s index starting from 0 to 4
- <length>: maximum data length is 244.
6.1.23.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2 //create service first AT+BLEGATTSCHARCRE=0,0,"01020304010203040102030401020305",16,2 //indicate property AT+BLEGATTSIND=0,0,4 // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically.
6.1.24. AT+BLEGATTSRD
Function: Set the data when Client read characteristic from the Server.
6.1.24.1. Set Command
Function:
Set the data when Client read characteristic from the Server.
Command:
AT+BLEGATTSRD=<srv_index>,<char_index>,<length>
Response:
>
The symbol > indicates that AT is ready for receiving serial data, and you can enter data now. When the requirement of data length determined by the parameter <length> is met, the notification starts.
If the data transmission is successful, AT returns:
OK
6.1.24.2. Parameters
- <srv_index>: service’s index starting from 0 to 2
- <char_index>: characteristic’s index starting from 0 to 4
- <length>: maximum data length is 244.
6.1.24.3. Example
AT+BLEINIT=2 // Role: server AT+BLEGATTSSRVCRE=0,"01020304010203040102030401020304",1,2 //create service first AT+BLEGATTSCHARCRE=0,0,"01020304010203040102030401020305",1,2 //read property AT+BLEGATTSRD=0,0,4 // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically when Client read characteristic from the Server.
6.1.25. AT+BLEGATTCSRVDIS
Function: GATTC discover services.
6.1.25.1. Set Command
Function:
GATTC discover services.
Command:
AT+BLEGATTCSRVDIS=<conn_index>
Response:
+BLESRV=<conn_index>,<srv_index>,<srv_uuid>,<srv_type>,<start_handle>,<end_handle> OK
6.1.25.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <srv_index>: service’s index starting from 1.
- <srv_uuid>: service’s UUID.
- <srv_type>: service’s type
- 0: not primary service
- 1: primary service
Note
The BLE connection has to be established first.
6.1.25.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCSRVDIS=0
6.1.26. AT+BLEGATTCCHARDIS
Function: GATTC discover characteristics.
6.1.26.1. Set Command
Function:
GATTC discover characteristics.
Command:
AT+BLEGATTCCHARDIS=<conn_index>,<srv_index>
Response:
+BLESRVCHAR=<conn_index>,<srv_index>,<char_index>,<char_uuid>,<char_prop>,<char_handle>,<char_value_handle> OK
6.1.26.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <srv_index>: service’s index starting from 1.
- <char_index>: characteristic's index starting from 1.
- <char_uuid>: characteristic's UUID.
- <char_prop>: characteristic’s property
- 1: characteristic read property
- 2: characteristic write without response property
- 4: characteristic write with response property
- 8: characteristic notify property
- 16: characteristic indicate property
Note
The BLE connection has to be established first and the service needs to be discovered first.
6.1.26.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCSRVDIS=0 AT+BLEGATTCCHARDIS=0,1
6.1.27. AT+BLEGATTCWR
Function: GATTC writes characteristics.
6.1.27.1. Set Command
Function:
GATTC writes characteristics.
Command:
AT+BLEGATTCWR=<conn_index>,<srv_index>,<char_index>,<length>
Response:
>
The symbol > indicates that AT is ready for receiving serial data, and you can enter data now. When the requirement of data length determined by the parameter <length> is met, the notification starts.
If the data transmission is successful, AT returns:
OK
6.1.27.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <srv_index>: service’s index starting from 1.
- <char_index>: characteristic’s index starting from 1.
- <length>: maximum data length is 244.
6.1.27.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCSRVDIS=0 AT+BLEGATTCCHARDIS=0,1 AT+BLEGATTCWR=0,1,2,4 // After the symbol ">" shows, enter the 4-byte data, such as "1234". Then the data will be transmitted automatically.
6.1.28. AT+BLEGATTCRD
Function: GATTC read characteristics.
6.1.28.1. Set Command
Function:
GATTC read characteristics.
Command:
AT+BLEGATTCRD=<conn_index>,<srv_index>,<char_index>
Response:
+BLEREAD=<conn_index>,<srv_index>,<char_index>,<length> OK
6.1.28.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <srv_index>: service’s index starting from 1.
- <char_index>: characteristic’s index starting from 1.
- <length>: data length
6.1.28.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCSRVDIS=0 AT+BLEGATTCCHARDIS=0,1 AT+BLEGATTCRD=0,1,1
6.1.29. AT+BLEGATTCSUBSCRIBE
Function: GATTC subscribe server.
6.1.29.1. Set Command
Function:
GATTC subscribe server.
Command:
AT+BLEGATTCSUBSCRIBE=<conn_index>,<ccc_handle>,<value_handle>,<value>
Response:
- ::
- OK
6.1.29.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <ccc_handle>: Client Characteristic Configuration Descriptor handle.
- <value_handle>: Characteristic value handle.
- <value>: 1: notification 2: indication
6.1.29.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCSUBSCRIBE=0,15,14,1
6.1.30. AT+BLEGATTCUNSUBSCRIBE
Function: GATTC unsubscribe server.
6.1.30.1. Set Command
Function:
GATTC unsubscribe server.
Command:
AT+BLEGATTCUNSUBSCRIBE=<conn_index>,<value_handle>
Response:
- ::
- OK
6.1.30.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <value_handle>: Characteristic value handle.
6.1.30.3. Example
AT+BLEINIT=1 // Role: client AT+BLECONN=0,"11:22:33:44:55:66",0,10 AT+BLEGATTCUNSUBSCRIBE=0,14
6.1.31. AT+BLETXPWR
Function: Query/Set BLE TX power.
6.1.31.1. Query Command
Function:
Query BLE TX power.
Command:
AT+BLETXPWR?
Response:
+BLETXPWR:<tx_power> Range: [0,20]. OK
6.1.31.2. Set Command
Function:
Set BLE TX power.
Command:
AT+BLETXPWR=<tx_power>
Response:
OK
6.1.31.3. Parameter
- <tx_power>: tx power
6.1.31.4. Example
AT+BLEINIT=1 // or AT+BLEINIT=2 AT+BLETXPWR=10
6.1.32. AT+BLESECPARAM
Function: Set/Query BLE security parameter
6.1.32.1. Query Command
Function:
Query BLE security parameter.
Command:
AT+BLESECPARAM?
Response:
+BLESECPARAM:<security parameter> OK
6.1.32.2. Set Command
Function:
Set BLE security parameter.
Command:
AT+BLESECPARAM=<security parameter>
Response:
OK
6.1.32.3. Parameter
- *; <security parameter>: <security parameter>
- *;* BT_SMP_IO_DISPLAY_ONLY 0
- BT_SMP_IO_DISPLAY_YESNO 1
- BT_SMP_IO_KEYBOARD_ONLY 2
- BT_SMP_IO_NO_INPUT_OUTPUT 3
- BT_SMP_IO_KEYBOARD_DISPLAY 4
6.1.32.4. Example
AT+BLEINIT=1 // or AT+BLEINIT=2 AT+BLESECPARAM=4 // BT_SMP_IO_KEYBOARD_DISPLAY
6.1.33. AT+BLESECCANNEL
Function: BLE Cannel Pairing.
6.1.33.1. Set Command
Function:
BLE Cannel Pairing.
Command:
AT+BLESECCANNEL=<conn_index>
Response:
- ::
- OK
6.1.33.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
6.1.33.3. Example
- ::
- AT+BLESECCANNEL=0
6.1.34. AT+BLESECPASSKEYCONFIRM
Function: BLE Pairing passkey confirm .
6.1.34.1. Set Command
Function:
BLE Pairing passkey confirm .
Command:
AT+BLESECPASSKEYCONFIRM=<conn_index>
Response:
- ::
- OK
6.1.34.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
6.1.34.3. Example
- ::
- AT+BLESECPASSKEYCONFIRM=0
6.1.35. AT+BLESECPAIRINGCONFIRM
Function: BLE Pairing passkey comfirm .
6.1.35.1. Set Command
Function:
BLE Pairing confirm .
Command:
AT+BLESECPAIRINGCONFIRM=<conn_index>
Response:
- ::
- OK
6.1.35.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
6.1.35.3. Example
- ::
- AT+BLESECPAIRINGCONFIRM=0
6.1.36. AT+BLESECPASSKEY
Function: BLE Pairing pass entry.
6.1.36.1. Set Command
Function:
BLE Pairing pass entry.
Command:
AT+BLESECPASSKEY=<conn_index>,<passkey>
Response:
- ::
- OK
6.1.36.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <passkey>: pairing passkey. Range: [0,999999].
6.1.36.3. Example
- ::
- AT+BLESECPASSKEY=0,123456
6.1.37. AT+BLESECGETLTKLIST
Function: Query BLE Paired deviceList.
6.1.37.1. Query Command
Function:
Query BLE Paired deviceList.
Command:
AT+BLESECGETLTKLIST?
Response:
+BTADDR 12:34:56:78:00:11 (public) LTK:01234567890123456789012345678900 OK
6.1.38. AT+BLESECUNPAIR
Function: BLE unpairing.
6.1.38.1. Set Command
Function:
BLE unpairing.
Command:
AT+BLESECUNPAIR=<address>,<addrtype>
Response:
- ::
- OK
6.1.38.2. Parameters
- <addr>: BLE address.
- <addr_type>: BLE address type.
6.1.38.3. Example
- ::
- AT+BLESECUNPAIR="12:34:56:78:00:12",0
6.1.39. AT+BLESECSTART
Function: BLE start pairing.
6.1.39.1. Set Command
Function:
BLE start pairing.
Command:
AT+BLESECSTART=<conn_index>,<sec_level>
Response:
- ::
- OK
6.1.39.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <sec_level>: Security level. Range: [0,4].
6.1.39.3. Example
- ::
- AT+BLESECSTART=0,4
6.1.40. AT+BLEBASINIT
Function:
Initialize the Bluetooth BAS profile.
6.1.40.1. Execute Command
Command:
AT+BLEBASINIT
Response:
OK
6.1.41. AT+BLEBASDEINIT
Function:
Deinitialize the Bluetooth BAS profile.
6.1.41.1. Execute Command
Command:
AT+BLEBASDEINIT
Response:
OK
6.1.42. AT+BLEBASLVLGET
Function: Query BLE BAS level.
6.1.42.1. Query Command
Function:
Query BLE BAS level.
Command:
AT+BLEBASLVLGET?
Response:
+BLE:BASLEVEL:100 (level) OK
6.1.43. AT+BLEBASLVLSET
Function:
Set BLE BAS level.
6.1.43.1. Setup Command
Command:
AT+BLEBASLVLSET=<conn idx>,<level>
Response:
OK
6.1.43.2. Parameters
- <conn_index>: index of BLE connection. Range: [0,1].
- <level>: battery level. Range: [0,100].
6.1.43.3. Example
AT+BLEBASLVLSET=0,100
6.1.44. AT+BLEIASINIT
Function:
Initialize the Bluetooth IAS profile.
6.1.44.1. Execute Command
Command:
AT+BLEIASINIT
Response:
OK
6.1.45. AT+BLEIASDEINIT
Function:
Deinitialize the Bluetooth IAS profile.
6.1.45.1. Execute Command
Command:
AT+BLEIASDEINIT
Response:
OK
6.1.46. AT+BLEDISINIT
Function:
Initialize the Bluetooth DIS profile.
6.1.46.1. Setup Command
Command:
AT+BLEDISINIT=<pnp_vid_src>,<pnp_vid>,<pnp_pid>,<pnp_ver>
Response:
OK
6.1.46.2. Parameters
- *; <pnp_vid_src>
- *;* range: <0,255>
- *; <pnp_vid>
- *;* range: <0,65535>
- *; <pnp_pid>
- *;* range: <0,65535>
- *; <pnp_ver>
- *;* range: <0,65535>
6.1.46.3. Example
AT+BLEDISINIT=100,101,102,103
6.1.47. AT+BLEDISDEINIT
Function:
Deinitialize the Bluetooth DIS profile.
6.1.47.1. Execute Command
Command:
AT+BLEDISDEINIT
Response:
OK
6.1.48. AT+BLEDISSET
Function:
SET the Bluetooth DIS profile.
6.1.48.1. Setup Command
Command:
AT+BLEDISSET=<parameter_name>,<parameter_value>,<parameter_len>
Response:
OK
6.1.48.2. Parameters
- <parameter_name>:
- "manuf" : Manufacturer Name String
- "model" : Model Number String
- "serial" : Serial Number String
- "fw" : Firmware Revision String
- "hw" : Hardware Revision String
- "sw" : Software Revision String
- <parameter_value>
- <parameter_len> Range: [0,21].
6.1.48.3. Example
AT+BLEDISSET="manuf","ST67W611M",6
7. Low power function AT command
Instruction | Description |
---|---|
AT+PWR | Configure Power mode |
AT+SLWKIO | Configure GPIO as Wakeup Source |
AT+DEWKIO | Delete GPIO as Wakeup Source |
AT+SLWKTIMER | Configure timer as Wakeup Source |
AT+SLWKDTIM | Configure DTIM |
AT+SLCLDTIM | Delete DTIM config |
AT+TWT_PARAM | Setup TWT paramments |
AT+TWT_SLEEP | Enter TWT low power |
AT+TWT_TEARDOWN | Tear down twt |
AT+SET_CLOCK | Set 32Khz clock source |
AT+GET_CLOCK | Query 32Khz clock source |
7.1. Low power AT command description
7.1.1. AT+PWR
Function: Configure Power mode
7.1.1.1. Execute Command
Command:
AT+PWR=<power mode>[,<level>]
Response:
OK
7.1.1.2. Parameters
- <power mode>:
- 0: normal mode.
- 2: standby mode.
- <[level]>: 1 - enable receive broadcast package.:
7.1.1.3. Example
AT+PWR=0 // Normal mode AT+PWR=2 // Standby mode AT+PWR=2,1 // Standby mode, enable receive broadcast package
7.1.2. AT+SLWKIO
Function: Configure GPIO as Wakeup Source.
7.1.2.1. Execute Command
Command:
AT+SLWKIO=<wakeup io>,<trigger mode>
Response:
OK
7.1.2.2. Parameters
- <wakeup io>: GPIO wake-up IO number. supports only gpio 16 or gpio 28
- *; <trigger mode>: wakeup trigger Mode
- *;* 0: Wake-up by high level
NOTE:The current implementation uses a five-wire SPI low-power solution, so the wake-up method is not configurable and only supports high-level wake-up.
7.1.3. AT+DEWKIO
Function: Delete GPIO as Wakeup Source.
7.1.3.1. Execute Command
Command:
AT+DEWKIO=<io>
Response:
OK
7.1.3.2. Parameters
- <io>: GPIO wake-up IO number.
7.1.4. AT+SLWKTIMER
Function: Configure timer as Wakeup Source.
7.1.4.1. Set Command
Command:
AT+SLWKTIMER=<mode>,<timeouts>
Response:
OK
7.1.4.2. Parameter
- <mode>: 0, standby mode
- <timeouts>: Set the wake-up duration in milliseconds. One-time wake-up timer, does not enter sleep again after waking up (unless a new wake-up timer is configured again)
7.1.4.3. Example
AT+SLWKTIMER=0,5000 //Standby mode, Wake up once next 5000ms
7.1.5. AT+SLWKDTIM
Function: Configure DTIM as Wakeup Source
7.1.5.1. Set Command
Command:
AT+SLWKDTIM=<dtim>
Response:
OK
7.1.5.2. Parameter
- <dtim>: Set the wakeup ditm.
7.1.5.3. Example
AT+SLWKDTIM=10 // Set ditm10 for wakeup.
7.1.6. AT+SLCLDTIM
Function: Delete DTIM config
7.1.6.1. Set Command
Command:
AT+SLCLDTIM
Response:
OK
7.1.6.2. Example
AT+SLCLDTIM
7.1.7. AT+TWT_PARAM
Function: Setup TWT paraments.
7.1.7.1. Set Command
Command:
AT+TWT_PARAM=<setup type>,<flow type>,<exponent>,<wakeup duration>,<wake interval mantissa>
Response:
OK
7.1.7.2. Parameter
- Setup type (s): 0:REQUEST, 1:SUGGEST, 2:DEMAND.
- Flow type (t): 0:ANNOUNCED TWT, 1:UNANNOUNCED TWT. Only support unannounced twt.
- Wake Interval Exponent: Specifies the wake interval
- Wake Duration (n): Minimum wake duration in microseconds.
- Wake Interval Mantissa (m): Mantissa value for precise interval adjustments.
- Service Period (SP): SP = WakeDuration * 256us.
- Wakeup Interval: Wakeup Interval = wake_int_mantissa << WakeIntervalExponent us.
7.1.7.3. Example
AT+TWT_PARAM=1,1,13,128,1000 //SP = 32.768 ms, Wake Interval = 8.192 seconds:
7.1.7.4. Note
- REQUEST Setup type: The target wake time filed of the TWT element is set to 0 as the responding STA/AP specifies the target wake time value in this case. Other fields are suggested by requesting STA.
- SUGGEST Setup type: TWT requesting STA will suggest the target wake time and other parameters during setup. Responding STA may / may not acommodate the suggested value. TWT Connection will still be accepted with values suggested by requesting STA or the values provided by responding STA.
- DEMAND Setup type: TWT requesting STA will demand the target wake time and other parameters during setup. If responding STA cannot acommodate the suggested value, TWT setup will fail.
- Equation to calculate Service Period: Service Period (SP) =( <wakeup duration>/10 ) msec
- Example: AT+TWT_PARAM=1,1,13,128,1000 : SP = (128/10) = 12.8 msec
- Equation to calculate TWT Wake Interval: TWT Wake Interval = ((2^<exponent>)/<wake interval mantissa>)sec
- Example: AT+TWT_PARAM=1,1,13,128,1000 : TWT Wake Interval = ((2^12)/1000) = 8.192s
7.1.8. AT+TWT_SLEEP
Function: Enter TWT low power
7.1.8.1. Set Command
Command:
AT+TWT_SLEEP
Response:
OK
7.1.8.2. Example
AT+TWT_SLEEP
7.1.9. AT+TWT_TEARDOWN
Function: Teardown the Target Wake Time (TWT) session.
7.1.9.1. Set Command
Command:
AT+TWT_TEARDOWN=<neg_type>,<all_twt>[,<flow_id>]
Response:
OK
or
ERROR
7.1.9.2. Parameters
<neg_type>: TWT negotiation type.
- 0: Individual negotiation (TWT teardown will be performed for the specified TWT flow).
- 1: Negotiate TWT teardown on the next wake TBTT (Target Beacon Transmission Time). Currently not supported.
<all_twt>: Specifies whether to teardown all TWT flows.
- 0: Teardown only the specified TWT flow (specified by <flow_id> parameter).
- 1: Teardown all existing TWT flows.
<flow_id>: The TWT flow ID to be torn down. This parameter is required when <all_twt> is set to 0.
7.1.9.3. Notes
- Internal RC errors can result in wake interval inaccuracies (e.g., 60 ms deviation over 30 seconds).
- External Oscillator Requirement: Testing must be conducted on boards with external crystal oscillators to minimize RTC clock deviation.
- *Router Compatibility: Use a TWT-compatible router for testing (e.g., TP-Link AX5400).
- Currently, only Individual negotiation type (0) is supported.
- When <all_twt>=1, the <flow_id> parameter is not needed.
- The device must be in TWT mode before using this command.
7.1.9.4. Example
// Teardown a specific TWT flow with ID 1 AT+TWT_TEARDOWN=0,0,1 // Teardown all TWT flows AT+TWT_TEARDOWN=0,1
7.1.10. AT+SET_CLOCK
Function: Set 32 KHz clock source.
7.1.10.1. Set Command
Function:
Set 32 KHz clock source.
Command:
AT+SET_CLOCK=<clock_source>
Response:
OK
7.1.10.2. Parameters
- <clock_source>:
- 1: Internal RC oscillator
- 2: External passive crystal
- 3: External active crysta
7.1.10.3. Example
AT+SET_CLOCK=1
7.1.11. AT+GET_CLOCK
Function: Query 32Khz clock source.
7.1.11.1. Query Command
Command:
AT+GET_CLOCK
Response:
+GET_CLOCK:<clock_source> OK
7.1.11.2. Parameters
- <clock_source>: The clock source used by ST67W611M1.
7.1.11.3. Example
AT+GET_CLOCK // Response +GET_CLOCK:1 OK
7.2. Generate romfs.bin
Firstly, you need to create a new romfs folder and place the certificate files that need to be burned in the romfs directory:
romfs$ ca_01.crt cert_01.crt private_01.key
Then, use the genromfs tool in the SDK directory to generate romfs.bin. You can add commands in Makefile:
$(shell ./tools/genromfs -d romfs/ -f ./build/build_out/romfs.bin)
Add the option to download romfs partition in the flash configuration file "flash_prog_cfg.ini":
#media factory [romfs] filedir = ./build/build_out/romfs.bin address = 0x378000
The address filed is the address of the media partition in the partition table. The path to the partition table is:
bsp/board/<chip_name>/config/partition_cfg_4M.toml or bsp/board/<chip_name>/config_8M/partition_cfg_8M.toml
Last, after executing the command line firmware download command, the romfs.bin file will also be download into the chip.
make flash CHIP=ST67W611M COMX=<com_port>
8. MQTT local service setup
- Install mosquitto
sudo apt install mosquitto
- Passwd set
mosquitto_passwd -c /etc/mosquitto/passwd ST67W611M
Enter the password twice, for example:
12345678
- Configure certificate
cp {case_path}/lfs/lfs/server_1.crt /etc/mosquitto/server_1.crt cp {case_path}/lfs/lfs/server_1.key /etc/mosquitto/server_1.key cp {case_path}/lfs/lfs/ca_1.crt /etc/mosquitto/ca_1.crt
- Start MQTT service
mosquitto -c /etc/mosquitto/mosquitto.conf
- PC subscription to a topic
mosquitto_sub -h 192.168.31.156 -u ST67W611M -P 12345678 --cafile lfs/lfs/ca_1.crt --cert lfs/lfs/client_1.crt --key lfs/lfs/client_1.key -t "test/topic1" --tls-version tlsv1.2 --insecure
- ST67W611M1 MQTT User Configuration
AT+MQTTUSERCFG=0,4,"QC001","ST67W611M","12345678","client_1.crt","client_1.key","ca_1.crt"
- ST67W611M1 connect to MQTT Brokers.
AT+MQTTCONN=0,"192.168.31.156",8883,0
- ST67W611M1 publish a message
AT+MQTTPUB=0,"test/topic1","This is a MQTT test",2,0
- ST67W611M1 subscription to a topic
AT+MQTTSUB=0,"test/topic2",0
- PC publish a message
mosquitto_pub -h 192.168.31.156 -p 8883 -u ST67W611M -P 12345678 --cafile lfs/lfs/ca_1.crt --cert lfs/lfs/client_1.crt --key lfs/lfs/client_1.key -t "test/topic2" -m "Hello MQTT" --tls-version tlsv1.2 --insecure
9. MQTT TLS schemes with HiveMQ
9.1. Verification Steps for the Serverless Version
- Download the broker Root CA certificate from HiveMQ (isrgrootx1.pem) and place it in the folder:
examples/wifi/spi_wifi/lfs/lfs/isrgrootx1.pem
- In the folder examples/wifi/spi_wifi/, run "make" to rebuild the project and use the QConn_Flash tool to flash the image.
- In the HiveMQ web console, create a broker under a serverless plan and set up the corresponding credentials (for example, username = QC_test_0, password = QC123456, with permission set to publish & subscribe). Please refer to the official HiveMQ documentation for this step.
- Connect the ST67W611M1 to the WiFi AP (adjust the SSID and password as needed):
AT+CWMODE=1 AT+CWJAP="8E88",""
- Configure MQTT user settings:
AT+MQTTUSERCFG=0,2,"ST67W611M","QC_test_0","QC123456","","","isrgrootx1.pem"
(0 indicates the local client index; 2 specifies the use of one-way TLS where the client verifies the server’s certificate; "ST67W611M1" is the MQTT client ID; "QC_test_0"/"QC123456" are the username and password set up on the console; isrgrootx1.pem is the broker Root CA.)
- Configure MQTT SSL/TLS SNI. It has been proven in practice that SNI must be set, otherwise the connection will fail (possibly because the HiveMQ broker uses SNI to identify the correct broker instance):
AT+MQTTSNI=0,"8f3ef71da5bf445eb0669e56eecef396.s1.eu.hivemq.cloud"
- Configure MQTT connection properties:
AT+MQTTCONNCFG=0,120,0,"","",0,0
(0 indicates the local client index; 120 is the MQTT client keepalive time in seconds; the 0 means clean session is disabled.)
- Initiate the MQTT connection:
AT+MQTTCONN=0,"8f3ef71da5bf445eb0669e56eecef396.s1.eu.hivemq.cloud",8883,0
(Note: The host and port information provided must match with the HiveMQ broker console.)
- Subscribe to all topics:
AT+MQTTSUB=0,"#",0
- Publish a topic message:
AT+MQTTPUB=0,"/test/ST67W611M","What's up guys",0,0
9.2. Verification Steps for the Starter Version
- Download the broker Root CA certificate (isrgrootx1.pem) from HiveMQ and place it in the folder:
examples/wifi/spi_wifi/lfs/lfs/isrgrootx1.pem
- In the folder examples/wifi/spi_wifi/, run "make" to rebuild the project and use the Qconn_Flash tool to flash the image.
- In the HiveMQ web console, create a broker under a starter plan and set up the corresponding credentials (for example, username = QC_test_0, password = QC123456, with permission set to publish & subscribe). Also, add ca_1.crt as the Root CA for verifying device certificates to the broker. Please refer to the official HiveMQ documentation for this step.
- Connect the ST67W611M1 to the WiFi AP (adjust the SSID and password as needed):
AT+CWMODE=1 AT+CWJAP="8E88",""
- Configure MQTT user settings:
AT+MQTTUSERCFG=0,4,"changeme","QC_test_0","QC123456","client_1.crt","client_1.key","isrgrootx1.pem"
(0 indicates the local client index; 4 specifies the use of two-way TLS; "changeme" is the MQTT client_id; "QC_test_0"/"QC123456" are the username and password set up on the console; client_1.crt is the device’s x509 certificate issued by ca_1; client_1.key is the key matching the device certificate; isrgrootx1.pem is the broker Root CA.)
- Configure MQTT SSL/TLS SNI. It has been proven in practice that SNI must be set, otherwise the connection will fail (possibly because the HiveMQ broker uses SNI to identify which broker instance to use):
AT+MQTTSNI=0,"indigosquash-2lk628.a02.usw2.aws.hivemq.cloud"
- Configure MQTT connection properties:
AT+MQTTCONNCFG=0,120,0,"","",0,0
(0 indicates the local client index; 120 is the MQTT client keepalive time; 0 disables clean session.)
- Initiate the MQTT connection:
AT+MQTTCONN=0,"indigosquash-2lk628.a02.usw2.aws.hivemq.cloud",8883,0
(Note: The host and port here must match the information provided in the HiveMQ broker console.)
- Subscribe to all topics:
AT+MQTTSUB=0,"#",0
- Publish a topic message:
AT+MQTTPUB=0,"/test/ST67W611M","What's up guys",0,0
<noinclude
</noinclude