Wi-Fi Connection Manager Library
Loading...
Searching...
No Matches
Wi-Fi Connection Manager (WCM) - Wi-Fi Connectivity Management Middleware for Infineon MCUs

Overview

The Wi-Fi Connection Manager (WCM) is a library that helps application developers manage Wi-Fi connectivity on Infineon platforms that support Wi-Fi. It provides a thread-safe set of APIs to establish, monitor, and recover Wi-Fi connections, and to scan, join, and leave Wi-Fi networks in station (STA), soft access point (SoftAP), and concurrent (simultaneous SoftAP + STA) modes.

WCM monitors active connections, automatically reconnects to the access point (AP) on intermittent link loss, and notifies the application of connection state changes through an event-notification mechanism. It also supports the Wi-Fi Protected Setup (WPS) Enrollee role. WCM is network-stack agnostic and is built on top of the abstraction-rtos library, supporting both the FreeRTOS, lwIP, and mbed TLS combination and the ThreadX, NetX Duo, and NetX Secure combination (the ThreadX combination is currently supported only on the CYW955913EVK-01). Existing WCM 2.x users can migrate using the porting guide.

Current release: v4.3.0 (see RELEASE.md and version.xml).

Multi-Core Architecture and Virtual API Support

WCM supports multi-core architecture by making a subset of its APIs available as virtual APIs. Virtualization allows the WCM APIs defined on one core to be accessed from another core using Inter-Process Communication (IPC). WCM can run on two cores simultaneously, with one core containing the full connectivity stack (primary core) and the other core containing the subset of virtual-only APIs (secondary core). The virtual APIs pipe API requests over IPC to the primary core, where the API is executed, and the result is passed back to the secondary core. This abstracts the implementation details and complexity of IPC, simplifying multi-core connectivity application development. For more information, see the Virtual Connectivity Manager library.

Features

  • Wi-Fi station, SoftAP, and concurrent modes - Scan, join, and leave Wi-Fi networks in STA mode, run a SoftAP, or operate both simultaneously in concurrent (SoftAP + STA) mode.
  • WPA3 personal security and WPS - Supports WPA3 personal network security and the Wi-Fi Protected Setup (WPS) Enrollee role in both push-button and PIN modes.
  • Connection monitoring and automatic recovery - Monitors active connections and link events, automatically reconnects to the AP on intermittent connection loss, and notifies the application of state changes through registered event callbacks.
  • Network-stack agnostic - Supports connectivity applications based on either the FreeRTOS, lwIP, mbed TLS combination or the ThreadX, NetX Duo, NetX Secure combination (the ThreadX combination is currently supported only on the CYW955913EVK-01), built on top of the abstraction-rtos library.
  • Multi-core virtual API support - Exposes cy_wcm_is_connected_to_ap, cy_wcm_register_event_callback, and cy_wcm_deregister_event_callback as virtual APIs that can be invoked from a secondary core through the Virtual Connectivity Manager.

When to Use

Use this library when your application needs to manage Wi-Fi connectivity on Infineon hardware, including:

  • Connecting a device to a Wi-Fi network as a station (STA), with connection monitoring and automatic reconnection.
  • Hosting a SoftAP or running concurrent SoftAP + STA operation.
  • Onboarding devices to a Wi-Fi network using WPS (push-button or PIN).
  • Scanning for available access points, with or without SSID or band filters.
  • Multi-core applications where WCM runs on a primary core and virtual APIs are used on a secondary core.

Prerequisites

Hardware Requirements

This library and its features are supported on the following Infineon device families:

  • PSOC™ 6 with CYW4343W / CYW43012 / CYW43439 Wi-Fi connectivity
  • PSOC™ Edge E84
  • XMC7200 with CYW43439 connectivity
  • CYW943907 / CYW954907 standalone Wi-Fi SoCs
  • CYW955913 single-chip Wi-Fi + Bluetooth® (ThreadX, NetX Duo, NetX Secure combination)
  • CYW43022 connectivity

The set of validated kits grows over time; see RELEASE.md for the specific kits validated in each release.

Software Requirements

Software and tools Version
ModusToolbox™ software environment 3.9
ModusToolbox™ Device Configurator 5.90
GCC compiler 14.2.1
IAR compiler 9.50.2
Arm® compiler 6 6.22
LLVM compiler 22.1.0

Read Documentation First

Choose Starting Template

Create an Empty application in ModusToolbox™ (always prefer starting from the Empty template), then add the required libraries for your target platform.

Add Required Libraries

