ST67W611M Wi-Fi®– CLI Project

(Redirected from Connectivity:Wifi ST67W6X CLI Application)


back to main page

1. CLI Presentation

This application aims to evaluate and to test the ST67W611M Wi-Fi® solution via command line interface (CLI).

It exercises the network co-processor (ST67W611M) capabilities embedding the LwIP Wi-Fi® stack and Bluetooth LE® stack. It relies on the FreeRTOS RealTime operating system to manage the ST67W611M expansion board.

The application enables basic Wi-Fi® operations, such as scanning available local access points (APs) and connecting to an AP. It also supports testing LwIP functionalities such as DHCP, pinging URLs or specific IP addresses, MQTT, and IPerf.

The application enables also basic Bluetooth LE® functionalities like scanning, connecting and advertising.

2. Requirements

2.1. Software and system requirements

The software required are the following (minimum IDEs version):

  • STM32CubeIDE toolchain V1.18.1 [1].
  • IAR Embedded Workbench for ARM (EWARM) toolchain V9.30.1
  • RealView Microcontroller Development Kit (MDK-ARM) toolchain V5.39

Programmer:

  • STM32CubeProgrammer [2] to program the board with pre-generated binary file

HyperTerminal:

  • Use the application through the serial link
  • Open a HyperTerminal client connected to the host ST-LINK COM port

The serial COM port must be configured as below:

Baudrate 921600
Data 8b
Stopbit 1b
Parity None
Flow control None
Rx LF
Tx LF
Local Echo Off

For more details, refer to the HyperTerminal setup page.

2.2. Hardware requirements

This project is available on NUCLEO-U575ZI-Q, NUCLEO-H563ZI, NUCLEO-H7S3L8 or NUCLEO-N657X0-Q host boards combined with the X-NUCLEO-67W61M1 board.

The X-NUCLEO-67W61M1 board is connected to the NUCLEO host board via the Arduino® connectors:

  • The 5V, 3V3, GND through the CN6
  • The SPI (CLK, MOSI, MISO), SPI_CS and USER_BUTTON signals through the CN5
  • The BOOT, CHIP_EN, SPI_RDY and UART TX/RX signals through the CN9

3. ST67W6X_CLI application description

3.1. Project directory

The "ST67W6x_CLI" application is available by downloading the X-CUBE-ST67W61 Package.

Refer to the Project directory wiki page for more information on the project directory.

3.2. Project description

3.2.1. Structure - Topology

The ST67W6X_CLI project can operate in station or in both station and soft-access point (soft-AP) mode.

The STA mode can be described with the following scheme:

CLI STA only topology

Station and soft-AP modes can be described with the following scheme:

CLI STA + AP topology

3.2.2. Project initialization

The different steps of the application initialization are described below:

Wifi_cli_project_init

3.3. Build and Install

Refer to the build and install chapter for detailed instructions on how to build and download the software onto the device.

3.3.1. ST67W6X default configuration

The default system configuration can be modified in "ST67W6X/Target/w6x_config.h":

/** ST67W611M will go by default in low power mode when ST67W611M is in idle mode */
#define W6X_POWER_SAVE_AUTO                     1

/** ST67W611M clock mode : 1: Internal RC oscillator, 2: External passive crystal, 3: External active crystal */
#define W6X_CLOCK_MODE                          1

The default Wi-Fi® configuration can be modified in the "ST67W6X/Target/w6x_config.h" file:

/** Boolean to enable/disable autoconnect functionality */
#define W6X_WIFI_AUTOCONNECT                    1

/** Define the DHCP configuration : 0: NO DHCP, 1: DHCP CLIENT STA, 2:DHCP SERVER AP, 3: DHCP STA+AP */
#define W6X_WIFI_DHCP                           3

/** Define the max number of stations that can connect to the Soft-AP */
#define W6X_WIFI_SAP_MAX_CONNECTED_STATIONS     4

/** String defining Soft-AP subnet to use.
  *  Last digit of IP address automatically set to 1 */
#define W6X_WIFI_SAP_IP_SUBNET                  {192, 168, 8}

/** String defining Soft-AP subnet to use in case of conflict with the AP the STA is connected to.
  *  Last digit of IP address automatically set to 1 */
#define W6X_WIFI_SAP_IP_SUBNET_BACKUP           {192, 168, 9}

/** Define if the DNS addresses are set manually or automatically */
#define W6X_WIFI_DNS_MANUAL                     0

/** String defining DNS IP 1 address to use
  * @note: This address will be used only if W6X_WIFI_DNS_MANUAL equals 1 */
#define W6X_WIFI_DNS_IP_1                       {208, 67, 222, 222}

/** String defining DNS IP 2 address to use
  * @note: This address will be used only if W6X_WIFI_DNS_MANUAL equals 1 */
#define W6X_WIFI_DNS_IP_2                       {8, 8, 8, 8}

/** String defining DNS IP 3 address to use
  * @note: This address will be used only if W6X_WIFI_DNS_MANUAL equals 1 */
#define W6X_WIFI_DNS_IP_3                       {0, 0, 0, 0}

/** Define the region code, supported values : [CN, JP, US, EU, 00] */
#define W6X_WIFI_COUNTRY_CODE                   "00"

/** Define if the country code will match AP's one.
  * 0: match AP's country code,
  * 1: static country code */
#define W6X_WIFI_ADAPTIVE_COUNTRY_CODE          0

/** String defining Wi-Fi hostname */
#define W6X_WIFI_HOSTNAME                       "ST67W61_WiFi"

The default net configuration can be modified in the "ST67W6X/Target/w6x_config.h" file:

