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 BLE related AT commands.

Instruction type

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'.

Note

The parameter storage in AT commands is implemented through the EasyFlash library.

AT Messages

There are two types of AT messages returned from the AT command port: AT responses messages and AT message reports.

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

Message

Description

OK

AT command processed successfully and returned OK

ERROR

AT command error or an error occurred during execution

SEND OK

Data has been sent to the protocol stack

SEND FAIL

An error occurred while sending the data to the protocol stack

SEND CANCELLED

Cancel sending data in Wi-Fi normal transmission mode

+<Command Name>:``…``

Provides detailed results of the AT command processing to the sender

Message Reports

AT will report important state changes or messages in the system.

AT Message Reports

Message

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

Note

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.

Basic AT commands

Overview of basic AT commands

Instruction list

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)

Basic AT command description

AT

Function: Test AT startup.

Execute Command

Command:

AT

Response:

OK

AT+GMR

Function: View version information.

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

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

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

AT+RST

Function: Restart the module.

Execute Command

Command:

AT+RST

Response:

OK

AT+RESTORE

Function: Restore factory settings.

Execute Command

Command:

AT+RESTORE

Response:

OK

AT+CMD?

Function: List all AT commands and types supported in current firmware.

Query Command

Command:

AT+CMD?

Response:

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

OK

Parameters

  • <index>: AT command sequence number.

  • <AT command name>: AT command name.

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

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

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

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

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

ATE

Function: Configure AT Commands Echoing.

Execute Command

Command:

ATE0

or

ATE1

Response:

OK

Parameters

  • ATE0: Switch echo off.

  • ATE1: Switch echo on.

AT+SYSRAM?

Function: Query current remaining Heap Size and lwip remaining Heap Size.

Query Command

Command:

AT+SYSRAM?

Response:

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

Parameters

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

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

Example

AT+SYSRAM?
+SYSRAM:148408,84044
OK

AT+SYSMSG?

Function: Query/Set system prompt information.

Query Command

Function:

Query the current system prompt information state.

Command:

AT+SYSMSG?

Response:

+SYSMSG:<state>
OK

Set Command

Function:

Configure system prompt information.

Command:

AT+SYSMSG=<state>

Response:

OK

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.

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

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”.

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

AT+SYSLOG?

Function: Enable or Disable the AT Error Code Prompt.

Query Command

Function:

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

Command:

AT+SYSLOG?

Response:

+SYSLOG:<status>

OK

Set Command

Function:

Enable or disable the AT error code prompt.

Command:

AT+SYSLOG=<status>

Response:

OK

Parameter

  • <status>: enable or disable

    • 0: disable

    • 1: enable

Example

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

OK
AT+FAKE
ERR CODE:0x01090000

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

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

ERROR

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

category

subcategory

extension

bit32 ~ bit24

bit23 ~ bit16

bit15 ~ bit0

  • category: stationary value 0x01.

  • subcategory: error type.

    Subcategory of Error Code

    Error Type

    Error Code

    Description

    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

AT+SYSSTORE?

Function: Query/Set parameter store mode.

Query Command

Function:

Query the AT parameter store mode.

Command:

AT+SYSSTORE?

Response:

+SYSSTORE:<store_mode>

OK

Set Command

Command:

AT+SYSSTORE=<store_mode>

Response:

OK

Parameter

  • <store_mode>:

    • 0: command configuration is not stored into flash.

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

Note

  • This command affects set commands only. Query commands are always fetched from RAM.

Examples

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

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

AT+TEMP?

Function: Query the temperature of the chip.

Query Command

Function:

Query the AT parameter store mode.

Command:

AT+TEMP?

Response:

+TEMP:<temperature>

OK

Parameter

  • <temperature>: The temperature of the chip (Unit:°C).

AT+EFUSE-W

Function: Efuse write operation. The data will be written into the Efuse after the write confirmation operation is performed.

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

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.

AT+EFUSE-R

Function: Efuse read operation.

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

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.

Example

AT+EFUSE-R=4,"0x1c"

Response:

+EFUSE-R:<nbytes>,[data]

OK

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.

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

AT+EFUSE-CFM

Function: Efuse write confirmation operation.

