Edit online

ASR5505S

Read time: 19 minute(s)

本节主要描述 ASR(翱捷)系列 ASR5505S 芯片 SDIO WiFi 驱动的配置和基本的测试方法。

内核配置

  1. 在命令行中输入以下命令进行内核菜单配置
    make kernel_menuconfig
  2. 无线配置
    WiFi 的使用必须要在 Kernel 中打开 cfg80211 和 mac80211 的支持
    Networking support > Wireless
    
    --- Wireless
    <*>   cfg80211 - wireless configuration API
    [ ]     nl80211 testmode command (NEW)
    [ ]     enable developer warnings (NEW)
    [ ]     cfg80211 certification onus (NEW)
    [*]     enable powersave by default (NEW)
    [ ]     cfg80211 DebugFS entries (NEW)
    [*]     support CRDA (NEW)
    [*]     cfg80211 wireless extensions compatibility
    <*>   Generic IEEE 802.11 Networking Stack (mac80211)
    [*]   Minstrel (NEW)
          Default rate control algorithm (Minstrel)  --->
    [ ]   Enable mac80211 mesh networking support (NEW)
    [ ]   Export mac80211 internals in DebugFS (NEW)
    [ ]   Trace all mac80211 debug messages (NEW)
    [ ]   Select mac80211 debugging features (NEW)
  3. 驱动选择
    在 Kernel 中打开需要使用的 asr5505s 驱动,并将模块配置为 modules 方式,暂不支持编译到内核里。
    Device Drivers > Network device support > Wireless LAN
    
    [*]   Asr Wireless Modules  --->
            --- Asr Wireless Modules
            < >   ASR 5531 USB/SDIO Wi-Fi
            <M>   ASR 5505 SDIO Wi-Fi
            < >   ASR 5825 SDIO Wi-Fi & BLE
            < >   ASR 595X SDIO Wi-Fi & BLE
            < >   ASR 596X SDIO Wi-Fi & BLE
            [*]     SDIO bus interface support for FullMAC driver
            [ ]   Power management support
            [*]   ASR device SAE support
            [ ]   ASR device tracing dbg log
            [ ]   ASR driver debug functions
            [*]   do not use dts

DTS 配置

board.dts 中配置子节点。打开对应的 SDMCx 控制器,此处以 SDMC2 为例:
&sdmc2 {
        pinctrl-names = "default";
        pinctrl-0 = <&sdmc2_pins>;
        max-frequency = <40000000>;
        bus-width = <4>;
        power-gpios = <&gpio_d 1 GPIO_ACTIVE_HIGH>;//wifi 模块电源脚
        no-mmc;
        no-sd;
        non-removable;
        cap-sdio-irq;
        status = "okay";
};

SDK 配置

添加相关工具包

在命令行中输入以下命令进行 SDK 菜单配置
make menuconfig
Third-party packages → wpa_supplicant

    [*] iperf3  --->
    [*] wpa_supplicant  --->
        --- wpa_supplicant
        [ ]   use codeblockbuilt binary instead of building from source
        [*]   Enable nl80211 support
        [*]   Enable wext (decodeblockcated)
        [ ]   Enable wired support
        [ ]   Enable IBSS RSN
        [*]   Enable AP mode
        [ ]     Enable Wi-Fi Display
        [ ]     Enable mesh networking
        [*]   Enable autoscan
        -*-   Enable EAP
        [*]   Enable HS20
        [*]   Enable syslog support
        [*]   Enable WPS
        [*]   Enable WPA3 support
        [*]   Install wpa_cli binary
        [*]   Install wpa_client shared library
        [*]   Install wpa_passphrase binary
        -*-   Enable the Unix-socket control interface
        [ ]   Enable support for the DBus control interface
    [*] wireless tools  --->
        --- wireless tools
        [ ]   use codeblockbuilt binary instead of building from source
        [*]   Install shared library
    [*] hostapd  --->
        --- hostapd
        [ ]   use codeblockbuilt binary instead of building from source
        [*]   Enable hostap driver
        [*]   Enable nl80211 driver
        [*]   Enable wired driver
        [*]   Enable ACS
        [*]   Enable EAP
        [*]   Enable WPS
        [*]   Enable WPA3 support
        [*]   Enable VLAN support
        [*]     Enable dynamic VLAN support
        [*]     Use netlink-based API for VLAN operations
    [*] ASR5505s firmware  ----

加载与功能验证