/** Timeout in ticks when calling W6X_Net_Recv() */
#define W6X_NET_RECV_TIMEOUT                    10000

/** Timeout in ticks when calling W6X_Net_Send() */
#define W6X_NET_SEND_TIMEOUT                    10000

The default utilities configuration can be modified in the "ST67W6X/Target/w6x_config.h" file:

/** Enable Iperf feature */
#define IPERF_ENABLE                            1

/** Enable memory performance measurement */
#define MEM_PERF_ENABLE                         0

/** Enable task performance measurement */
#define TASK_PERF_ENABLE                        1

/** Enable LittleFS */
#define LFS_ENABLE                              1

/** Enable Wi-Fi Alliance Traffic Generator */
#define WFA_TG_ENABLE                           1

The shell can be configured in the "ST67W6X/Target/shell_config.h" file:

/** Enable the shell component */
#define SHELL_ENABLE                            1

/** Shell using color */
#define SHELL_USING_COLOR                       1

/** Print an additional status message at the end of the command execution */
#define SHELL_PRINT_STATUS                      0

/** Shell receive buffer size */
#define SHELL_FREERTOS_RX_BUFF_SIZE             256

/** Shell command maximum size */
#define SHELL_CMD_SIZE                          256

The AT driver can be configured in "ST67W6X\Target\w61_driver_config.h":

/** Maximum number of detected AP during the scan. Cannot be greater than 50 */
#define W61_WIFI_MAX_DETECTED_AP                50

/** Debugging only: Enable AT log, i.e. logs the AT commands incoming/outcoming from/to the ST67W611M */
#define W61_AT_LOG_ENABLE                       0

Additionally, some other options can be modified in the "ST67W6X/Target" directory with different configuration files, as outlined below:

  • logging_config.h: This file provides configuration for the logging component, enabling the setting of the log level
  • shell_config.h: This file provides configuration for Shell component.
  • w6x_config.h: This file provides configuration for the W6X APIs (used during init).
  • w61_driver_config.h: This file provides configuration for the W61 configuration module.

All available defines are available in template directory "Middlewares/ST/ST67W6X_Network_Driver/Conf"

3.3.2. Application configuration

The logging output mode can be modified in "App_CLI/App/app_config.h":

/** Select output log mode [0: printf / 1: UART / 2: ITM] */
#define LOG_OUTPUT_MODE             1

The host low-power mode can be modified in "App_CLI/App/app_config.h":

/** Low power configuration [0: disable / 1: sleep / 2: stop / 3: standby] */
#define LOW_POWER_MODE              0

The host debugger pins can be modified in "App_CLI/App/app_config.h":

/**
* Enable/Disable MCU Debugger pins (dbg serial wires)
* @note by HW serial wires are ON by default, need to put them OFF to save power
*/
#define DEBUGGER_ENABLED            1

The echo client configuration can be modified in "App_CLI/App/app_config.h":

/** URL of Echo TCP remote server */
#define ECHO_SERVER_URL             "tcpbin.com"

/** Port of Echo TCP remote server */
#define ECHO_SERVER_PORT            4242
#endif /* NET_USE_IPV6 */

/** Minimal size of a packet */
#define ECHO_TRANSFER_SIZE_START    1000

/** Maximal size of a packet */
#define ECHO_TRANSFER_SIZE_MAX      2000

/** To increment the size of a group of packets */
#define ECHO_TRANSFER_SIZE_ITER     250

/** Number of packets to be sent */
#define ECHO_ITERATION_COUNT        10

The FOTA client configuration can be modified in "App_CLI/App/app_config.h":

/** Timeout value to set the FOTA timer to when the FOTA application encountered an error for the first time.
  * This allows to tune the timeout value before doing a retry attempt. (not applicable if FOTA timer is not used)*/
#define FOTA_TIMEOUT                20000

/** Delay to wait before rebooting the host device, waiting for ST67W611M device to finish update */
#define FOTA_DELAY_BEFORE_REBOOT    16000

/** Stack size of the FOTA application, this value needs to take into account the HTTP client
  * and ST67W611M OTA static data allocation */
#define FOTA_TASK_STACK_SIZE        2048

/** The max size of the URI supported, this because the buffer
  * that will receive this info is allocated at compile time (static) */
#define FOTA_URI_MAX_SIZE           128

/** Default HTTP server address */
#define FOTA_HTTP_SERVER_ADDR       "192.168.8.105"

/** Default HTTP port */
#define FOTA_HTTP_SERVER_PORT       8000

/** As specified in RFC 1035 Domain Implementation and Specification
  * from November 1987, domain names are 255 octets or less */
#define FOTA_MAX_DOMAIN_NAME_SIZE   255U

/** The folder containing the FOTA header, ST67 binary and the STM32 binary */
#define FOTA_HTTP_URI_TARGET        "/STM32U575ZI_NUCLEO"

/** Root folder of interest on the HTTP server */
#define FOTA_HTTP_COMMON_URI        "/download" FOTA_HTTP_URI_TARGET

/** Default URI for the ST67 binary, should be smaller in bytes size than the value defined by FOTA_URI_MAX_SIZE */
#define FOTA_HTTP_URI               FOTA_HTTP_COMMON_URI "/st67w611m_mission_t01_v2.0.75.bin.ota"

/** Default URI for the STM32 binary, should be smaller in bytes size than the value defined by FOTA_URI_MAX_SIZE */
#define FOTA_HTTP_URI_STM32         FOTA_HTTP_COMMON_URI "/fota_ST67W6X_CLI.bin"

/** Default URI for the FOTA header */
#define FOTA_HTTP_URI_HEADER        FOTA_HTTP_COMMON_URI "/ST67W611_STM32U575ZI_NUCLEO.json"