WCM is delivered as part of a Wi-Fi core bundle rather than added directly. Add the required libraries 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.

For Wi-Fi kits on FreeRTOS, lwIP, and mbed TLS - add wifi-core-freertos-lwip-mbedtls, which internally pulls in wifi-connection-manager, FreeRTOS, lwIP, mbed TLS, and other dependent modules:

# deps/wifi-core-freertos-lwip-mbedtls.mtb
https://github.com/Infineon/wifi-core-freertos-lwip-mbedtls#latest-v4.X#$$ASSET_REPO$$/wifi-core-freertos-lwip-mbedtls/latest-v4.X

For CYW955913EVK-01 on ThreadX, NetX Duo, and NetX Secure - add wifi-core-threadx-cat5, which internally pulls in wifi-connection-manager and other dependent modules:

# deps/wifi-core-threadx-cat5.mtb
https://github.com/Infineon/wifi-core-threadx-cat5#latest-v1.X#$$ASSET_REPO$$/wifi-core-threadx-cat5/latest-v1.X

After adding the libraries in the Library Manager (or creating the .mtb files), run make getlibs to fetch them. For virtual (multi-core) APIs, also add virtual-connectivity-manager (see the Virtual API Usage section).

Dependent libraries pulled in automatically include the Wi-Fi Host Driver (WHD), the RTOS Abstraction Layer, and Connectivity Utilities.

Configure Makefile (if applicable)

Review the predefined configuration files bundled with the wifi-core library and define the required COMPONENTS in the application Makefile. See the "Quick start" section in the wifi-core-freertos-lwip-mbedtls README (FreeRTOS, lwIP, mbed TLS) or the wifi-core-threadx-cat5 README (ThreadX, NetX Duo, NetX Secure).

WPS is disabled by default and uses the mbed TLS security stack. Enable it with:

COMPONENTS+=WPS MBEDTLS

WCM disables all debug log messages by default. To enable logging, add the ENABLE_WCM_LOGS macro and call cy_log_init() (see the Log Messages section):

DEFINES+=ENABLE_WCM_LOGS

Add Headers

Add the following header to your application source:

#include "cy_wcm.h"

Quick Start

This quick start demonstrates initializing WCM in station mode, scanning for the target AP to determine its security type, and connecting with bounded retries and event notifications.

  1. Create an Empty application.
  2. Add the required libraries for your platform profile using the Library Manager (or .mtb files in deps/), then run make getlibs.
  3. Configure the application Makefile with the required COMPONENTS (add WPS MBEDTLS if using WPS).
  4. Add #include "cy_wcm.h" to your application source.
  5. Initialize WCM, scan for the AP security type, connect with retries, and register an event callback.

See Sample Code for a complete pattern.

Sample Code

This section provides a complete, runnable example. It initializes WCM in STA mode, scans for the configured SSID to obtain its security type, connects with bounded retries, and registers an event callback to observe disconnection, reconnection, and IP-change events.

Applicable runtime environments:

  • FreeRTOS - supported on all Wi-Fi kits. Full example is shown below.
  • ThreadX - supported on the CYW955913EVK-01 kit using the wifi-core-threadx-cat5 library. Use the same API sequence shown below; only the RTOS task-creation code differs.
  • Bare Metal - not applicable. This library requires an RTOS.
  • Zephyr - not supported by this library. Use FreeRTOS or ThreadX on Infineon platforms.

FreeRTOS Example (main.c + task)