Set Command

Function:

Efuse write confirmation will directly write into Efuse.

Command:

AT+EFUSE-CFM

Response:

OK

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

AT+FLASH-W

Function: Flash write operation.

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

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.

AT+FLASH-R

Function: Flash read operation.

Set Command

Function:

Read the content of the Flash at the specified address.

Command:

AT+FLASH-R=<nbytes>,<addr>

Response:

+FLASH-R:[data]
OK

Example

// flash read cmd
AT+FLASH-R=4,"0x210000"

// Response
+FLASH-R:ffff
OK

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.

AT+FLASH-E

Function: Flash erase operation.

Set Command

Function:

Erase the content of the Flash at the specified address.

Command:

AT+FLASH-E=<nbytes>,<addr>

Response:

OK

Example

// flash erase cmd
AT+FLASH-E=4096,"0x210000"

// Response
OK

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.

AT+IOPUPD

Function: Initialize GPIO pins as pull-up/pull-down mode.

Set Command

Command:

AT+IOPUPD=<pin>,<state>

Response:

OK

Example

// Initialize GPIO cmd
AT+IOPUPD=15,1

//Response
OK

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.

AT+IOOUT

Function: Set the GPIO output to high/low level.

Set Command

Command:

AT+IOOUT=<pin>,<state>

Response:

OK

Example

// Set GPIO cmd
AT+IOOUT=15,1

//Response
OK

Parameter

  • <pin>: The pin numbers for ST67W611M1.

  • <state>: The GPIO output to high/low level.

    • 0: low level.

    • 1: high level.

AT+IOIN

Function: Query/Set the GPIO input mode.

Set Command

Command:

AT+IOIN=<pin>,<pull_state>

Response:

OK

Query Command

Command:

AT+IOIN=<pin>?

Response:

+IOIN=<pin>:<state>
OK

Example

// Set GPIO input cmd
AT+IOIN=15

//Response
OK

// Query GPIO input state
AT+IOIN=15?

//Response
+IOIN=15:1
OK

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.

AT+IORST

Function: Restore GPIO to floating input state.

Set Command

Command:

AT+IORST=<pin>

Response:

OK

Example

// Reset GPIO cmd
AT+IORST=15

//Response
OK

Parameter

  • <pin>: The pin numbers for ST67W611M1.

AT+PART

Function: Get information about the partitions.

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

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

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.

AT+OTASTART

Function: Start OTA transmission.

Set Command

Command:

AT+OTASTART=<enable>

Parameter

  • <enable>:

    • 0: Terminate OTA transmission.

    • 1: Start OTA transmission.

Response:

ERROR

or

OK

AT+OTASEND

Send OTA data. This command will write the data to the OTA partition in real time and perform validation.

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

Parameters

  • <length>: OTA data length. The maximum length is equal to the system allocable heap size.

AT+OTAFIN

Function: Verify and reboot from another partition.

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

AT+FS

Function: Filesystem Operations.

Set Command

Command:

AT+FS=<type>,<operation>,<filename>[,<offset>][,<length>]

Response:

OK

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.

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

AT+GMAC

Function: Query the MAC addresses of 3 slots in efuse.

Query Command

Command:

AT+GMAC?

Response:

+GMACSLOT0:<mac_addr>

+GMACSLOT1:<mac_addr>

+GMACSLOT2:<mac_addr>

OK

Parameters

  • <mac_addr>: MAC address in efuse.

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

AT+PN

Function: Query the part number.

Query Command

Command:

AT+PN?

Response:

+PN:<pn_num>

OK

Parameters

  • <pn_num>: The part number in efuse.

Example

AT+PN?

// Response
+PN:CP90-79196-2

OK

AT+VBAT

Function: Query the voltage value at the supply pin.

Query Command

Command:

AT+VBAT?

Response:

+VBAT:<vbat_val>

OK

Parameters

  • <vbat_val>: The voltage value at the supply pin (unit: mV).

Example

AT+VBAT?

// Response
+VBAT:3326

OK

Wi-Fi function AT command

Instruction list

Instruction

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.

Basic AT command description

AT+WIFISP

Function: Query/Set enable/disable wlan radio.

Query Command

Function:

Query the wlan radio enablement status.

Command:

AT+WIFISP?

Response:

+WIFISP:<enable>

OK

Set Command

Function:

Enable/disable wlan radio.

Command:

AT+WIFISP=<enable>

Response:

OK

Parameters

  • <enable>:

    • 0: Disable wlan radio.

    • 1: Enable wlan radio.

AT+CWMODE

Function: Query/set Wi-Fi mode.

Query Command

Function:

Query the Wi-Fi mode of devices.

Command:

AT+CWMODE?

Response:

+CWMODE:<mode>

OK

Set Command

Function:

Set the Wi-Fi mode of devices.

Command:

AT+CWMODE=<mode>[,<auto_connect>]

Response:

OK

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.

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

Example

AT+CWMODE=1

AT+CWNETMODE

Function: Query device working in NCP/RCP mode.

Query Command

Function:

Query whether the device is operating in NCP/RCP mode.

Command:

AT+CWNETMODE?

Response:

+CWNETMODE:<netmode>

OK

Parameters

  • <netmode>:

    • 0: RCP mode.

    • 1: NCP mode.

Note

  • When the device is in RCP mode, all network and MQTT-related AT commands become invalid.

AT+CWSTATE

Function: Query the Wi-Fi state and Wi-Fi information.

Query Command

Function:

Query the Wi-Fi state and Wi-Fi information of devices.

Command:

AT+CWSTATE?

Response:

+CWSTATE:<state>,<"ssid">

OK

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.

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.

AT+CWJAP

Function: Connect to an AP.

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

Set Command

Function:

Connect an station to a targeted AP.

Command:

AT+CWJAP=[<ssid>],[<pwd>][,<bssid>][,<wep_en>]

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

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

Parameters

  • <ssid>: the SSID of the target AP.

    • Escape character syntax is needed if SSID or password contains special characters, such ,, ", or \\.

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

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

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

AT+CWRECONNCFG

Function: Query/Set the Wi-Fi Reconnecting Configuration.

Query Command

Function:

Query the configuration of Wi-Fi reconnect.

Command:

AT+CWRECONNCFG?

Response:

+CWRECONNCFG:<interval_second>,<repeat_count>

OK

Set Command

Function:

Set the configuration of Wi-Fi reconnect.

Command:

AT+CWRECONNCFG=<interval_second>,<repeat_count>

Response:

OK

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.

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

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.

AT+CWLAPOPT

Function: Set the Configuration for the Command AT+CWLAP.

Set Command

Command:

AT+CWLAPOPT=<sort_enable>,<print mask>[,<rssi filter>][,<authmode mask>][,<max_count>]

Response:

OK

or

ERROR

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 below rssi 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 set bit 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.

  • [<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].

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

AT+CWLAP

Function: List Available APs.

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

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

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

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"

AT+CWQAP

Function: Disconnect from an AP.

Execute Command

Command:

AT+CWQAP=[<restore>]

Response:

OK

Command:

AT+CWQAP

Response:

OK

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.

AT+CWSAP

Function: Query/Set the configuration of an SoftAP.

Query Command

Function:

Query the configuration parameters of an SoftAP.

Command:

AT+CWSAP?

Response:

+CWSAP:<ssid>,<pwd>,<channel>,<ecn>,<max conn>,<ssid hidden>

OK

Set Command

Function:

Set the configuration of an SoftAP.

Command:

AT+CWSAP=<ssid>,<pwd>,<chl>,<ecn>[,<max conn>][,<ssid hidden>]

Response:

OK

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.

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.

AT+CWLIF

Function: Obtain IP Address of the Station That Connects to an SoftAP.

Execute Command

Command:

AT+CWLIF

Response:

+CWLIF:<ip addr>,<mac>

OK

Parameters

  • <ip addr>: IP address of the station that connects to the SoftAP.

  • <mac>: MAC address of the station that connects to the SoftAP.

Note

  • This command cannot get a static IP. It works only when DHCP of both the SoftAP and the connected station are enabled.

AT+CWQIF

Function: Disconnect Stations from an SoftAP.

Execute Command

Function:

Disconnect all stations that are connected to the SoftAP.

Command:

AT+CWQIF