The MQTT client configuration can be modified in "App_CLI/App/app_config.h":

/** Subscribed topic max buffer size */
#define MQTT_TOPIC_BUFFER_SIZE      100

/** Subscribed message max buffer size */
#define MQTT_MSG_BUFFER_SIZE        600

3.4. How it works

Once the application is started, it enters a state where it waits for commands to be executed via the terminal. To list all the available commands, their descriptions and parameters, type "help". To display the help of a specific command, simply type "help <your command>".

w61/>help

3.4.1. Available commands

System

help                 - help [ command ]. Display all available commands and the relative help message
powersave            - powersave [ 0: disable; 1: enable ]
fs_list              - fs_list. List all files in the file system
fs_delete            - fs_delete < filename >. Delete file from the ST67W611M file system
fs_read              - fs_read < filename >. Read file content
fs_write             - fs_write < filename >. Write file content from the Host to the ST67W611M
reset                - reset < 0: HAL_Reset; 1: ST67W611M_Restore >
info                 - info. Display ST67W6X module info
atcmd                - atcmd < AT+CMD? >. Execute AT command

Wi-Fi

wifi_twt_teardown    - wifi_twt_teardown < 0: announced; 1: unannounced >; 2: all >
wifi_twt_set         - wifi_twt_set
wifi_twt_setup       - wifi_twt_setup < setup_type(0: request; 1: suggest; 2: demand) > < flow_type(0: announced; 1: unannounced) > < wake_int_exp > < min_wake_duration > < wake_int_mantissa >
dtim                 - dtim < value [0; 10] >
wifi_ap_mac          - wifi_ap_mac
wifi_dhcp            - wifi_dhcp [ 0:DHCP disabled; 1:DHCP enabled ] [ 1:STA only; 2:AP only; 3:STA + AP ] [ lease_time [1; 2880] ]
wifi_ap_ip           - wifi_ap_ip
wifi_ap_disconnect_sta - wifi_ap_disconnect_sta < MAC >
wifi_ap_list_sta     - wifi_ap_list_sta
wifi_ap_mode         - wifi_ap_mode [ mode ]
wifi_ap_stop         - wifi_ap_stop
wifi_ap_start        - wifi_ap_start [ -s SSID ] [ -p Password ] [ -c channel [1; 13] ] [ -e security [0:Open; 2:WPA; 3:WPA2; 4:WPA3] ] [ -h hidden [0; 1] ]
wifi_country_code    - wifi_country_code [ 0:AP aligned country code; 1:User country code ] [ Country code [CN; JP; US; EU; 00] ]
wifi_sta_state       - wifi_sta_state
wifi_sta_mac         - wifi_sta_mac
wifi_sta_dns         - wifi_sta_dns [ 0:default IPs; 1: manual IPs ] [ DNS1 addr ] [ DNS2 addr ] [ DNS3 addr ]
wifi_sta_ip          - wifi_sta_ip [ IP addr ] [ Gateway addr ] [ Netmask addr ]
wifi_hostname        - wifi_hostname [ hostname ]
wifi_auto_connect    - wifi_auto_connect
wifi_sta_mode        - wifi_sta_mode [ mode ]
wifi_sta_disconnect  - wifi_sta_disconnect [ -r ]
wifi_sta_connect     - wifi_sta_connect < SSID > [ Password ] [ -b BSSID ] [ -i interval [0; 7200] ] [ -n nb_attempts [0; 1000] ] [ -wps ] [ -wep ]
wifi_scan            - wifi_scan [ -p ] [ -s SSID ] [ -b BSSID ] [ -c channel [1; 13] ] [ -n max_count [1; 50] ]

BLE

ble_disconnect       - ble_disconnect [ conn handle: 0 or 1 ]
ble_connect          - ble_connect [ conn handle: 0 or 1 ] [ BD addr ]
ble_stop_scan        - ble_stop_scan
ble_start_scan       - ble_start_scan
ble_adv_stop         - ble_adv_stop
ble_adv_start        - ble_adv_start
ble_init             - ble_init [ 1: client mode; 2:server mode ]

Net

time                 - time < timezone : UTC format : range [-12; 14] or HHmm format : with HH in range [-12; +14] and mm in range [00; 59] >
ping                 - ping < hostname > [ -c count [1; max(uint16_t) - 1] ] [ -s size [1; 10000] ] [ -i interval [100; 3500] ]
dnslookup            - dnslookup < hostname >

MQTT

mqtt_publish         - mqtt_publish < Topic > < Message >
mqtt_unsubscribe     - mqtt_unsubscribe < Topic >
mqtt_subscribe       - mqtt_subscribe < Topic >
mqtt_disconnect      - mqtt_disconnect
mqtt_connect         - mqtt_connect < -h Host > < -p Port >
mqtt_configure       - mqtt_configure < -s Scheme > < -i ClientId > [ -u Username ] [ -pw Password ] [ -c Certificate ] [ -k PrivateKey ] [ -ca CACertificate ] [ -sni ]

FOTA

fota_http            - fota_http < server IP > < server port > < ST67 resource URI > [ STM32 resource URI ] [ FOTA header resource URI ]. Run firmware update over HTTP

Applicative

info_app             - info_app. Display application info
quit                 - quit. Stop application execution
echo                 - echo [iteration]
iperf                - iperf [options]. Iperf command line tool for network performance measurement. [-h] for help
ps                   - ps. Display a table of tasks in the system
task_report          - task_report. Display task performance report
task_perf            - task_perf [-s]. Start or stop [-s] task performance measurement
echostop             - echostop. WFA - Stops the UDP echo server.
echostart            - echostart <port>. WFA - Starts the UDP echo server on the specified port.