/* Complete example: WCM init, scan for AP security type, connect with retries */
#include <stdio.h>
#include <string.h>
#include "cyabs_rtos.h"
#include "cy_wcm.h"
#define WIFI_SSID "SSID"
#define WIFI_PASSWORD "PASSWORD"
#define MAX_WIFI_RETRY_COUNT (3u)
#define WIFI_CONN_RETRY_INTERVAL_MSEC (100u)
/* Scan callback used to obtain the security type of the target AP. */
static void scan_to_get_security(cy_wcm_scan_result_t *result_ptr, void *user_data,
{
cy_wcm_security_t *security = (cy_wcm_security_t *)user_data;
if ((strlen((const char *)result_ptr->SSID) != 0) && (status == CY_WCM_SCAN_INCOMPLETE))
{
*security = result_ptr->security;
}
}
/* Event callback for Wi-Fi link-status changes. */
static void network_event_callback(cy_wcm_event_t event, cy_wcm_event_data_t *event_data)
{
switch (event)
{
printf("Disconnected from Wi-Fi\n");
break;
printf("Reconnected to Wi-Fi.\n");
break;
if (event_data->ip_addr.version == CY_WCM_IP_VER_V4)
{
uint32_t v4 = event_data->ip_addr.ip.v4;
printf("IP Address: %d.%d.%d.%d\n", (uint8_t)v4, (uint8_t)(v4 >> 8),
(uint8_t)(v4 >> 16), (uint8_t)(v4 >> 24));
}
break;
default:
break;
}
}
void wifi_task(void *arg)
{
(void)arg;
cy_rslt_t result;
cy_wcm_connect_params_t connect_param;
cy_wcm_ip_address_t ip_address;
cy_wcm_scan_filter_t scan_filter;
/* Step 1: Initialize WCM in station mode (brings up Wi-Fi transport and network stack). */
result = cy_wcm_init(&wcm_config);
if (result != CY_RSLT_SUCCESS)
{
printf("cy_wcm_init failed!\n");
return;
}
/* Step 2: Scan filtered by SSID to obtain the AP security type. */
memcpy(scan_filter.param.SSID, WIFI_SSID, sizeof(WIFI_SSID));
cy_wcm_start_scan(scan_to_get_security, (void *)&security, &scan_filter);
cy_rtos_delay_milliseconds(10000);
/* Step 3: Populate connection parameters. */
memset(&connect_param, 0, sizeof(connect_param));
memset(&ip_address, 0, sizeof(ip_address));
memcpy(connect_param.ap_credentials.SSID, WIFI_SSID, sizeof(WIFI_SSID));
memcpy(connect_param.ap_credentials.password, WIFI_PASSWORD, sizeof(WIFI_PASSWORD));
connect_param.ap_credentials.security = security;
/* Step 4: Connect with bounded retries. */
for (uint32_t retry = 0; retry < MAX_WIFI_RETRY_COUNT; retry++)
{
result = cy_wcm_connect_ap(&connect_param, &ip_address);
if (result == CY_RSLT_SUCCESS)
{
printf("Successfully connected to Wi-Fi network '%s'.\n",
connect_param.ap_credentials.SSID);
/* Step 5: Register for link-status events. */
cy_wcm_register_event_callback(network_event_callback);
break;
}
printf("Connection to Wi-Fi network failed (error 0x%08X). Retrying in %d ms...\n",
(unsigned int)result, WIFI_CONN_RETRY_INTERVAL_MSEC);
cy_rtos_delay_milliseconds(WIFI_CONN_RETRY_INTERVAL_MSEC);
}
}
cy_wcm_scan_status_t
Enumeration of scan status.
Definition cy_wcm.h:282
cy_wcm_security_t
Enumeration of Wi-Fi Security Modes.
Definition cy_wcm.h:181
cy_wcm_event_t
Enumeration of WCM events.
Definition cy_wcm.h:368
@ CY_WCM_SCAN_INCOMPLETE
Scan is in progress; more scan results will be returned.
Definition cy_wcm.h:283
@ CY_WCM_IP_VER_V4
Denotes IPv4 version.
Definition cy_wcm.h:164
@ CY_WCM_SCAN_FILTER_TYPE_SSID
SSID-based scan filtering.
Definition cy_wcm.h:385
@ CY_WCM_SECURITY_UNKNOWN
Returned by cy_wcm_scan_result_callback_t if security is unknown.
Definition cy_wcm.h:221
@ CY_WCM_INTERFACE_TYPE_STA
STA or client interface.
Definition cy_wcm.h:263
@ CY_WCM_EVENT_DISCONNECTED
STA disconnected from the AP.
Definition cy_wcm.h:373
@ CY_WCM_EVENT_RECONNECTED
STA reconnected to the AP.
Definition cy_wcm.h:372
@ CY_WCM_EVENT_IP_CHANGED
IP address change event.
Definition cy_wcm.h:374
cy_rslt_t cy_wcm_register_event_callback(cy_wcm_event_callback_t event_callback)
Registers an event callback to monitor the connection and IP address change events.
cy_rslt_t cy_wcm_connect_ap(cy_wcm_connect_params_t *connect_params, cy_wcm_ip_address_t *ip_addr)
Connects the STA interface to a AP using the Wi-Fi credentials and configuration parameters provided.
cy_rslt_t cy_wcm_stop_scan(void)
Stops an ongoing Wi-Fi network scan.
cy_rslt_t cy_wcm_init(cy_wcm_config_t *config)
Initializes the WCM.
cy_rslt_t cy_wcm_start_scan(cy_wcm_scan_result_callback_t scan_callback, void *user_data, cy_wcm_scan_filter_t *scan_filter)
Performs a Wi-Fi network scan.
cy_wcm_security_t security
Wi-Fi Security.
Definition cy_wcm.h:509
cy_wcm_passphrase_t password
Password needed to join the AP; should be a null-terminated string.
Definition cy_wcm.h:508
cy_wcm_ssid_t SSID
SSID of the Wi-Fi network to join; should be a null-terminated string.
Definition cy_wcm.h:507
Structure used to pass WCM configuration to cy_wcm_init.
Definition cy_wcm.h:468
cy_wcm_interface_t interface
Interface type.
Definition cy_wcm.h:469
Structure used to pass the Wi-Fi connection parameter information to cy_wcm_connect_ap.
Definition cy_wcm.h:528
cy_wcm_ap_credentials_t ap_credentials
AP credentials.
Definition cy_wcm.h:529
Structure used to receive the IP address information from cy_wcm_connect_ap.
Definition cy_wcm.h:482
cy_wcm_ip_version_t version
IP version.
Definition cy_wcm.h:483
union cy_wcm_ip_address_t::@0 ip
IP address bytes.
uint32_t v4
IPv4 address in network byte order.
Definition cy_wcm.h:486
Structure used to pass scan filters to cy_wcm_start_scan.
Definition cy_wcm.h:540
cy_wcm_scan_filter_type_t mode
Scan filter mode.
Definition cy_wcm.h:541
union cy_wcm_scan_filter_t::@1 param
Parameter specific to scan filter mode.
cy_wcm_ssid_t SSID
SSID.
Definition cy_wcm.h:544
Structure used for storing scan results.
Definition cy_wcm.h:556
cy_wcm_security_t security
Security type.
Definition cy_wcm.h:562
cy_wcm_ssid_t SSID
SSID (i.e., name of the AP).
Definition cy_wcm.h:557
Structure used to receive the IP address of the STA or MAC address of the connected STA to SoftAP thr...
Definition cy_wcm.h:495
cy_wcm_ip_address_t ip_addr
Contains the IP address for the CY_WCM_EVENT_IP_CHANGED event.
Definition cy_wcm.h:496

Expected Outcome

When the Quick Start flow is configured correctly, you should observe:

Visual/Hardware Behavior:

  • The device initializes the Wi-Fi transport and network stack, scans for the configured SSID, and associates with the AP.
  • After a successful connection, the event callback reports IP-address assignment; on intermittent link loss, WCM automatically reconnects and reports disconnection and reconnection events.

Terminal Output:

Successfully connected to Wi-Fi network 'SSID'.
IP Address: 192.168.1.10
Disconnected from Wi-Fi
Reconnected to Wi-Fi.

Performance Metrics:

  • Connection retry behavior is controlled by MAX_WIFI_RETRY_COUNT and WIFI_CONN_RETRY_INTERVAL_MSEC in the sample.
  • Scan and connect latency depend on the RF environment, the number of APs in range, and the AP security configuration.

Troubleshooting

  • **cy_wcm_deinit() does not bring down the network stack:** The default lwIP stack does not implement a deinit path, so cy_wcm_init() and cy_wcm_deinit() should each be invoked only once.
  • **cy_wcm_connect_ap() fails when a MAC address is specified:** Connecting by specifying the AP MAC address as a connection parameter is not supported.
  • IAR 9.40.2 build errors in Debug mode: If the application explicitly includes iar_dlmalloc.h, add --advanced_heap to LDFLAGS in the application Makefile.
  • SoftAP with 6 GHz on CY8CEVAL-062S2-CYW955513SDM2WLIPA: SoftAP on the 6 GHz band is currently not supported on this kit.
  • WPS Enrollee PIN mode on KIT_XMC72_EVK_MUR_43439M2: WPS Enrollee does not work in PIN mode on this kit. As a workaround, either disable mbed TLS acceleration by adding DISABLE_MBEDTLS_ACCELERATION to the Makefile defines, or disable D-cache by adding CY_DISABLE_XMC7000_DATA_CACHE to the Makefile defines.

Related Code Examples

Configuration Reference

This section documents the COMPONENT flags, build defines, API call sequence, and multi-core usage for the library.

COMPONENT Flags

Component Description
WPS Enables Wi-Fi Protected Setup (WPS) Enrollee support. Requires MBEDTLS.
MBEDTLS Required for the mbed TLS security stack used by WPS.

Build Defines

Define Description
ENABLE_WCM_LOGS Enables debug log messages from the WCM library. Requires calling cy_log_init() from the cy-log module.
ENABLE_MULTICORE_CONN_MW Required on both cores for multi-core virtual API usage.
USE_VIRTUAL_API Required on the secondary core for multi-core virtual API usage.

API Call Sequence

For scan, connect, and disconnect

+----------------------------------+
| cy_wcm_init() |
+----------------------------------+
|
v
+----------------------------------+
| cy_wcm_start_scan() |
+----------------------------------+
|
v
+----------------------------------+
| cy_wcm_connect_ap() |
+----------------------------------+
|
v
+----------------------------------+
| cy_wcm_register_event_callback() |
+----------------------------------+
|
v
+----------------------------------+
| cy_wcm_disconnect_ap() |
+----------------------------------+
|
v
+----------------------------------+
| cy_wcm_deinit() |
+----------------------------------+

Reconnection and Recovery

WCM automatically monitors the active connection and reconnects to the AP on intermittent link loss, delivering CY_WCM_EVENT_DISCONNECTED and CY_WCM_EVENT_RECONNECTED events through the registered callback. If the AP becomes unavailable for an extended period and WCM reports a persistent disconnection, the application can drive its own bounded reconnect loop:

#define WIFI_MAX_RECONNECT_ATTEMPTS (5u)
#define WIFI_RECONNECT_DELAY_MS (2000u)
/* Call to re-establish the STA connection after a persistent disconnection. */
cy_rslt_t wifi_reconnect(cy_wcm_connect_params_t *connect_param)
{
cy_rslt_t result = CY_RSLT_SUCCESS;
cy_wcm_ip_address_t ip_address;
for (uint32_t attempt = 1; attempt <= WIFI_MAX_RECONNECT_ATTEMPTS; attempt++)
{
printf("Wi-Fi reconnect attempt %lu of %d...\n",
(unsigned long)attempt, WIFI_MAX_RECONNECT_ATTEMPTS);
result = cy_wcm_connect_ap(connect_param, &ip_address);
if (result == CY_RSLT_SUCCESS)
{
printf("Wi-Fi reconnected.\n");
return result;
}
cy_rtos_delay_milliseconds(WIFI_RECONNECT_DELAY_MS);
}
printf("Wi-Fi reconnect failed after %d attempts.\n", WIFI_MAX_RECONNECT_ATTEMPTS);
return result;
}

Virtual API Usage

To use WCM virtual APIs in a multi-core environment:

  1. Add the Virtual Connectivity Manager (latest-v1.X) using the Library Manager, or create deps/virtual-connectivity-manager.mtb and run make getlibs:
    https://github.com/Infineon/virtual-connectivity-manager#latest-v1.X#$$ASSET_REPO$$/virtual-connectivity-manager/latest-v1.X
  2. Primary core Makefile:
    DEFINES+=ENABLE_MULTICORE_CONN_MW
  3. Secondary core Makefile:
    DEFINES+=ENABLE_MULTICORE_CONN_MW USE_VIRTUAL_API
  4. Call cy_vcm_init() from both cores before invoking the virtual WCM APIs. See the Virtual Connectivity Manager Reference Manual.

Notes:

  • Virtual APIs are supported on all PSOC™ 62 devices, but they have been tested only on the CY8CEVAL-062S2-MUR-43439M2 kit.
  • To use WCM APIs in a multi-core environment, applications on both cores must include the WCM and VCM libraries.
  • To ensure VCM initialization is synchronized, the project that boots first (for example, the CM0+ project on PSOC 62) must call cy_vcm_init before bringing up the second project (for example, the CM4 project on PSOC 62), passing config.hal_resource_opt as CY_VCM_CREATE_HAL_RESOURCE. The second project must pass CY_VCM_USE_HAL_RESOURCE.

Log Messages

To enable logs:

  1. Add to the Makefile:
    DEFINES+=ENABLE_WCM_LOGS
  2. Call cy_log_init() from the cy-log module (part of the connectivity-utilities library). See the Connectivity Utilities Reference Manual.

To enable logs in a dual-core application, refer to Enable logs in dual core application in the Virtual Connectivity Manager.

Release Notes and Changelog

License

This library is provided under Infineon software license terms. When WPS is enabled, WCM pulls in mbed TLS (Apache-2.0) for the WPS security stack. WCM also relies on Infineon connectivity libraries such as the Wi-Fi Host Driver, the RTOS abstraction layer, and connectivity utilities, which are governed by their respective license terms. You are responsible for reviewing and accepting all applicable third-party license terms.

Copyright

(c) 2026, Infineon Technologies AG, or an affiliate of Infineon

Technologies AG. All rights reserved.