The command console library provides a framework to add an interactive command console to your application over a serial terminal. Support for Wi-Fi, Ethernet, iPerf, Bluetooth® Low Energy (LE), and WebSocket commands is bundled with this library, so you can bring up connectivity, measure throughput, and exercise middleware interactively without writing custom test code.
The ModusToolbox™ AnyCloud Tester - Wi-Fi Bluetooth® Console application is built over this library for Wi-Fi kits.
Note: While iPerf provides several other commands, only a subset relevant to embedded connectivity use cases is enabled in this library. See the iPerf commands section.
Use this library when you need to:
This library is supported on the following device families with the corresponding connectivity capability:
For the specific validated evaluation kits for the current release, see the RELEASE.md.
The current version of the library was validated for compatibility with the following software and tools:
| Software and tools | Version |
|---|---|
| ModusToolbox™ software | 3.9 |
| ModusToolbox™ Device Configurator | 5.90 |
| GCC Compiler | 14.2.1 |
| IAR Compiler (only for ModusToolbox™) | 9.50.2 |
| Arm® Compiler 6 | 6.22 |
| LLVM compiler | 22.1.0 |
Create an Empty application (always prefer starting from the Empty template) for your target kit, then add the required libraries described below.
Add the required middleware using the ModusToolbox™ Library Manager (available in the ModusToolbox™ for VS Code extension and the Eclipse IDE), or by creating the corresponding .mtb files in the application's deps folder and running make getlibs.
In the ModusToolbox™ environment, the command console library uses the abstraction-rtos library for the RTOS abstraction API and the secure-sockets library for socket functions. For the Bluetooth® LE functionality, it uses btstack-integration.
Depending on the connectivity you need, add the following:
Wi-Fi kits - Add wifi-core-freertos-lwip-mbedtls, which internally pulls wifi-connection-manager and the other dependent modules.
https://github.com/Infineon/wifi-core-freertos-lwip-mbedtls#latest-v4.X#$$ASSET_REPO$$/wifi-core-freertos-lwip-mbedtls/latest-v4.XNote: For CYW955913EVK-01, add wifi-core-threadx-cat5 instead, which internally pulls wifi-connection-manager and the other dependent modules.
https://github.com/Infineon/wifi-core-threadx-cat5#latest-v1.X#$$ASSET_REPO$$/wifi-core-threadx-cat5/latest-v1.Xethernet-connection-manager and the other dependent modules.https://github.com/Infineon/ethernet-core-freertos-lwip-mbedtls#latest-v4.X#$$ASSET_REPO$$/ethernet-core-freertos-lwip-mbedtls/latest-v4.XBluetooth® LE functionality - Add btstack-integration.
https://github.com/Infineon/btstack-integration#latest-v7.X#$$ASSET_REPO$$/btstack-integration/latest-v7.XNote: btstack-integration should not be included for CYW955913EVK-01.
https://github.com/Infineon/websocket#latest-v1.X#$$ASSET_REPO$$/websocket/latest-v1.XReview and make the required changes to the pre-defined configuration files and Makefile COMPONENTS in the application. The configuration files for the FreeRTOS, lwIP, and Mbed TLS combination are bundled in the Wi-Fi core freertos lwip mbedtls library for Wi-Fi kits and in the Ethernet core freertos lwip mbedtls library for Ethernet kits.
If the application uses a bundle library, the configuration files are in that bundle library. For example, for the Wi-Fi core freertos lwip mbedtls bundle library, the configuration files are in the wifi-core-freertos-lwip-mbedtls/configs folder; for the Ethernet Core FreeRTOS lwIP mbedtls library, they are in the ethernet-core-freertos-lwip-mbedtls/configs folder.
Define the required set of COMPONENTS in the application's Makefile:
Note: For CYW955913EVK-01, the above defines are not applicable.
For Wi-Fi kits, enable the Wi-Fi functionality by adding WCM to the COMPONENTS section:
For Ethernet kits, enable the Ethernet functionality by adding ECM to the COMPONENTS section:
To enable the Bluetooth® LE functionality, add WICED_BLE to the COMPONENTS section:
Add the following compiler directive to the DEFINES section:
Tune the lwIP configuration parameters listed in the application's lwipopts.h file, depending on the required Wi-Fi throughput and use case.
Note: For CYW955913EVK-01, the above configuration is not applicable.
For WebSocket TLS (WSS) support, copy the websocket_certificates.h template file from the command console library's source/websocket_utility/ folder (or from the application's test folder) into your application's source directory and update it with valid PEM-encoded certificates and keys:
WS_ROOT_CA_CERTIFICATE - Root CA certificateWS_CLIENT_CERTIFICATE - Client certificate (for mutual TLS)WS_CLIENT_PRIVATE_KEY - Client private key (for mutual TLS)WS_SERVER_CERTIFICATE - Server certificate (for WSS server)WS_SERVER_PRIVATE_KEY - Server private key (for WSS server)Ensure the header file is in the application include path so that the WebSocket utility can find it during compilation.
Include the library's public header in your application source:
This quick start demonstrates the most common use case: initializing the console framework and adding your own commands. Follow these steps to get from an Empty template to a working console.
Step 1: Create an Empty application for your target kit.
Step 2: Add the required libraries for your connectivity (see Add Required Libraries) and run make getlibs.
Step 3: Configure the Makefile COMPONENTS and DEFINES (see Configure Makefile).
Step 4: Add the console initialization and command-registration code to your main.c (see Sample Code).
Expected Outcome: After programming the device and opening a serial terminal, a console prompt (>) appears and accepts the registered commands.
Initialize the console framework and register your own command table as described in the Adding custom console commands section. A minimal flow is:
When you successfully run the Quick Start example, you should observe the following:
> prompt appears on the serial terminal and echoes the commands you type. Registered commands (for example, mycmd1 --help) print their usage or execute their handler.This section lists the Wi-Fi, iPerf, WebSocket, Ethernet, and Bluetooth® LE commands that are natively supported by the command console library.
Use the following Wi-Fi commands to perform network operations. Enter the following commands after the device boots up and the Wi-Fi module is initialized and ready.
Note: Wi-Fi commands(scan/join/leave/get_rssi/ping) are retained for backward compatibility. These commands are deprecated and it will be removed in the future release.
iPerf commands are used for measuring the Wi-Fi performance/throughput. The iperf sends TCP/UDP data between two peer devices to compute the Wi-Fi performance/throughput.
The following options are supported by the iPerf software integrated into this library. On the console, type iperf --help for the list of options supported by the iperf command.
Note: The -w command is not supported through the command line option; it can be only configured by changing the network stack configuration. See the following notes to configure the TCP window size.
Update the following configurations in the application's config file
#define TCP_SND_BUF (TCP_MSS * 20) #define MEMP_NUM_TCP_SEG 127 DEFINES+=NX_TCP_MAXIMUM_TX_QUEUE=20 Note: NX_TCP_MAXIMUM_TX_QUEUE is not configurable in 55900 devices.For an iperf server, DEFAULT_IPERF_SERVER_TIMEOUT_SEC can be used to configure following timeouts
DEFAULT_IPERF_SERVER_TIMEOUT_SEC can be configured by adding the following DEFINES in Makefile. DEFINES+=DEFAULT_IPERF_SERVER_TIMEOUT_SEC=10
For an iperf UDP client, IPERF_UDP_CLIENT_NEVER_TIMEOUT can be used to configure the UDP client to never terminate when the device is unable to transmit the packets.
IPERF_UDP_CLIENT_NEVER_TIMEOUT can be configured by adding the following DEFINES in Makefile.
Server-specific:
Client-specific:
Miscellaneous:
The following diagram shows the exact setup that should be used for measuring the Wi-Fi performance/throughput of a PSOC™ device using iperf.