Commands description:

In this project, the following convention is used for getting and setting values. When a command is issued without a parameter, it acts as a "get" operation. Adding a parameter makes it a "set" operation. This applies to all commands capable of "get" functionality. For example:

w61/>wifi_sta_ip

Return the station, gateway, and netmask IPs.

w61/>wifi_sta_ip 192.168.1.2

Sets the Station IP value to 192.168.1.2.

Convention:

The parameters which are between < > are mandatory, while those in [ ] are optional and not required in all cases.

3.4.2. System commands

  • help [ command ]

This command is used to display the global help message describing all the available commands and their summary if no argument is given.

To print the help of a unique command, type:

w61/> help help
help                 - help [command]. Display all available commands and the relative help message

  • reset < 0: HAL_Reset; 1: ST67W611M_Restore >

This command is used to hardware reboot the system or to reset the ST67W611M and restore the initial configuration.


  • info

This command prints different information of the system:

  • ST67W6X info: ST67W6X MW, AT, SDK and Mac SW versions
  • Trim values for Wi-Fi®, BLE and XTAL
  • MAC address of the device
  • Anti-rollback values (values increased at each release to ensure firmware/hardware compatibility)
w61/>info
--------------- ST67W6X info ------------
ST67W6X MW Version:       1.0.0
AT Version:               1.0.0.1
SDK Version:              2.0.75
MAC Version:              1.6.38
Build Date:               May  7 2025 18:19:39
Module ID:                
BOM ID:                   0
Manufacturing Year:       2000
Manufacturing Week:       00
Battery Voltage:          3.306 V
Trim Wi-Fi hp:            5,5,5,5,5,5,4,4,4,4,5,5,5,5
Trim Wi-Fi lp:            4,5,5,6,6,7,7,7,7,7,7,7,7,7
Trim BLE:                 3,3,3,3,4
Trim XTAL:                35
MAC Address:              40:82:7b:00:0e:6d
Anti-rollback Bootloader: 0
Anti-rollback App:        0
-----------------------------------------

  • fs_list

This command lists the different files stored in the host and in the ST67W611M1.

Example:

w61/>fs_list

Host LFS Files:

ca_1.crt (size: 1126)
ca_1.key (size: 1732)
client_1.crt (size: 1104)
client_1.key (size: 1732)
server_1.crt (size: 1108)
server_1.key (size: 1732)

ST67W611M Files:

ca_1.crt
ca_1.key
ca_2.crt
ca_2.key
client_1.crt
client_1.key
client_2.crt
client_2.key
google_fr.crt
isrgrootx1.pem
server_1.crt
server_1.key
server_2.crt
server_2.key
weather.crt

  • fs_read < filename >

This command displays the content of the files listed by the fs_list command.


  • fs_write < filename >

This command stores the file specified in the parameter into the ST67W611M memory.


  • fs_delete < filename >

This command deletes the file specified in the parameter from the ST67W611M memory.


  • powersave [ 0: disable; 1: enable ]

This command specifies if the ST67W611M enters in low power whenever it can, typically after sending the response to a command.

Example:

w61/>powersave
powersave mode is disabled

w61/>powersave 1

w61/>powersave
powersave mode is enabled

  • atcmd < AT+CMD >

This command sends direct AT commands to the ST67W611M. This command cannot be used to send commands implying data transfer. Example:

w61/>atcmd AT+CWMODE?
AT+CWMODE?
+CWMODE:1
OK

3.4.3. Wi-Fi® management commands

  • wifi_hostname [ hostname ]

This command sets/reads the name of the station, which is displayed on the terminal of the access point (AP) to which the station is connected.

Example:

w61/>wifi_hostname ST67W61_WiFi_device
Host name set successfully

w61/>wifi_hostname
Host name : ST67W61_WiFi_device

  • wifi_sta_state

This command diplays the station state.

States Description

NO STARTED CONNECTION

The station is in active state but without previous connection.

CONNECTING

The station try to connect with a BSS/SSID.

CONNECTED

The station is connected.

GOTIP

The station has received an IP address through DHCP protocol.

DISCONNECTED

The station is disconnected from the previous BSS/SSID.

OFF

The station is OFF.

Expected results:

Station is not connected to an access point (AP):

w61/>wifi_sta_state
STA state : STA DISCONNECTED

Station is connected:

w61/>wifi_sta_state
STA state : STA CONNECTED
Connected to following Access Point :
[62:5d:b8:7a:b0:ba] Channel: 1 | RSSI: -43 | SSID: ASUS

Station is connected and has an IP:

w61/>wifi_sta_state
STA state : STA GOT IP
Connected to following Access Point :
[62:5d:b8:7a:b0:ba] Channel: 1 | RSSI: -43 | SSID: ASUS

  • wifi_country_code [ 0: AP aligned country code; 1: User country code ] [ Country code [CN; JP; US; EU; 00] ]

This command sets/reads the country code for regulatory domains. The available country codes in Alpha2 format include US, EU, JP, CN, and 00 (World).

Example:

w61/>wifi_country_code
Country policy : 0
Country code : 00

w61/>wifi_country_code 1 JP
Country code configuration succeeds

w61/>wifi_country_code
Country policy : 1
Country code : JP

  • wifi_scan [ -p ][ -s SSID ][ -b BSSID ][ -c channel [1; 13] ][ -n max_count [1; 50] ]

This command launches a scan command on the interface given in parameter. Different options can be added to the command:

Option Description

-p

This option is used to start a passive scan.

-s <ssid>

