中文 | English
The WHD is an independent, embedded Wi-Fi Host Driver that provides a set of APIs to interact with Infineon WLAN chips. The WHD is an independent firmware product that is easily portable to any embedded software environment, including popular IoT frameworks such as Mbed OS and Amazon FreeRTOS. Therefore, the WHD includes hooks for RTOS and TCP/IP network abstraction layers.
Details about Wi-Fi Host Driver can be found in the Wi-Fi Host Driver readme.
The release notes detail the current release. You can also find information about previous versions.
The repository has adapted WHD to the RT-Thread system, currently only supports the SDIO bus protocol, and uses the mmcsd of RT-Thread for sdio bus operations.
Welcome everyone PR to support more bus interface and chips.
- porting/inc holds the minimal public headers mirrored from Infineon's BSP/HAL so that WHD can be built without pulling the whole ModusToolbox SDK.
- porting/src/bsp wires REG_ON, HOST_WAKE and SDIO resources (see porting/src/bsp/whd_bsp.c) and exposes the helper network-buffer glue in porting/src/bsp/whd_network_buffer.c.
- porting/src/hal provides the
cyhal_*implementations for GPIO and SDIO so the upstream WHD HAL calls map directly onto RT-Thread drivers. - porting/src/rtos/whd_rtos.c adapts the cyabs RTOS abstraction to native RT-Thread mutexes, semaphores, threads and timers.
- porting/src/resources contains the runtime loader (
resources.c) and thewhd_res_downloadCLI implementation (download.c). - porting/src/wlan/whd_wlan.c registers the driver with RT-Thread's Wi-Fi stack and is the main entry point that honors the
WHD_PORTING_*Kconfig switches.
In the package, select Wifi-Host-Driver(WHD) for RT-Thread
RT-Thread online packages ---> # Online software package
IoT - internet of things ---> # IOT menu bar
[*] Wifi-Host-Driver(WHD) for RT-Thread. ---> # Select the package
--- Wifi-Host-Driver(WHD) for RT-Thread
--- WHD Configuration
[*] Set country code from host
(AU) Set the default country code
(0) Set the default country code revision
[ ] Default enable powersave mode
(200) Set return to sleep delay.(PM2)
[ ] Using thread initialization
(10) The priority level value of init thread
(2048) The stack size for init thread
--- WHD Thread Configuration
(8) The priority level value of WHD thread
(5120) The stack size for WHD thread
--- WHD Resources Configuration
( ) File System
(/sdcard/whd/43438A1.bin) Set the file path of the firmware files
(/sdcard/whd/43438A1.clm_blob) Set the file path of the clm files
(/sdcard/whd/nvram.txt) Set the file path of the nvram files
(X) Flash Abstraction Layer(FAL)
("whd_firmware") Set the partition name of the firmware files
("whd_clm") Set the partition name of the clm files
("whd_nvram") Set the partition name of the nvram files
(1024) Set the block size for resources
--- Hardware Configuration
(X) CYW43438
( ) CYW4373
( ) CYW43012
( ) CYW43439
( ) CYW43022
( ) CYW4343W
( ) CYW55500
( ) CYW55572
--- Pin Configuration
(Number) Select the pin name or number --->
(-1) Set the WiFi_REG ON pin number
(-1) Set the HOST_WAKE_IRQ pin number
(Name) Select the pin name or number --->
("PA.0") Set the WiFi_REG ON pin name
("PA.1") Set the HOST_WAKE_IRQ pin name
[*] Using out-of-band interrupt(HOST_WAKE_IRQ)
(falling) Select HOST_WAKE_IRQ event type --->
(2) Set the interrupt priority for HOST_WAKE_IRQ pin
--- Porting options
[*] Using BSP porting
[*] Using HAL porting
[*] Using RTOS porting
[*] Using the malloc/free of RT-Thread
--- WHD log level
(Error) Select the log level
WHD_SET_COUNTRY_FROM_HOSTtogether withWHD_COUNTRY_CODE/WHD_COUNTRY_CODE_REVISIONlets the host push the regulatory table that matches your deployment without rebuilding the firmware blob.CY_WIFI_DEFAULT_ENABLE_POWERSAVE_MODE,CY_WIFI_DEFAULT_PM2_SLEEP_RET_TIME,CY_WIFI_USING_THREAD_INIT,CY_WIFI_INIT_THREAD_PRIORITY/STACK_SIZEand the WHD thread menu let you pick the startup model that best matches your BSP scheduling limits.- The resource menu replaces the old "external storage" toggle: select file paths when you boot from a filesystem, or select FAL partitions when you store the blobs in flash.
WHD_RESOURCES_BLOCK_SIZEcontrols the read buffer size, and you can still override the weakwhd_wait_fs_mount()in porting/src/resources/resources.c if your filesystem needs extra time to get ready. WHD_PORTING_BSP,WHD_PORTING_HAL,WHD_PORTING_RTOSandWHD_USE_CUSTOM_MALLOC_IMPLmap directly onto the code inside the porting tree. Leave them enabled for the RT-Thread glue, or turn off the relevant switch when you must link against Infineon's original BSP/HAL/RTOS libraries.- The log level selector wires up the WHD
WPRINTmacros so you can promote errors only, enable info/debug prints, or capture data traces while diagnosing SDIO traffic.
Recent WHD drops may ship without the regulatory *.clm_blob files or the board-specific nvram.txt snippets inside wifi-host-driver/WHD/COMPONENT_WIFI5/resources and wifi-host-driver/WHD/COMPONENT_WIFI6/resources. If they are missing, request the firmware+NVRAM bundle from your module vendor to ensure you stay aligned with the certified radio profile.
WHD_RESOURCES_IN_EXTERNAL_STORAGE_FS enables loading every blob directly from a filesystem (SD card, SPI flash FS, USB mass storage, etc.). Just keep the configured paths (for example /sdcard/whd/43438A1.bin, /sdcard/whd/43438A1.clm_blob, /sdcard/whd/nvram.txt) accessible before WHD starts and there is no need to repartition on-chip flash. Make sure whd_wait_fs_mount() (provided as a weak symbol in porting/src/resources/resources.c) blocks until the filesystem is mounted, or reorder your startup sequence so the filesystem driver finishes initialization before WHD tries to open the files.
When you keep the resource files on a filesystem, copy the matching *.bin, *.clm_blob and nvram.txt into the paths configured above. When you use FAL, make sure the named partitions exist and write the blobs once with the whd_res_download command.
The pin configuration menu lets you switch between numeric IDs and logical pin names (for example "PA.0"), disable CYBSP_USING_OOB_INTR when your design relies on SDIO card interrupts instead of HOST_WAKE, and pick the falling or rising edge plus IRQ priority whenever HOST_WAKE is enabled.
Note
sdio driver needs to support stream transfer. In the bsp of RT-Thread, most chips do not have the function of adapting stream transfer.
The Cortex-M4 core also requires software to compute CRC16 and send it after the data, reference stream transmission solution.
For the Cortex-M7 core, modify the "drv_sdio.c" file as shown in the following example:
/* The example is an sdio driver for the STM32H750 */
SCB_CleanInvalidateDCache();
reg_cmd |= SDMMC_CMD_CMDTRANS;
hw_sdio->mask &= ~(SDMMC_MASK_CMDRENDIE | SDMMC_MASK_CMDSENTIE);
hw_sdio->dtimer = HW_SDIO_DATATIMEOUT;
hw_sdio->dlen = data->blks * data->blksize;
hw_sdio->dctrl = (get_order(data->blksize)<<4) |
(data->flags & DATA_DIR_READ ? SDMMC_DCTRL_DTDIR : 0) | \
/* Adds detection of the DATA_STREAM flag */
((data->flags & DATA_STREAM) ? SDMMC_DCTRL_DTMODE_0 : 0);
hw_sdio->idmabase0r = (rt_uint32_t)sdio->cache_buf;
hw_sdio->idmatrlr = SDMMC_IDMA_IDMAEN;You can download resource files in ymodem mode. The resource files use the FAL component.
The resource download function depends on the ymodem components.
Make sure that RT_USING_RYM is enabled and that WHD_RESOURCES_IN_EXTERNAL_STORAGE_FAL is selected so the resources are read from flash partitions.
- Run the "whd_res_download" command on the terminal to download the resources.
- This command requires you to enter the partition name of the resource file.
- For example resource download(Use the default partition name, Enter your own partition name):
/* partition table */
/* magic_word partition name flash name offset size reserved */
#define FAL_PART_TABLE \
{ \
{ FAL_PART_MAGIC_WORD, "whd_firmware", "onchip_flash", 0, 512 * 1024, 0 }, \
{ FAL_PART_MAGIC_WORD, "whd_clm", "onchip_flash", 512 * 1024, 32 * 1024, 0 }, \
{ FAL_PART_MAGIC_WORD, "whd_nvram", "onchip_flash", 544 * 1024, 32 * 1024, 0 }, \
}# Download firmware files
whd_res_download whd_firmware
# Download clm files
whd_res_download whd_clm
# Download nvram files
whd_res_download whd_nvram- The ymodem tool can use xshell, after completing the command input, wait for xshell to initiate the file transfer.
msh >whd_res_download whd_firmware
Please select the whd_firmware file and use Ymodem to send.
- At this point, right-click the mouse in xshell and select "file transfer" to "using ymodem send".
- In the wifi-host-driver/WHD/COMPONENT_WIFI5/resources directory (depending on the chip you chose in menuconfig), select the matching firmware, clm, and nvram files.
CYW55500andCYW55572use the Wi-Fi 6 resource blobs located under wifi-host-driver/WHD/COMPONENT_WIFI6/resources.- After the transmission is complete, msh will output the following log.
Download whd_firmware to flash success. file size: 419799
- After downloading the firmware and clm resource files, reset and restart.
- If you selected the filesystem option instead of FAL, copy the same firmware/CLM/NVRAM trio into the paths configured under "WHD Resources Configuration" (for example mount the SD card on your PC and drag the files into
/whd/). Once the filesystem is mounted in RT-Thread—andwhd_wait_fs_mount()confirms it is ready—WHD will consume the blobs directly without going throughwhd_res_download.
- In the package, select
TinyCrypt: A tiny and configurable crypt library
RT-Thread online packages ---> # Online software package
security packages ---> # In the security package
TinyCrypt: A tiny and configurable crypt library ---> # Select TinyCrypt
- Select the
TinyCryptpackage, after the file is downloaded complete, the md5 checksum is calculated and printed automatically.
| CHIP | SDIO | SPI | M2M |
|---|---|---|---|
| CYW4343W | * | x | x |
| CYW43438 | o | x | x |
| CYW4373 | * | x | x |
| CYW43012 | o | x | x |
| CYW43439 | o | x | x |
| CYW43022 | * | x | x |
| CYW55500 | o | x | x |
| CYW55572 | * | x | x |
'x' indicates no support
'o' indicates tested and supported
'*' means theoretically supported, but not tested
The project uses modules from Xinlian Xinwei (Hangzhou) Technology Co., Ltd for testing.
The module models and corresponding chip models are as follows:
| Module type | Chip type |
|---|---|
| CYWL6208 | CYW43438 |
| CYWL6312 | CYW43012 |
| CYWL6209 | CYW43439 |
| CYWL6373 | CYW4373 |
If you need module testing, you can buy it from Xinlian Xinwei Taobao.
This TF card adapter board can be easily inserted into the TF card slot of the development board for testing.
- mail: 1425295900@qq.com
- WeChat: Evlers
- If there is any problem on the driver, welcome to submit PR or contact me to communicate with you.
- If you think this project is good and can meet your needs, please tip me~ Thank you for your support!
