Git Product home page Git Product logo

rt-thread_wifi-host-driver's Introduction

RT-Thread Wi-Fi Host Driver (WHD)

δΈ­ζ–‡ | English

Overview

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.

Using

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

Package configuration

--- Wifi-Host-Driver(WHD) for RT-Thread
      Select Chips (CYW43438)  --->                     # Select the corresponding chip
[*]   Using resources in external storage(FAL)  --->    # Using the FAL component to load the resource
[ ]   Using custom nvram files                          # Use custom nvram header files
[ ]   Default enable powersave mode                     # The low power mode is selected by default
(8)   The priority level value of WHD thread            # Configure the priority of the WHD thread
(5120) The stack size for WHD thread                    # Configure the stack size of the WHD thread
      Select the pin name or number (Number)  --->      # Select a pin name or pin number
(-1)  Set the WiFi_REG ON pin number                    # Set the WiFi_REG ON pin of the module
(-1)  Set the HOST_WAKE_IRQ pin number                  # Set the HOST_WAKE_IRQ pin of the module
      Select HOST_WAKE_IRQ event type (falling)  --->   # Select the edge of Wake up host
(2)   Set the interrput priority for HOST_WAKE_IRQ pin  # Set the external interrupt priority
[ ]   Using thread initialization                       # Create a thread to initialize the driver
(500) Set the waiting time for mmcsd card scanning      # Set the waiting time for the scan cards
  • When using the FAL component to load a resource file, FAL component is automatically selected, user must transfer the firmware and clm files used by the WiFi module to the corresponding partition of FAL.
  • When using a custom nvram file, users need to write their own wifi_nvram_image.h file and include the header file path, refer to the wifi_nvram_image.h file that comes with WHD.
  • When using the default enable powersave mode, the module will enter the energy saving mode when idle, which will cause the SDIO driver to print a timeout log when the module is woken up. This is a normal phenomenon.
  • The waiting time for mmcsd device driver to scan the card refers to the waiting time for the RT-Thread sdio device driver to scan the WiFi module, and WHD needs to wait for the completion of scanning the card before registering the driver.

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;

Resource download

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 and WHD_RESOURCES_IN_EXTERNAL_STORAGE definitions are turned on.

  • 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):
# For example, my partition configuration
/* partition table */
/*      magic_word          partition name      flash name          offset          size            reserved        */
#define FAL_PART_TABLE                                                                                              \
{                                                                                                                   \
    { FAL_PART_MAGIC_WORD,  "whd_firmware",     "onchip_flash",     0,              448 * 1024,         0 },        \
    { FAL_PART_MAGIC_WORD,  "whd_clm",          "onchip_flash",     448 * 1024,     32 * 1024,          0 },        \
    { FAL_PART_MAGIC_WORD,  "easyflash",        "onchip_flash",     480 * 1024,     32 * 1024,          0 },        \
    { FAL_PART_MAGIC_WORD,  "filesystem",       "onchip_flash",     512 * 1024,     512 * 1024,         0 },        \
}

# Download firmware files
whd_res_download whd_firmware

# Download clm files
whd_res_download whd_clm
  • 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 resources(wifi-host-driver/WiFi_Host_Driver/resources) directory of whd, select the resource file for the corresponding chip.
  • 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.

Supported Chip

CHIP SDIO SPI M2M
CYW4343W * x x
CYW43438 o x x
CYW4373 * x x
CYW43012 o x x
CYW43439 * x x
CYW43022 * x x

'x' indicates no support
'o' indicates tested and supported
'*' means theoretically supported, but not tested

More information

Contact & Suppor

  • mail: [email protected]
  • 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!
    wechat

rt-thread_wifi-host-driver's People

Contributors

evlers avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.