This option is used to scan only the beacon of the given SSID.

-b <bssid>

This option is used to scan only the beacon of the given BSSID.

-c <channel>

This option is used to limit the scan to a specific channel of the 2.4GHz frequency band.

-n <max_count>

This option is used to limit the number of access points to be displayed in the scan result.

Example:

w61/>wifi_scan -c 1
Scan results :
[50:91:e3:73:bc:03] Channel:  1 |          WPA2 | RSSI:  -31 | SSID:                     TP-Link_BC03
[62:5d:b8:7a:b0:ba] Channel:  1 |          WPA2 | RSSI:  -41 | SSID:                             ASUS
w61/>wifi_scan -s STWLAN2
Scan results :
[78:0c:f0:6c:b4:a1] Channel: 11 |       WPA-EAP | RSSI:  -54 | SSID:                          STWLAN2
[78:0c:f0:74:45:81] Channel:  6 |       WPA-EAP | RSSI:  -60 | SSID:                          STWLAN2
[78:0c:f0:79:02:21] Channel: 11 |       WPA-EAP | RSSI:  -67 | SSID:                          STWLAN2
w61/>wifi_scan -b 78:0c:f0:6c:b4:a1
Scan results :
[78:0c:f0:6c:b4:a1] Channel: 11 |       WPA-EAP | RSSI:  -54 | SSID:                          STWLAN2

  • wifi_sta_connect < SSID > [ Password ] [ -b BSSID ][ -i interval [0; 7200] ] [ -n nb_attempts [0; 1000] ]

This command connects a station to a local access point with a specific interface.

Option Description
Mandatory

ssid

The SSID of the local access point to connect to.

Optional

Password

This option is needed only if the local access point uses WPA, WPA2 or WPA3 security.

-b <BSSID>

This option specifies the BSSID of the access point to connect if there are multiple access points with the same name.

-i <interval> This option specifies the reconnection interval between connection/reconnection attempts if the first one does not pass. Default value 0: the station does not reconnect to the AP when disconnected, range: [0;7200]. The value is expressed in seconds.
-n <nb_attempts> This option specifies the number of reconnection attempts in case the initial connection or reconnection fails. Default value: 0 (always try to reconnect), range: [0;1000]

This command executes a scan to retrieve the information needed for the connection, including the security of the access point.

Example:

w61/>wifi_sta_connect ASUS chocolat
<INF>   111019 [shell_task] NPC is treating the connect request (w6x_wifi.c:333)
<INF>   115220 [shell_task] DHCP client start, this may take few seconds (w6x_wifi.c:367)
Connection success
w61/>
w61/><INF>   115329 [shell_task] Connected to following Access Point : (main_app.c:186)
<INF>   115329 [shell_task] [62:5d:b8:7a:b0:ba] Channel: 11 | RSSI: -41 | SSID: ASUS (main_app.c:187)

  • wifi_sta_autoconnect

This command is used to get the auto-connect mode. This command cannot change the auto-connect mode, as this is managed via a define at compile time.

w61/>wifi_auto_connect

Get auto-connect state succeed.

Auto-connect state : 1


  • wifi_sta_disconnect [ -r ]

This command disconnects the station from a network.

The -r option removes the registered SSID and password of the previously connected access point.

Example:

w61/>wifi_sta_disconnect
Reason: WLAN_FW_DISCONNECT_BY_USER_WITH_DEAUTH
Station disconnected from Access Point

The "reason" of the disconnection is returned after each disconnection. Below is a list of the different reasons:

  • 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: De-authentication by the access point occurred when not connected.
  • 7: De-authentication 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 de-authentication frame during the 4-way handshake.
  • 10: Failed to allocate memory for a de-authentication 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 de-authentication.
  • 20: User-initiated disconnection without sending a de-authentication 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.

  • wifi_sta_mac

This command prints the MAC address of the station interface.

Example:

w61/>wifi_sta_mac
STA MAC : 8c:fd:f0:fd:8f:41

  • wifi_sta_dns [ 0:default IPs; 1: manual IPs ] [ DNS1 addr ] [ DNS2 addr ] [ DNS3 addr ]

This command sets or reads the DNS configuration of the station. The first parameter specifies if the user wants to use the default DNS IP addresses or manually enter them.

Example:

w61/>wifi_sta_dns 1 1.2.3.4 5.6.7.8 12.23.34.45
DNS configuration set successfully

w61/>wifi_sta_dns
(10:04:26.033) DNS state : 1
(10:04:26.033) DNS1 IP : 1.2.3.4
(10:04:26.033) DNS2 IP : 5.6.7.8
(10:04:26.033) DNS3 IP : 12.23.34.45

When the manual assignment is disabled, the DNS IP addresses return to their default values:

w61/>wifi_sta_dns 0
DNS configuration set successfully

w61/>wifi_sta_dns
DNS state : 0
DNS1 IP : 208.67.222.222
DNS2 IP : 8.8.8.8
DNS3 IP : 0.0.0.0

  • wifi_sta_ip [ IP addr ] [ Gateway addr ] [ Netmask addr ]

This command sets or reads the IP address of the station. The accepted value format for the IP address value is : x.x.x.x

Examples:

w61/>wifi_sta_ip
STA IP : 192.168.235.98
GW IP : 192.168.235.135
NETMASK IP : 255.255.255.0

Set only the device IP address:

w61/>wifi_sta_ip 192.168.235.9
[WARN] [1945368] [shell_task] (w61_at_wifi.c:789) Gateway IP NULL or invalid. Previous one will be use.
[WARN] [1945368] [shell_task] (w61_at_wifi.c:799) Netmask IP NULL or invalid. Previous one will be use.
STA IP configuration set successfully