Enter the following commands on the PSOC™ device (DUT) after the device boots up and connects to the Wi-Fi network. This section provides only the commands to be run on the DUT. When the 'client iperf command' runs on the DUT, the 'server iperf command' should run on the host PC (as shown in the iPerf Setup diagram), and vice versa.
Start iPerf as a TCP client:
Note: On the peer iPerf device (host PC), start iPerf as a TCP server.
Sample command:
Start iPerf as a UDP client:
Note: On the peer iPerf device (host PC), start iPerf as a UDP server.
Sample command:
The TCP and UDP Wi-Fi performance can be tuned using the iperf command options. The TCP window size option impacts the TCP throughput, and bandwidth option (-b) impacts the UDP throughput. You can tune the configurations either for TCP or UDP based on the details given in the following sections.
The TCP window size is configured with a default optimal value in the Wi-Fi Bluetooth® tester applications for PSOC™ 6 2M devices. If you are using a different PSOC™ device, see the iPerf command options section of this document to adjust the configuration for a better TCP throughput. The TCP window size of iperf can be configured only at compile time.
The iPerf command given in the iPerf commands for Wi-Fi throughput measurement section of this document is an ideal command for UDP throughput measurement on PSOC™ 6 2M devices. If you are using a different PSOC™ device, try different bandwidth values for the iperf -b option to measure the UDP throughput.
For example, when you run the command iperf -c 192.168.0.100 -t 60 -u -b 50M to measure the UDP Tx throughput on the device, if you see the resulting throughput closer to 50 Mbps, you should run the same command again with the -b 60M option and measure the throughput again. If the resulting throughput is different (56 Mbps, which is lesser than 60M, for example), the max UDP Tx throughput supported by the device is 56 Mbps. On the contrary, if the resulting throughput is 27 Mbps with the -b 50M option, you should run the same command again with the -b 30M option and measure the throughput again. If the resulting throughput in this case is 28 Mbps, this is the max UDP Tx throughput supported by the PSOC™ device. Use this as a guideline to identify the real max UDP throughput supported by your device.
The WebSocket utility provides a unified ws command to exercise the websocket middleware library interactively from a serial terminal. Both client and server roles are supported, including secure (WSS/TLS) connections.
Prerequisites:
websocket_certificates.h. Copy this file from the library's source/websocket_utility/ directory (or from the application template) into your application source and populate it with your PEM-encoded certificates before building.| Option | Long form | Description |
|---|---|---|
-c | --client | Client mode |
-s | --server | Server mode |
-p | --port | Port number |
-t | --type | Message type (text/binary/ping) |
-m | --message | Message content |
-cid | --clientid | Connected client ID (server mode) |
tls | Enable TLS/WSS (positional flag) |
Use the following Ethernet commands to perform network operations. Enter the following commands after the device boots up and the Ethernet module is initialized and ready.
As an example, use the LE connection-oriented channel (CoC) application on a CYW20719B2Q40EVB-01 kit as the Bluetooth® LE peer device to measure the Bluetooth® LE throughput. Ensure that the Bluetooth® LE connection-interval and LE-COC-MTU-size configurations are set to the same value in both the Bluetooth® LE devices that are used for throughput measurement. To modify the Bluetooth® LE connection-interval and MTU, see the Tuning for optimal Bluetooth® LE performance section.
The following Bluetooth® LE commands are supported in this library:
> ble_coc_disconnect > ble_coc_send_start > ble_coc_send_stop > ble_get_throughput > bt_get_device_address Bluetooth® LE performance can be tuned using the Bluetooth® LE connection-interval and LE-COC-MTU-size configurations. Ensure that the Bluetooth® LE connection-interval and LE-COC-MTU-size configurations are set to the same value in both the Bluetooth® LE devices that are used for throughput measurement.
For a given MTU size, if the configured connection interval is low, the resulting throughput will be higher, and vice-versa.
ModusToolbox™: (Infineon Bluetooth® stack)
The connection interval value is configured in multiples of 1.25 milliseconds based on the connection interval assigned in the Bluetooth® LE configuration structure.
By default, the library sets the Bluetooth® LE connection interval configuration value to 40 which computes to a connection interval time of 50 msec (40 * 1.25 msec). The connection interval can be modified through a build macro.
Add the BLE_CONNECTION_INTERVAL macro to the DEFINES in the application's Makefile. If the connection interval needs to be set to 24, the Makefile entry would look like as follows:
For the range of connection interval that can be configured, see Bluetooth® LE connection interval.
By default, BLE_COC_MTU_SIZE is set to 100 bytes; the max value that can be configured is 512 bytes. To modify this to 200, do the following:
Add the BLE_COC_MTU_SIZE macro to the DEFINES in the application's Makefile. The Makefile entry would look like as follows:
Do the following to modify the connection interval and MTU on the peer LE COC application running on the CYW20719B2Q40EVB-01 device:
The connection interval of LE COC application can be modified by changing the min and max connection interval values of BLE scan configuration structure in le_coc_cfg.c.By default, the connection interval of the PSOC™ device is set to 40. To set the same value, use the configuration given below:
This section explains the theoretical Bluetooth® LE throughput numbers achievable on a Bluetooth® LE platform based on the configuration.
The theoretical Bluetooth® LE throughput can be calculated using the following formula:
Throughput = (MTU size in bits) / (connection interval in seconds)
The following default values are used in this library:
- Default connection interval = 50 ms - Default MTU size = 100 bytes
The theoretical Bluetooth® LE throughput achievable for these default values can be calculated as follows:
= (100 * 8) / (50 / 10^3) = (800 / 0.050) = 16,000 bps = 16 kbps
Initialize the command console framework:
You should define the commands table and the handler along with the primary library. For example, the WHD library console commands may be placed in WHD_utils and located along with the WHD library. The test application will invoke the relevant function in WHD_utils for adding the commands.
Implement command handlers when the commands are executed on the console.
In this example, implement my_command1 and my_command2 function handlers.
By default, the Wi-Fi, Ethernet, Bluetooth, iPerf, and WebSocket utilities are enabled. To disable any of these utilities, add the corresponding define to the application's Makefile. For the COMPONENTS build flags used to enable Wi-Fi (WCM), Ethernet (ECM), and Bluetooth® LE (WICED_BLE) functionality, see Configure Makefile.
To disable Wi-Fi commands:
To disable Ethernet commands:
To disable iperf command:
To disable bluetooth commands:
To disable WebSocket commands:
Note: When using only the WebSocket utility, disable unused utilities to reduce code size. For example:
-i 1: Run iPerf without the -i (interval) option, or use an interval value greater than 1 second.iar_dlmalloc.h: Add --advanced_heap to LDFLAGS in the application Makefile.DEFINES+=CONSOLE_THREAD_STACK_SIZE=(12*1024); the default 6 KB is insufficient for the TLS 1.3 handshake.WCM is added to COMPONENTS and the Wi-Fi core bundle library is pulled. On CYW955913EVK-01, the FreeRTOS/MBEDTLS/LWIP component defines are not applicable.This library is provided under Infineon software license terms. It depends on the abstraction-rtos and secure-sockets libraries and, depending on the enabled utilities, on btstack-integration (Bluetooth® LE) and the websocket middleware, which are governed by their respective license terms. You are responsible for reviewing and accepting all applicable third-party license terms.
(c) 2026, Infineon Technologies AG, or an affiliate of Infineon
Technologies AG. All rights reserved.