Response:

OK

Set Command

Function:

Disconnect a specific station from the SoftAP.

Command:

AT+CWQIF=<mac>

Example

AT+CWQIF="18:b9:05:ed:59:cc"

Response:

OK

Parameter

  • <mac>: MAC address of the station to disconnect.

AT+CWDHCP

Function: Enable/Disable DHCP.

Query Command

Command:

AT+CWDHCP?

Response:

<state>

Set Command

Function:

Enable/disable DHCP.

Command:

AT+CWDHCP=<operate>,<mode>

Response:

OK

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.

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.

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

AT+CWDHCPS

Function:Query/Set the IP Addresses Allocated by an SoftAP DHCP Server.

Query Command

Command:

AT+CWDHCPS?

Response:

+CWDHCPS=<lease time>,<start IP>,<end IP>

OK

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

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.

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.

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.

AT+CWAUTOCONN

Function:Automatically Connect to an AP When Powered on

Set Command

Command:

AT+CWAUTOCONN=<enable>

Response:

OK

Parameters

  • <enable>:

    • 1: Enable automatic connection to an AP when powered on. (Default)

    • 0: Disable automatic connection to an AP when powered on.

Note

  • The configuration changes will be saved in the easyflash area.

Example

AT+CWAUTOCONN=1

AT+CIPSTAMAC

Function: Query/Set the MAC Address of an ST67W611M1 Station

Query Command

Function:

Query the MAC address of the Station.

Command:

AT+CIPSTAMAC?

Response:

+CIPSTAMAC:<mac>

OK

Set Command

Function:

Set the MAC address of an station.

Command:

AT+CIPSTAMAC=<mac>

Response:

OK

Parameters

  • <mac>: string parameter showing MAC address of an station.

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.

Example

AT+CIPSTAMAC="1a:fe:35:98:d3:7b"

AT+CIPAPMAC

Function: Query/Set the MAC Address of an SoftAP

Query Command

Function:

Query the MAC address of the SoftAP.

Command:

AT+CIPAPMAC?

Response:

+CIPAPMAC:<mac>

OK

Set Command

Function:

Set the MAC address of the SoftAP.

Command:

AT+CIPAPMAC=<mac>

Response:

OK

Parameters

  • <mac>: string parameter showing MAC address of the SoftAP.

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.

Example

AT+CIPAPMAC="18:fe:35:98:d3:7b"

AT+CIPSTA

Function: Query/Set the IP Address of an Station

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

Set Command

Function:

Set the IPv4 address of the station.

Command:

AT+CIPSTA=<"ip">[,<"gateway">,<"netmask">,<"dns">]

Response:

OK

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.

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.

Example

AT+CIPSTA="192.168.6.100","192.168.6.1","255.255.255.0"

AT+CIPAP

Function: Query/Set the IP Address of an SoftAP

Query Command

Function:

Query the IP address of the SoftAP.

Command:

AT+CIPAP?

Response:

+CIPAP:ip:<"ip">
+CIPAP:gateway:<"gateway">
+CIPAP:netmask:<"netmask">

OK

Set Command

Function:

Set the IPv4 address of the SoftAP.

Command:

AT+CIPAP=<"ip">[,<"gateway">,<"netmask">]

Response:

OK

Parameters

  • <”ip">: string parameter showing the IPv4 address of the SoftAP.

  • <"gateway">: gateway.

  • <"netmask">: netmask.

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.

Example

AT+CIPAP="192.168.5.1","192.168.5.1","255.255.255.0"

AT+CWHOSTNAME

Function: Query/Set the Host Name of an Station

Query Command

Function:

Query the host name of Station.

Command:

AT+CWHOSTNAME?

Response:

+CWHOSTNAME:<hostname>

OK

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

Parameters

  • <hostname>: the host name of the Station. Maximum length: 32 bytes.

Note

  • The configuration changes are not saved in the flash.

Example

AT+CWMODE=3
AT+CWHOSTNAME="my_test"

AT+CWCOUNTRY

Function: Query/Set the Wi-Fi Country Code

Query Command

Function:

Query Wi-Fi country code information.

Command:

AT+CWCOUNTRY?

Response:

+CWCOUNTRY:<country_policy>,<country_code>

OK

Set Command

Function:

Set the Wi-Fi country code information.

Command:

AT+ CWCOUNTRY=<country_policy>,<country_code>

Response:

OK

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.

Note

  • The configuration changes are not saved in the flash.

Example

AT+CWMODE=3
AT+CWCOUNTRY=1,"CN"

AT+CWMONITOR

Function: Set WiFi to enter monitor mode

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

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.

Note

  • The monitored channel needs to be within the channel range set by the AT+CWCOUNTRY.

Example

AT+CWMONITOR=1,6

OK

+CWMONITOR,6,177:xxxxxxxxxxxxxx
...

AT+CWSTAPROTO

Function: Query/Set the 802.11 b/g/n/ax Protocol Standard of Station Mode

Query Command

Function:

Query the 802.11 b/g/n/ax Protocol Standard of Station Mode.

Command:

AT+CWSTAPROTO?

Response:

+CWSTAPROTO:<protocol>

OK

Set Command

Function:

Set the 802.11 b/g/n/ax Protocol Standard of Station Mode.

Command:

AT+CWSTAPROTO=<protocol>

Response:

OK

Parameters

  • <enable>:

    • bit0: 802.11b protocol standard.

    • bit1: 802.11g protocol standard.

    • bit2: 802.11n protocol standard.

    • bit3: 802.11ax protocol standard.

Note

  • It will only take effect on the next connection.

  • By default, PHY mode of ST67W611M1 is 802.11bgn/ax mode.

Example

AT+CWSTAPROTO=1

OK

AT+CWMODE=1

OK

AT+CWJAP="SSID","12345678"

...

AT+CWAPPROTO

Query/Set the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode

Query Command

Function:

Query the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode.

Command:

AT+CWAPPROTO?

Response:

+CWAPPROTO:<protocol>

OK

Set Command

Function:

Set the 802.11 b/g/n/ax Protocol Standard of SoftAP Mode.

Command:

AT+CWAPPROTO=<protocol>

Response:

OK

Parameters

  • <enable>:

    • bit0: 802.11b protocol standard.

    • bit1: 802.11g protocol standard.

    • bit2: 802.11n protocol standard.

    • bit3: 802.11ax protocol standard.

Note

  • It will only take effect on the next connection.

  • By default, PHY mode of ST67W611M1 is 802.11bgn/ax mode.

Example

AT+CWAPPROTO=1

OK

AT+CWMODE=2

OK

AT+CWSAP="AP_SSID","12345678",1,3,10,0

...

AT+WPS

Enable the WPS function

Set Command

Function:

Enable the WPS function.

Command:

AT+WPS=<enable>[,<auth floor>]

Response:

OK

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.

Notes
  • WPS can only be used when the ST67W611M1 station is enabled.

  • WPS does not support WEP (Wired-Equivalent Privacy) encryption.

Example

AT+CWMODE=1

OK

AT+WPS=1

OK

...

AT+CWANTENABLE

Enable/Disable Antenna Diversity Function.

Query Command

Function:

Query whether the antenna diversity function is enabled. Command:

AT+CWANTENABLE?

Response:

+CWANTENABLE:<dynamic_enable>,<static_enable>,<pin>

OK

Set Command

Function:

Enable Antenna Diversity Function.

Command:

AT+CWANTENABLE=<dynamic_enable>,<static_enable>[,<pin>]

Response:

OK

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.

Example

AT+CWANTENABLE=1,1,0

OK

AT+RST

OK

AT+CWMODE=1

OK

AT+CWJAP="SSID","password"

OK

...

Note

  • This parameter takes effect after a restart.

AT+CWANTNUM

Get the maximum number of antennas for the current device.

Query Command

Function:

Get the maximum number of antennas for the current device.

Command:

AT+CWANTNUM?

Response:

+CWANTNUM:<numbers>

OK

AT+CWANT

Set/Query the currently used antenna.

Query Command

Function:

Query the currently used antenna.

Command:

AT+CWANT?

Response:

+CWANT:<ant_id>

OK

Set Command

Function:

Enable Automatic Antenna Diversity Function.

Command:

AT+CWANT=<ant_id>