Set device and gateway IP addresses:

w61/>wifi_sta_ip 192.168.235.9 192.168.235.13
[WARN] [1945368] [shell_task] (w61_at_wifi.c:799) Netmask IP NULL or invalid. Previous one will be use.
STA IP configuration set successfully

Set device, gateway and netmask IP addresses:

w61/>wifi_sta_ip 192.168.235.9 192.168.235.13 255.255.255.0
STA IP configuration set successfully

The gateway and netmask addresses cannot be modified alone.

If the device is not connected to any AP:

w61/>wifi_sta_ip
[ERROR] [2035708] [shell_task] (w6x_wifi.c:556) Station is not connected. Connect to an Access Point before querying IPs
Get STA IP error

  • wifi_dhcp [ 0:DHCP disabled; 1:DHCP enabled ] [ 1:STA only; 2:AP only; 3:STA + AP ] [ lease_time [1; 2880] ]

This command starts or stops the DHCP client (for the station) and/or the DHCP server for the soft-AP.

The lease time parameter specifies the duration for which an IP address is reserved for the station by the DHCP server. The default value of the lease time is 120 minutes, range: [1;2880]

Example:

w61/>wifi_dhcp
DHCP STA STATE :     1
DHCP AP STATE :      0
DHCP AP RANGE :      [192.168.8.2 - 192.168.8.101]
DHCP AP LEASE TIME : 120

Enable DHCP server for soft-AP and specify new lease time.

w61/>wifi_dhcp 1 3 150
DHCP configuration succeed
w61/>wifi_dhcp
DHCP STA STATE :     1
DHCP AP STATE :      1
DHCP AP RANGE :      [192.168.8.2 - 192.168.8.101]
DHCP AP LEASE TIME : 150

  • wifi_ap_start [ -s SSID ] [ -p Password ] [ -c channel [1; 13] ] [ -e security [0:Open; 2:WPA; 3:WPA2; 4:WPA3] ] [ -h hidden [0; 1] ]

This command starts the soft-access point (soft-AP), enabling an additional interface dedicated to the soft-AP in addition to the station interface.

Option Description
Mandatory

-s <SSID>

This option specifies the SSID name of the soft-AP

-p <Password>

This option specifies the password of the SSID. Mandatory only if security is not OPEN

-c <channel>

This option specifies the channel used by the soft-AP.

-e <security>

This option specifies the security of the soft-AP [0: OPEN, 2: WPA, 3: WPA2]

-h <hidden> This option specifies is the SSID is broadcasted or not [0: broadcasting SSID (default); 1: not broadcasting SSID]


Warning:

The channel option might be overridden by the channel number used by the station (when connected to an AP).

Example:

w61/>wifi_ap_start -s MyAP -p 12345678 -c 1 -e 3
Soft-AP configuration done

Get command:

w61/>wifi_ap_start
AP SSID :     MyAP
AP Password : 12345678
AP Channel:   1
AP Security : 3

  • wifi_ap_stop

This command stops the soft-AP.


  • wifi_ap_mode

This command gets or sets the Wi-Fi® standard supported by the soft-AP.

Example:

w61/>wifi_ap_mode
Soft-AP mode : 15 (B:1 G:1 N:1 AX:1)

w61/>wifi_ap_mode 7
Soft-AP mode set to : 7

w61/>wifi_ap_mode 
Soft-AP mode : 7 (B:1 G:1 N:1 AX:0)

  • wifi_ap_list_sta

This command prints all the remote stations connected to the soft-AP.

Example:

w61/>wifi_ap_list_sta
Connected stations :
MAC : 7a:2e:95:96:b0:1f | IP : 192.168.8.2

  • wifi_ap_disconnect_sta < MAC >

This command disconnects the remote stations connected to the soft-AP. The MAC address of the remote station must be passed in parameter.

Example:

w61/>wifi_ap_disconnect_sta 7a:2e:95:96:b0:1f
Station disconnected from soft-AP : [7a:2e:95:96:b0:1f]
WIFI CLIENT DISCONNECTED SUCCESSFULLY

  • wifi_ap_ip

This command displays the soft-AP, IP address and netmask address. The IP address can only be modified via define in the "ST67W6X/Target/w6x_config.h" file. The netmask value is hardcoded.

Example:

w61/>wifi_ap_ip
Soft-AP IP : 192.168.8.1
Netmask IP : 255.255.255.0

  • wifi_ap_mac

This command prints the MAC address of the soft-AP interface.

Example:

w61/>wifi_ap_mac
AP MAC : 42:82:7b:00:0e:af

  • dtim < value [0; 10] >

This command sets or gets the DTIM interval. The range of the value is [0;10], where 0 disables the DTIM.

Example:

w61/>dtim 10

  • wifi_twt_teardown < 0: announced; 1: unannounced; 2: all >

This command selects the TWT configuration to use.


  • wifi_twt_setup < setup_type(0: request; 1: suggest; 2: demand) > < flow_type(0: announced; 1: unannounced) > < wake_int_exp > < min_wake_duration > < wake_int_mantissa >

This command sets the TWT parameters.

Note 1: Commands powersave 0 and dtim 0 must be sent before wifi_twt_setup.

Note 2: For more information, refer to the WiFi_TWT wiki page.

To calculate the TWT (Target Wake Time) wake interval, the following equation is used: TWT Wake Interval =μseconds


  • wifi_twt_set

This command starts the TWT.


3.4.4. Bluetooth LE® commands

  • ble_init [ 1: client mode; 2:server mode ]