加载
编译烧录程序,Luban 开机脚本默认自动加载 ko 文件,所以上电后会默认自动加载 asr5505.ko 相关驱动。
lsmod
Module                  Size  Used by    Not tainted
asr5505                 707571  0
以下为部分开机加载驱动日志:
[    9.954021] ASR wireless: Driver version: v5.5.3.0_20250219@ruiqi.zheng@Exdroid027
[    9.962284] asr-platform asr-platform.0: asr_platform_probe: start
[    9.968562] asr-platform asr-platform.0: asr_sdio_detect_change: find mmc fail.
[    9.996124] asrsdio mmc1:0001:1: ASR: asr_sdio_probe detect sdio device(mmc1) success.
[   10.004093] asrsdio mmc1:0001:1: asr_sdio_probe: mmc1 ios: 40000000 hz, 4 bit width
[   10.014352] asr-platform asr-platform.0: Direct firmware load for asr_wifi_config.ini failed with error -2
[   10.024113] asr-platform asr-platform.0: asr_read_wifi_config:Failed to get asr_wifi_config.ini, with error: -2!
[   10.037364] asr-platform asr-platform.0: asr_sdio_init_config get ioport is 10000
[   10.045057] asr-platform asr-platform.0: asr_cmd_mgr_init
[   10.053773] asrsdio mmc1:0001:1: asr_plat_lmac_load: driver_mode=0,filename=fmacfw_asr5505.bin.
[   10.086253] asr-platform asr-platform.0: card power_up send!
[   10.115601] asr-platform asr-platform.0: card int check:0 cnt:1
[   10.121570] asr-platform asr-platform.0: ### Now copy fmacfw_asr5505.bin firmware,size is 123968
[   10.131175] asr-platform asr-platform.0: poll_card_status reg_val:0x9 mask:0x9
[   10.138500] asr-platform asr-platform.0: asr_sdio_send_header_firmware blk_size:1024 total_len:124416 pad_len:0 headers: 0x1e440-0x400-0x7a
[   10.153466] asr-platform asr-platform.0: poll_card_status reg_val:0x9 mask:0x9
[   10.163141] asr-platform asr-platform.0: poll_card_status reg_val:0x9 mask:0x9
......
[   11.884123] asr-platform asr-platform.0: asr_cfg80211_init: driver_mode=0.
[   11.925606] asr-platform asr-platform.0: poll_card_status reg_val:0x9 mask:0x8
[   11.932847] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 0,0,len=128
[   11.943943] asr-platform asr-platform.0: asr_rx_handle_msg MM_RESET_CFM             T:0 - I:1 0->11 l:0
[   11.953606] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 0,4,len=128
[   11.962951] asr-platform asr-platform.0: asr_rx_handle_msg MM_VERSION_CFM           T:0 - I:5 0->11 l:24
[   11.972698] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 0,94,len=128
[   11.983358] asr-platform asr-platform.0: asr_rx_handle_msg MM_FW_SOFTVERSION_CFM    T:0 - I:95 0->11 l:32
[   11.993606] asr-platform asr-platform.0: ASR: fw version(ASRv2.1.11_20240927_18d1c6f6ASR)
[   12.001903] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 0,106,len=128
[   12.011087] asr-platform asr-platform.0: asr_rx_handle_msg MM_GET_INFO_CFM          T:0 - I:107 0->11 l:12
[   12.020948] asr-platform asr-platform.0: asr_read_mm_info:vif_num=2,sta_num=5
[   12.028187] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 0,96,len=128
[   12.038437] asr-platform asr-platform.0: asr_rx_handle_msg MM_FW_MAC_ADDR_CFM       T:0 - I:97 0->11 l:7
[   12.048615] asr-platform asr-platform.0: ASR: read mac from fw(C0:4B:24:31:3B:67)
[   12.056211] asr-platform asr-platform.0: mac address is C0:4B:24:31:3B:67
[   12.063015] ieee80211 phy0: PHY features: [NSS=1][CHBW=40]
[   12.068550] ieee80211 phy0: FW features: [BCN][AUTOBCN][HWSCAN][CMON][MROLE][PS][DPSM][AMPDU][CHNL_CTXT][REORD][UMAC][MFP]
[   12.079660] asr-platform asr-platform.0: HT supp 1
[   12.084475] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 5,0,len=128
[   12.096006] asr-platform asr-platform.0: asr_rx_handle_msg ME_CONFIG_CFM            T:5 - I:1 5->11 l:0
[   12.106249] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 5,2,len=384
[   12.118186] asr-platform asr-platform.0: asr_rx_handle_msg ME_CHAN_CONFIG_CFM       T:5 - I:3 5->11 l:0
[   12.127858] asr-platform asr-platform.0: asr_sdio_send_data: tx msg 5,2,len=384
[   12.137159] asr-platform asr-platform.0: asr_rx_handle_msg ME_CHAN_CONFIG_CFM       T:5 - I:3 5->11 l:0
[   12.149617] asr-platform asr-platform.0: asr_netdev_setup maxheadroom 52, tailroom len=128
[   12.171111] ieee80211 phy0: New interface create wlan0
STA 模式测试
  1. 网络连接。

    本文使用 wpa_supplicant 工具进行测试。先将 WiFi 信息写入 wpa_supplicant.conf 文件,然后用工具加入 WiFi,这是基于已知 WiFi 账号密码的情况下进行测试。更多 wpa_supplicant 工具使用方法,请查阅官方相关文档。
    touch /tmp/wpa_supplicant.conf
    wpa_passphrase my-test 12345678 > /tmp/wpa_supplicant.conf
    wpa_supplicant -B -d -i wlan0 -c /tmp/wpa_supplicant.conf
    udhcpc -i wlan0
    
  2. 网络通信测试。

    执行完上述命令后,可看见路由分配了相应的 IP 地址给开发板。下面我们查看 IP 并测试与路由的通信情况。
    ifconfig
    lo        Link encap:Local Loopback
              inet addr:127.0.0.1  Mask:255.0.0.0
              UP LOOPBACK RUNNING  MTU:65536  Metric:1
              RX packets:0 errors:0 dropped:0 overruns:0 frame:0
              TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)
    
    wlan0     Link encap:Ethernet  HWaddr C0:4B:24:18:F9:5C
              inet addr:192.168.1.101  Bcast:192.168.1.255  Mask:255.255.255.0
              UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
              RX packets:8 errors:0 dropped:0 overruns:0 frame:0
              TX packets:4 errors:0 dropped:0 overruns:0 carrier:0
              collisions:0 txqueuelen:1000
              RX bytes:1761 (1.7 KiB)  TX bytes:876 (876.0 B)[aic@] # ping 192.168.1.1
    PING 192.168.1.1 (192.168.1.1): 56 data bytes
    [ 1311.689546] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x140b
    [ 1311.695761] AICWFDBG(LOGTRACE)   >>> rwnx_rx_me_tx_credits_update_ind()64 bytes from 192.168.1.1: seq=0 ttl=64 time=28.158 ms
    64 bytes from 192.168.1.1: seq=1 ttl=64 time=12.183 ms
    64 bytes from 192.168.1.1: seq=2 ttl=64 time=5.197 ms
    64 bytes from 192.168.1.1: seq=3 ttl=64 time=3.283 ms
    64 bytes from 192.168.1.1: seq=4 ttl=64 time=6.780 ms
    64 bytes from 192.168.1.1: seq=5 ttl=64 time=1.269 ms
    64 bytes from 192.168.1.1: seq=6 ttl=64 time=12.256 ms
    64 bytes from 192.168.1.1: seq=7 ttl=64 time=1.715 ms
    
  3. 性能测试。

    使用 iperf3 工具进行测试,可以用其他 PC 或 开发板创建服务器,本开发板当客户端进行收发测试。
    # iperf3 -c 192.168.1.102
    Connecting to host 192.168.1.102, port 5201[  5] local 192.168.1.101 port 43004 connected to 192.168.1.102 port 5201[ ID] Interval           Transfer     Bitrate         Retr  Cwnd
    [  5]   0.00-1.00   sec  5.02 MBytes  42.1 Mbits/sec    0    218 KBytes
    [  5]   1.00-2.00   sec  5.03 MBytes  42.2 Mbits/sec    0    218 KBytes
    [  5]   2.00-3.00   sec  4.97 MBytes  41.7 Mbits/sec    0    218 KBytes
    [  5]   3.00-4.00   sec  5.03 MBytes  42.2 Mbits/sec    0    218 KBytes
    [  5]   4.00-5.00   sec  5.03 MBytes  42.2 Mbits/sec    0    218 KBytes
    [  5]   5.00-6.00   sec  5.28 MBytes  44.3 Mbits/sec    0    218 KBytes
    [  5]   6.00-7.00   sec  4.85 MBytes  40.7 Mbits/sec    0    218 KBytes
    [  5]   7.00-8.00   sec  5.22 MBytes  43.8 Mbits/sec    0    218 KBytes
    [  5]   8.00-9.00   sec  5.03 MBytes  42.2 Mbits/sec    0    218 KBytes
    [  5]   9.00-10.00  sec  5.03 MBytes  42.2 Mbits/sec    0    218 KBytes
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-10.00  sec  50.5 MBytes  42.4 Mbits/sec    0             sender
    [  5]   0.00-10.00  sec  50.1 MBytes  42.0 Mbits/sec                  receiver
    
    iperf Done.
    [aic@] # iperf3 -c 192.168.1.102 -R
    Connecting to host 192.168.1.102, port 5201
    Reverse mode, remote host 192.168.1.102 is sending
    [  5] local 192.168.1.101 port 43008 connected to 192.168.1.102 port 5201[ ID] Interval           Transfer     Bitrate
    [  5]   0.00-1.00   sec  3.69 MBytes  30.9 Mbits/sec
    [  5]   1.00-2.00   sec  4.99 MBytes  41.9 Mbits/sec
    [  5]   2.00-3.00   sec  4.71 MBytes  39.5 Mbits/sec
    [  5]   3.00-4.00   sec  4.44 MBytes  37.2 Mbits/sec
    [  5]   4.00-5.00   sec  4.29 MBytes  36.0 Mbits/sec
    [  5]   5.00-6.00   sec  4.62 MBytes  38.8 Mbits/sec
    [  5]   6.00-7.00   sec  4.54 MBytes  38.0 Mbits/sec
    [  5]   7.00-8.00   sec  4.39 MBytes  36.8 Mbits/sec
    [  5]   8.00-9.00   sec  4.73 MBytes  39.7 Mbits/sec
    [  5]   9.00-10.00  sec  4.80 MBytes  40.3 Mbits/sec
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate
    [  5]   0.00-10.00  sec  45.2 MBytes  38.0 Mbits/sec                  sender
    [  5]   0.00-10.00  sec  45.2 MBytes  37.9 Mbits/sec                  receiver
    
    iperf Done.