Response:

OK

Parameters

  • <ant_id>:

    • Antenna Number ID.

Example

AT+CWANT=1

OK

AT+CWANT=0

OK

MQTT AT commands

Instruction list

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

MQTT AT command description

AT+MQTTUSERCFG

Get/Set MQTT user configuration.

Query Command

Query MQTT User Configuration.

Command:

AT+MQTTUSERCFG?

Response:

+MQTTUSERCFG:<LinkID>,<scheme>,<"client_id">,<"username">,<"password">,<"cert_file">,<"key_file">,<"ca_file">

OK

Set Command

Set MQTT User Configuration.

Command:

AT+MQTTUSERCFG=<LinkID>,<scheme>,<"client_id">,<"username">,<"password">[,<"cert_file">][,<"key_file">][,<"ca_file">]

Response:

OK

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.

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.)

AT+MQTTCLIENTID

Get/Set MQTT client ID.

Query Command

Query MQTT client ID.

Command:

AT+MQTTCLIENTID?

Response:

+MQTTCLIENTID:<LinkID>,<"client_id">

OK

Notes

  • The maximum length of the query command does not exceed 128 bytes (limited to AT length)

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

Parameters

  • <LinkID>: currently only supports link ID 0.

  • <length>: MQTT client ID length. Range: [1,23].

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.

AT+MQTTUSERNAME

Get/Set MQTT username.

Query Command

Query MQTT username.

Command:

AT+MQTTUSERNAME?

Response:

+MQTTUSERNAME:<LinkID>,<"user_name">

OK

Notes

  • The maximum length of the query command does not exceed 128 bytes (limited to AT length)

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

Parameters

  • <LinkID>: currently only supports link ID 0.

  • <length>: MQTT username length. Range: [1,128].

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.

AT+MQTTPASSWORD

Get/Set MQTT password.

Query Command

Query MQTT password.

Command:

AT+MQTTPASSWORD?

Response:

+MQTTPASSWORD:<LinkID>,<"password">

OK

Notes

  • The maximum length of the query command does not exceed 128 bytes (limited to AT length)

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

Parameters

  • <LinkID>: currently only supports link ID 0.

  • <length>: MQTT password length. Range: [1,128].

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.

AT+MQTTCONNCFG

Get/Set configuration of MQTT connection.

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

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

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.

AT+MQTTALPN

Get/Set MQTT Application Layer Protocol Negotiation (ALPN).

Query Command

Query MQTT Application Layer Protocol Negotiation (ALPN).

Command:

AT+MQTTALPN?

Response:

+MQTTALPN:<LinkID>[,<"alpn">][,<"alpn">][,<"alpn">]

OK

Set Command

Set MQTT Application Layer Protocol Negotiation (ALPN).

Command:

AT+MQTTALPN=<LinkID>,<alpn_counts>[,<"alpn">][,<"alpn">][,<"alpn">]

Response:

OK

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.

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.

Example

AT+CWMODE=1

AT+CWJAP="ssid","password"

AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com"

AT+MQTTUSERCFG=0,4,"ST67_01","ST67W611M1","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+MQTTSNI

Get/Set MQTT Server Name Indication (SNI).

Query Command

Query MQTT Server Name Indication (SNI).

Command:

AT+MQTTSNI?

Response:

+MQTTSNI:<LinkID>,<"sni">

OK

Set Command

Set MQTT Server Name Indication (SNI).

Command:

AT+MQTTSNI=<LinkID>,<"sni">

Response:

OK

Parameters

  • <LinkID>: Currently only supports link ID 0.

  • <”sni”>: MQTT Server Name Indication. You can send it in ClientHello to the server.

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.

Example

AT+CWMODE=1

AT+CWJAP="ssid","password"

AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com"

AT+MQTTUSERCFG=0,4,"ST67_01","ST67W611M1","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

AT+MQTTCONN

Connect to MQTT Brokers.

Query Command

Query MQTT Brokers that have already been connected.

Command:

AT+MQTTCONN?

Response:

+MQTTCONN:<LinkID>,<state>,<scheme><"host">,<port>,<reconnect>

OK

Set Command

Connect to MQTT Brokers.