This command initializes the module in Bluetooth® LE client or server mode.
It also sets the Bluetooth® LE device name to : "ST67W61_BLE"


  • ble_start_scan

This command starts a Bluetooth® LE scan.


  • ble_stop_scan

This command stops a Bluetooth® LE scan.


  • ble_connect [ conn handle: 0 or 1 ] [ BD addr ]

This command connects to a remote device.

Option Description
Mandatory

conn handle

This option specifies the connection handle to use.

BD addr

This option specifies the BD address of the remote device to connect to.


  • ble_disconnect [ conn handle: 0 or 1 ]

This command disconnects the device from a remove device.


  • ble_adv_start

This command starts the Bluetooth® LE advertising.


  • ble_adv_stop

This command stops the Bluetooth® LE advertising.


3.4.5. Network commands

  • ping < hostname > [ -c count [1; max(uint16_t) - 1] ] [ -s size [1;10000] ] [ -i interval [100;3500] ]

This command pings the specified IP or URL.

Option Description
Mandatory

hostname

The IP address, in format x.x.x.x or a valid URL to ping.

Optional

-c count

This option specifies the number of ping iteration to execute. If no value is set, the default value is 4. Valid range [1; max(uint16_t) - 1]

-s size

This option specifies the size (in bytes) of the ping to send. The default value is 64 bytes. Valid range: [1;10000]

-i interval

This option specifies the interval (in milliseconds) of the ping to send. The default value is 1000 ms. Valid range: [100;3500]

Example:

w61/>ping www.google.com -c 5
5 packets transmitted, 5 received, 0% packet loss, time 65ms
w61/>ping www.google.com -c 5 -s 256 -i 200
5 packets transmitted, 5 received, 0% packet loss, time 111ms

  • time < timezone : UTC format : range [-12; 14] or HHmm format : with HH in range [-12; +14] and mm in range [00; 59] >

This command returns the time from a predefined SNTP server. The <timezone> parameter of the command is used to configure the time zone.

The time zone must be set in one of the two formats:

- With UTC format: range [-12,14]: marks most of the time zones by offset from UTC in whole hours

- With HHmm format: with HH in range [-12, +14] and mm in range [00,59]

Example: ↵After a successful connection to an access point connected to internet:

w61/>time 1
Time: Tue Oct 29 17:52:40 2024

or

w61/>time 100
Time: Tue Oct 29 17:52:40 2024

  • dns_lookup < hostname >

This command returns the IP address related to the hostname using the DNS service.

Example:

w61/>dnslookup www.google.com
IP address:
142.250.185.132

3.4.6. MQTT commands

  • mqtt_configure < -s Scheme > < -i ClientId > [ -u Username ] [ -pw Password ] [ -c Certificate ] [ -k PrivateKey ] [ -ca CACertificate ] [ -sni ]

This command configures the user setup with the chosen MQTT broker.

Option Description
Mandatory
-s Scheme Set the security level:
0: MQTT over TCP
1: MQTT over TLS with password
2: MQTT over TLS with server certificate (CA)
3: MQTT over TLS with client certificate
4: MQTT over TLS with server/client certificate.
-i ClientId The client ID must be unique on the broker.
Optional
-u Username This option specifies the username. Must be defined in the MQTT broker configuration.
-pw Password This option specifies the password related to the username.
-c Certificate This option specifies the client certificate filename. (*)
-k PrivateKey This option specifies the client key filename. (*)
-ca CaCertificate This option specifies the certificate authority filename of the server. (*)
-sni This option configures the server name indication with the host name during the connection.

(*) The file must exist in the file system of the host or the ST67W611M.


  • mqtt_connect < -h Host > < -p Port >

This command connects to a MQTT broker or displays the connection status.

Option Description
Mandatory
-h Host The address of the MQTT broker to connect.
-p Port The port number of the MQTT broker.

Example:

w61/>mqtt_configure -s 0 -i ST67W6X_772
MQTT Configure OK

w61/>mqtt_connect -h "broker.hivemq.com" -p 1883
MQTT Connect OK

w61/>mqtt_connect
MQTT Connect State: Connected
MQTT Connect Host:     broker.hivemq.com
MQTT Connect Port:     1883
MQTT Connect ClientId: ST67W6X_772

  • mqtt_disconnect

This command disconnects from the MQTT broker.

Example:

w61/>mqtt_disconnect
MQTT Disconnect OK

  • mqtt_publish < Topic > < Message >

This command publishes the <Message> on the <Topic> to which the MQTT client is connected.

The topic format must be defined as below (maximum 100 characters):

"/topic_level1/topic_level2"

The message format must be defined as below (json structure recommended):

"{\"timestamp\": \"20201121085253\", \"temperature\": 20.0, \"humidity\": 50.0, \"pressure\": 1000.0}"

Example:

w61/>mqtt_publish "/sensors/mySTM32_772" "\"{\"timestamp\": \"20201121085253\", \"other_field\": \"hello world\" }\""
MQTT Publish OK

  • mqtt_subscribe < Topic >

This command subscribes to a specific <Topic> or prints the list of subscribed topics.

Example:

w61/>mqtt_subscribe "/sensors/mySTM32_772"
MQTT Subscribe OK

When a message from a subscribed topic is received

<INF>    93230 [AtRxParser] MQTT Subscription Received on topic: "/sensors/mySTM32_772" : \"{\"timestamp\":\"20201121085253\",\"other_field\":\"hello world\"}\ (main_app.c:225)

  • mqtt_unsubscribe < Topic >

This command unsubscribes from a specific <Topic>.

Example:

w61/>mqtt_unsubscribe "/sensors/mySTM32_772"
MQTT Unsubscribe OK

