Wi-Fi Basic Architecture
WHC IPC is the default wireless communication architecture in the SDK, offering full-chip compatibility. Its core features include:
Dual-core Architecture
Based on the AP and NP dual-core design of the Ameba chip
Enables communication between Host and Device through internal IPC interfaces
No external Host controller required
Parallel Protocol Stack Execution
LWIP network protocol layer and Wi-Fi driver layer run on separate cores
Enables parallel processing to enhance data transmission efficiency
Modular Isolation Design
Achieves secure decoupling between the WiFi driver layer and user application layer
Improves system security, reliability, and robustness
WHC IPC architecture
Wi-Fi Initialization
The SDK enables Wi-Fi functionality by default. In the main()
function, it automatically calls wifi_init()
to initialize Wi-Fi.
The complete Wi-Fi initialization flow is shown below:
Note
After successful Wi-Fi initialization, the device defaults to STA Mode.
To enable SoftAP Mode, call
wifi_start_ap()
after Wi-Fi initialization is complete. Refer to Common SoftAP Workflows for details.
Wi-Fi Scan
This section introduces several common scan configurations. For advanced configurations, please refer to wifi_scan_networks()
.
Wi-Fi scanning modes include synchronous scanning and asynchronous scanning, with the complete workflow as follows:
Configuration:
Set
block=1
when callingwifi_scan_networks()
Features:
Thread-safe: Only blocks the calling thread, allowing other threads to continue running
Recommended for: Most basic use cases
Synchronous scan flow
Configuration:
Set
block=0
when callingwifi_scan_networks()
Register a callback function using
scan_user_callback
Features:
Non-blocking: Returns immediately after validating parameters
Recommended for: Complex scenarios with high real-time requirements
Asynchronous scan flow
STA Mode
STA Connection Flow
This section introduces several common STA connection flows. For advanced configurations, refer to wifi_connect()
.
Configuration:
Set
block=1
when callingwifi_connect()
Features:
Thread-safe: Only blocks the calling thread, allowing other threads to continue running
Recommended for: Most basic use cases
Synchronous Connection Flow
Configuration:
Set
block=0
when callingwifi_connect()
Register
RTW_EVENT_JOIN_STATUS
for event callback
Features:
Non-blocking: Returns immediately after validating parameters
Recommended for: Complex scenarios with high real-time requirements
Asynchronous Connection Flow
Note
Setting rtw_network_info::channel
(e.g., obtained through a separate scan) can significantly reduce connection latency if the AP channel is known.
STA Auto-reconnect on Disconnection
TBD
STA Auto-reconnect on Power-up
TBD
STA Power-saving Mode
TBD
SoftAP Mode
Common SoftAP Workflows
This section introduces common workflows for SoftAP. For advanced configurations, please refer to the SoftAP-related API documentation.
The common SoftAP workflow is shown in the following figure:
SoftAP MAC Address Configuration
The SoftAP MAC address is derived from the chip’s base MAC address and can be configured in the file component/soc/usrcfg/amebaxxx/ameba_wificfg.c
.
Assuming the chip’s base MAC address is 00:e0:4c:01:02:03
, the SoftAP MAC address can be configured as follows:
SoftAP MAC address: 00:e1:4c:01:02:03
wifi_user_config.concurrent_enabled = 1;
wifi_user_config.softap_addr_offset_idx = 1;
SoftAP MAC address: 00:e0:4c:01:02:04
wifi_user_config.concurrent_enabled = 1;
wifi_user_config.softap_addr_offset_idx = 5;
SoftAP MAC address: 00:e0:4c:01:02:03
wifi_user_config.concurrent_enabled = 0;
MAC Address Conflict Restriction
When the SoftAP MAC address matches the chip’s MAC address (Example 3), STA and SoftAP cannot operate simultaneously:
STA cannot connect to any AP after SoftAP is activated.
SoftAP cannot start if STA is already connected.
Channel Switch Announcement (CSA) for SoftAP
TBD
STA and SoftAP Coexistence
TBD
Promiscuous Mode
TBD
Country Code Configuration
TBD
Transmit Power Configuration
TBD