Command:

AT+MQTTCONN=<LinkID>,<"host">,<port>,<reconnect>

Response:

OK

+MQTT:CONNECTED,0

or

+MQTT:DISCONNECTED,0

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).

AT+MQTTPUB

Publish MQTT Messages in string.

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

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.

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.

Example

AT+CWMODE=1

AT+CWJAP="ssid","password"

AT+CIPSNTPCFG=1,-5,"0.pool.ntp.org","time.google.com"

AT+MQTTUSERCFG=0,4,"ST67W611M1_id","ST67W611M1","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.

AT+MQTTPUBRAW

Publish Long MQTT Messages.

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

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.

AT+MQTTSUB

Subscribe to MQTT topics.

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

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>

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.

AT+MQTTUNSUB

Unsubscribe from MQTT topics.

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

Parameters

  • <LinkID>: Currently only supports link ID 0.

  • <topic>: MQTT topic. Maximum length: 128 bytes.

AT+MQTTCLEAN

Close MQTT connections.

Set Command

Function:

Close the MQTT connection and release the resource.

Command:

AT+MQTTCLEAN=<LinkID>

Response:

OK

Parameters

  • <LinkID>: Currently only supports link ID 0.

Low power function AT command

Instruction list

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

Low power AT command description

AT+PWR

Function: Configure Power mode

Execute Command

Command:

AT+PWR=<power mode>

Response:

OK

Parameters

  • <power mode>:
    • 0: normal mode.

    • 2: standby mode.

Example

AT+PWR=0             // Normal mode
AT+PWR=2             // Standby mode
AT+PWR=2,1           // Standby mode, enable receive broadcast package

AT+SLWKIO

Function: Configure GPIO as Wakeup Source.

Execute Command

Command:

AT+SLWKIO=<wakeup io>,<trigger mode>

Response:

OK

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.

AT+DEWKIO

Function: Delete GPIO as Wakeup Source.

Execute Command

Command:

AT+DEWKIO=<io>

Response:

OK

Parameters

  • <io>: GPIO wake-up IO number.

AT+SLWKTIMER

Function: Configure timer as Wakeup Source.

Set Command

Command:

AT+SLWKTIMER=<mode>,<timeouts>

Response:

OK

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)

Example

AT+SLWKTIMER=0,5000                       //Standby mode, Wake up once next 5000ms

AT+SLWKDTIM

Function: Configure DTIM as Wakeup Source

Set Command

Command:

AT+SLWKDTIM=<dtim>

Response:

OK

Parameter

  • <dtim>: Set the wakeup ditm.

Example

AT+SLWKDTIM=10                      // Set ditm10 for wakeup.

AT+SLCLDTIM

Function: Delete DTIM config

Set Command

Command:

AT+SLCLDTIM

Response:

OK

Example

AT+SLCLDTIM

AT+TWT_PARAM

Function: Setup TWT paraments.

Set Command

Command:

AT+TWT_PARAM=<setup type>,<flow type>,<exponent>,<wakeup duration>,<wake interval mantissa>

Response:

OK

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.

Example

AT+TWT_PARAM=1,1,13,128,1000                       //SP = 32.768 ms, Wake Interval = 8.192 seconds:

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

AT+TWT_SLEEP

Function: Enter TWT low power

Set Command

Command:

AT+TWT_SLEEP

Response:

OK

Example

AT+TWT_SLEEP

AT+TWT_TEARDOWN

Function: Teardown the Target Wake Time (TWT) session.

Set Command

Command:

AT+TWT_TEARDOWN=<neg_type>,<all_twt>[,<flow_id>]

Response:

OK

or

ERROR

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.

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.

Example

// Teardown a specific TWT flow with ID 1
AT+TWT_TEARDOWN=0,0,1

// Teardown all TWT flows
AT+TWT_TEARDOWN=0,1

AT+SET_CLOCK

Function: Set 32 KHz clock source.

Set Command

Function:

Set 32 KHz clock source.

Command:

AT+SET_CLOCK=<clock_source>

Response:

OK

Parameters

  • <clock_source>:

    • 1: Internal RC oscillator

    • 2: External passive crystal

    • 3: External active crysta

Example