3.4.7. FOTA commands

  • fota_http < server IP > < server port > < ST67 resource URI > [ STM32 resource URI ] [ FOTA header resource URI ]

This command downloads a binary to update the network co-processor (ST67W611M) firmware. This binary must be uploaded on an HTTP server.

Option Description
Mandatory
<server IP> The IP address of the server to connect, can be a domain name in www.something.com format.
<server port> The port number of the server.
<ST67 resource URI> The URI of the ST67 binary file to download.
Optionnal
[STM32 resource URI] The URI of the STM32 binary file to download (only applies to NUCLEO-U575ZI-Q project)
[FOTA header resource URI] The URI of the FOTA header file in JSON format to download (only applies to NUCLEO-U575ZI-Q project)

Example:

w61/>fota_http 192.168.8.104 8000 /download/STM32U575ZI_NUCLEO/st67.bin.ota /download/STM32U575ZI_NUCLEO/fota_ST67W6X_CLI.bin /download/STM32U575ZI_NUCLEO/ST67W611_STM32U575ZI_NUCLEO.json

3.4.8. Applicative commands

  • info_app

This command returns the host firmware name and version.

Example:

w61/>info_app

--------------- Host info ---------------

Host FW Version:          0.8.0
Host FW Name:             ST67W6X CLI

  • quit

This command is used to exit the console, return in the main and terminate the code.


  • iperf [ options ]
Option Description
Mandatory

-c <server_addr>

Run in client mode (to test TX)

-s Run in server mode (to test RX)
Optional

-u

This option specifies if UDP should be used. If not used, TCP is used for the test.

-p <Port>

This option specifies the port to connect to (if -c is used) or to open (if -s is used). Default is 5001

-i <Interval>

This option specifies the interval (in seconds) between bandwidth reports.

-l <Length>

This option specifies the read/write buffer size.

-t <Time>

This option specifies the duration of the test. Default is 10 seconds.

-b <Bandwidth> Bandwidth to send in Mbps (for UDP only)
-S <TOS> TOS
-n <MB> Number of Mbyte to send and receive
-P <Priority> Traffic task priority
-d <Dual Mode> Dual mode
-a Abort running iperf

For detailed information on the throughput evaluation, refer to How to measure Wifi throughput.


  • echo [ iteration ]

This command launches an echo sequence in front of an echo server at IP address 45.79.112.203, repeating the sequence the number of times specified by the [iteration] parameter.


  • echostart < port >

This command starts the UDP echo server on the specified port.


  • echostop

This command stops the UDP echo server.


  • task_perf [ -s ]

This command starts and stops the task cycles counter using the [ -s ] option. The counter results can be displayed with the task_report command.


  • task_report

This command displays two arrays.

The first array is enabled by the task_perf command, which displays the number of cycles registered since the last "task_perf" command was submitted, unless it has been stopped.

The second array, always present, displays the status of the different tasks including their state (running, stopped, blocked), priority, available memory free in the stack of the task and their index.

Example:

w61/>task_report
### Task Performance report CPU Freq 160 Mhz
thread id        name            cycles        time (ms)
-------------------------------------------------------
thread #0  shell_task             77324           0
thread #1  OutputTask             43613           0
thread #2        IDLE         857931264        5362
thread #3  defaultTsk              2886           0
thread #4  AtRxParser              2093           0
-------------------------------------------------------
Total                         858057180        5362
### Task Performance report end
Task         State    Prio   Free(u32) Index
********************************************
shell_task     	X	5	280	5
IDLE           	R	0	103	2
AtRxParser     	B	54	258	7
defaultTsk     	B	24	221	1
spi_xfer_engine	B	53	132	6
AtEvt          	B	50	298	8
OutputTask     	S	25	26	4
FOTA task      	B	24	170	9
Tmr Svc        	B	55	93	3

3.5. Memory footprint

Module Description
[Driver] HAL/CMSIS/BSP STM32 CMSIS Cortex, HAL and LL, Board Specific Package drivers
[Project] Core Native STM32 core components
[Project] App Main part of the application
[Project] Target Configuration files for ST67W6X_Network_Driver component
[MW] ST67W6X_Network_Driver Core and API System, Wi-Fi®, Bluetooth® LE, Network, HTTP and MQTT components
Util/Shell: Utility to manage the API through the serial interface
Util/Logging: Utility to process shell and trace messages onto the UART interface (can be changed by ITM)
Util/Performance: iperf, memory allocation report, task usage utilities
[MW] FreeRTOS FreeRTOS kernel source
[MW] LittleFS LittleFS file system
[Utility] lpm Tiny low-power management
[Toolchain] Startup Int_vect, init routines, init table, CSTACK and HEAP
[Toolchain] EWARM Libraries Native compiler libraries

These values depend on the chosen toolset, and they can change in next releases.

3.5.1. ROM/flash memory footprint

The picture below shows the total read-only memory (flash) used by CLI application.

ST67W6X_CLI Read Only memory footprint.

The picture below shows the middleware ST67W6X_Network_Driver read-only memory (flash) used by CLI application.

ST67W6X_Network_Driver Read Only memory footprint used by ST67W6X_CLI application.

3.5.2. Read-write (RW) memory footprint

Info white.png Information
The FreeRTOS Heap is not part of the below chart.
The dynamic memory allocation adds 200'000 bytes (value set for the TOTAL_HEAP_SIZE FreeRTOS parameter).

The ST67W6X_CLI project uses only 48kb of the heap. Refer to Dynamic memory overview wiki page.


The picture below shows only the sum of the static read/write memory (static RAM) of the CLI application.

ST67W6X_CLI Read Write memory footprint

4. References