AP 模式测试

AP 模式使用 hostapd 工具进行测试。此处提供两个配置文件,udhcpd.conf 与 hostapd.conf,分别用作 DHCP 与 AP 模式配置。

  1. hostapd.conf
    interface=wlan0
    ssid=ArtInChip-WiFI
    wpa=2
    wpa_passphrase=88888888
    wpa_key_mgmt=WPA-PSK
    channel=1
    rsn_pairwise=CCMP
    driver=nl80211
    logger_syslog=-1
    logger_syslog_level=2
    logger_stdout=-1
    logger_stdout_level=2
    dump_file=/tmp/hostapd.dump
    ctrl_interface=/var/run/hostapd
    ctrl_interface_group=0
    hw_mode=g
    beacon_int=100
    dtim_period=2
    max_num_sta=9
    rts_threshold=2347
    fragm_threshold=2346
    macaddr_acl=0
    auth_algs=3
    ignore_broadcast_ssid=0
    wmm_enabled=1
    wmm_ac_bk_cwmin=4
    wmm_ac_bk_cwmax=10
    wmm_ac_bk_aifs=7
    wmm_ac_bk_txop_limit=0
    wmm_ac_bk_acm=0
    wmm_ac_be_aifs=3
    wmm_ac_be_cwmin=4
    wmm_ac_be_cwmax=10
    wmm_ac_be_txop_limit=0
    wmm_ac_be_acm=0
    wmm_ac_vi_aifs=2
    wmm_ac_vi_cwmin=3
    wmm_ac_vi_cwmax=4
    wmm_ac_vi_txop_limit=94
    wmm_ac_vi_acm=0
    wmm_ac_vo_aifs=2
    wmm_ac_vo_cwmin=2
    wmm_ac_vo_cwmax=3
    wmm_ac_vo_txop_limit=47
    wmm_ac_vo_acm=0
    ieee80211n=1
    eapol_key_index_workaround=0
    own_ip_addr=127.0.0.1
  2. udhcpd.conf
    start 192.168.1.2
    end   192.168.1.254
    
    interface wlan0
  3. 在开发板中应用配置。
    hostapd -B -i wlan0 hostapd.conf
    ifconfig wlan0 192.168.1.1
    udhcpd dhcpd.conf
  4. 使用其他 PC 或者开发板连接生成的热点,然后使用 iperf3 进行网络测试。
    iperf3 -c 192.168.1.2
    Connecting to host 192.168.1.2, port 5201
    [  5] local 192.168.1.1 port 40220 connected to 192.168.1.2 port 5201
    [ 1231.932051] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1231.938137] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1231.972810] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1231.978920] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1232.050321] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1232.056396] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1232.073773] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ 1232.079898] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x49
    [ ID] Interval           Transfer     Bitrate         Retr  Cwnd
    [  5]   0.00-1.00   sec  4.48 MBytes  37.6 Mbits/sec    0    212 KBytes
    [  5]   1.00-2.00   sec  5.16 MBytes  43.2 Mbits/sec    0    212 KBytes
    [  5]   2.00-3.00   sec  5.41 MBytes  45.4 Mbits/sec    0    212 KBytes
    [  5]   3.00-4.00   sec  4.72 MBytes  39.6 Mbits/sec    0    212 KBytes
    [  5]   4.00-5.00   sec  4.41 MBytes  37.0 Mbits/sec    0    212 KBytes
    [  5]   5.00-6.00   sec  5.28 MBytes  44.3 Mbits/sec    0    212 KBytes
    [  5]   6.00-7.00   sec  5.16 MBytes  43.3 Mbits/sec    0    212 KBytes
    [  5]   7.00-8.00   sec  4.97 MBytes  41.7 Mbits/sec    0    212 KBytes
    [  5]   8.00-9.00   sec  5.03 MBytes  42.3 Mbits/sec    0    212 KBytes
    [  5]   9.00-10.00  sec  4.78 MBytes  40.1 Mbits/sec    0    212 KBytes
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate         Retr
    [  5]   0.00-10.00  sec  49.4 MBytes  41.4 Mbits/sec    0             sender
    [  5]   0.00-10.00  sec  49.0 MBytes  41.1 Mbits/sec                  receiver
    
    iperf Done.
    iperf3 -c 192.168.1.2 -R
    Connecting to host 192.168.1.2, port 5201
    Reverse mode, remote host 192.168.1.2 is sending
    [  5] local 192.168.1.1 port 40224 connected to 192.168.1.2 port 5201
    [ ID] Interval           Transfer     Bitrate
    [  5]   0.00-1.00   sec  1.01 MBytes  8.43 Mbits/sec
    [  5]   1.00-2.00   sec  1.23 MBytes  10.4 Mbits/sec
    [  5]   2.00-3.00   sec  3.28 MBytes  27.5 Mbits/sec
    [  5]   3.00-4.00   sec  3.38 MBytes  28.4 Mbits/sec
    [ 1255.405892] AICWFDBG(LOGTRACE)   >>> rwnx_cfg80211_change_beacon()
    [ 1255.411945] AICWFDBG(LOGTRACE)   rwnx_send_msg (7177)APM_SET_BEACON_IE_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0
    [ 1255.422584] AICWFDBG(LOGTRACE)   rwnx_cmd_malloc get cmd_array[0]:00000000e95e64c7
    [ 1255.431740] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x1c09
    [ 1255.439036] AICWFDBG(LOGTRACE)   rwnx_cmd_free cmd_array[0]:00000000e95e64c7
    [ 1255.446188] AICWFDBG(LOGTRACE)   >>> rwnx_send_bcn_change()
    [ 1255.451621] AICWFDBG(LOGTRACE)   rwnx_send_msg (64)MM_BCN_CHANGE_CFM reqcfm:1 in_irq:0 in_softirq:0 in_atomic:0
    [ 1255.461661] AICWFDBG(LOGTRACE)   rwnx_cmd_malloc get cmd_array[0]:00000000e95e64c7
    [ 1255.474005] AICWFDBG(LOGDEBUG)   rwnx_rx_handle_msg msg->id:0x40
    [ 1255.480828] AICWFDBG(LOGTRACE)   rwnx_cmd_free cmd_array[0]:00000000e95e64c7
    [  5]   4.00-5.00   sec  1.05 MBytes  8.78 Mbits/sec
    [  5]   5.00-6.00   sec   775 KBytes  6.35 Mbits/sec
    [  5]   6.00-7.00   sec  1.12 MBytes  9.36 Mbits/sec
    [  5]   7.00-8.00   sec   976 KBytes  7.99 Mbits/sec
    [  5]   8.00-9.00   sec  1.17 MBytes  9.84 Mbits/sec
    [  5]   9.00-10.00  sec  1.73 MBytes  14.5 Mbits/sec
    - - - - - - - - - - - - - - - - - - - - - - - - -
    [ ID] Interval           Transfer     Bitrate
    [  5]   0.00-10.00  sec  15.9 MBytes  13.3 Mbits/sec                  sender
    [  5]   0.00-10.00  sec  15.7 MBytes  13.1 Mbits/sec                  receiver
    
    iperf Done.