AT+SET_CLOCK=1

AT+GET_CLOCK

Function: Query 32Khz clock source.

Query Command

Command:

AT+GET_CLOCK

Response:

+GET_CLOCK:<clock_source>

OK

Parameters

  • <clock_source>: The clock source used by ST67W611M1.

Example

AT+GET_CLOCK

// Response
+GET_CLOCK:1

OK

MQTT local service setup

  1. Install mosquitto

sudo apt install mosquitto
  1. Passwd set

mosquitto_passwd -c /etc/mosquitto/passwd ST67W611M1

Enter the password twice, for example:

123456789
  1. 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
  1. Start MQTT service

mosquitto -c /etc/mosquitto/mosquitto.conf
  1. PC subscription to a topic

mosquitto_sub -h 192.168.31.156 -u ST67W611M1 -P 123456789 --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
  1. ST67W611M1 User Configuration

AT+MQTTUSERCFG=0,4,"ST67_01","ST67W611M1","123456789","client_1.crt","client_1.key","ca_1.crt"
  1. ST67W611M1 connect to MQTT Brokers.

AT+MQTTCONN=0,"192.168.31.156",8883,0
  1. ST67W611M1 publish a message

AT+MQTTPUB=0,"test/topic1","This is a MQTT test",2,0
  1. ST67W611M1 subscription to a topic

AT+MQTTSUB=0,"test/topic2",0
  1. PC publish a message

mosquitto_pub -h 192.168.31.156 -p 8883 -u ST67W611M1 -P 123456789 --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

MQTT TLS schemes with HiveMQ

Verification Steps for the Serverless Version

  1. Download the broker Root CA certificate from HiveMQ (isrgrootx1.pem) and place it in the folder:

examples/wifi/spi_wifi/lfs/lfs/isrgrootx1.pem

  1. In the folder examples/wifi/spi_wifi/, run “make” to rebuild the project and use the QConn_Flash tool to flash the image.

  2. In the HiveMQ web console, create a broker under a serverless plan and set up the corresponding credentials (for example, username = ST67W611M1, password = 123456789, with permission set to publish & subscribe). Please refer to the official HiveMQ documentation for this step.

  3. Connect the ST67W611M1 to the WiFi AP (adjust the SSID and password as needed):

AT+CWMODE=1

AT+CWJAP=”8E88”,””

  1. Configure MQTT user settings:

AT+MQTTUSERCFG=0,2,”ST67_01”,”ST67W611M1”,”123456789”,””,””,”isrgrootx1.pem” (0 indicates the local client index; 2 specifies the use of one-way TLS where the client verifies the server’s certificate; “ST67_01” is the MQTT client ID; “ST67W611M1”/”123456789” are the username and password set up on the console; isrgrootx1.pem is the broker Root CA.)

  1. 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”

  1. 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.)

  1. 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.)

  1. Subscribe to all topics:

AT+MQTTSUB=0,”#”,0

  1. Publish a topic message:

AT+MQTTPUB=0,”/test/ST67_01”,”What’s up guys”,0,0

Verification Steps for the Starter Version

  1. Download the broker Root CA certificate (isrgrootx1.pem) from HiveMQ and place it in the folder:

examples/wifi/spi_wifi/lfs/lfs/isrgrootx1.pem

  1. In the folder examples/wifi/spi_wifi/, run “make” to rebuild the project and use the QConn_Flash tool to flash the image.

  2. In the HiveMQ web console, create a broker under a starter plan and set up the corresponding credentials (for example, username = ST67W611M1, password = 123456789, 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.

  3. Connect the ST67W611M1 to the WiFi AP (adjust the SSID and password as needed):

AT+CWMODE=1

AT+CWJAP=”8E88”,””

  1. Configure MQTT user settings:

AT+MQTTUSERCFG=0,4,”ST67_01”,”ST67W611M1”,”123456789”,”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; “ST67W611M1”/”123456789” 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.)

  1. 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”

  1. 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.)

  1. 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.)

  1. Subscribe to all topics:

AT+MQTTSUB=0,”#”,0

  1. Publish a topic message:

AT+MQTTPUB=0,”/test/ST67W611M1”,”What’s up guys”,0,0