RK3568外接AP6275S WIFI模块调试详解
本文分享下RK3568
外接AP6275S WIFI
模块的调试方法。
AP6275S
是一款集SDIO
接口的WIFI
和UART/PCM
接口的蓝牙功能为一体的无线模块。
一、RK3568 SDIO控制器
SDIO(Secure Digital Input and Output)
即安全数字输入输出接口,定义了一种外设接口。
SDIO
协议是由SD
卡协议演进而来,向前兼容SD
卡协议,并在此基础上增加了CMD52
和CMD53
命令。
RK3568 SDIO
接口特性如下:
1)兼容SDIO3.0
协议
2)支持1/4bit
模式下的SDIO
中断
3)SDIO3.0
支持4bit
模式
4)支持 SDIO
睡眠唤醒操作
5)支持 SDIO
读等待操作
二、WIFI模块硬件连接
RK3568
和AP6275S WIFI
模块之间的连接方式见下图:
注:
1)SDIO3.0 IO
电压为1.8V
,SDIO2.0 IO
电压为3.3V
或1.8V
。
2)SDMMC2_CLK_M0
引脚不需要接上拉电阻。
3)SDMMC2_D0/1/2/3/CMD_M0
电源域为VCCI06 Domain
,需要在dts
中正确配置。
4)WIFI
模块的WL_REG_ON
和WL_HOST_WAKE
需要在dts
中正确配置。
5)AP6275S WIFI
模块需要外接32.768KHZ
晶振。
三、RK3568 SDIO和WIFI配置
1、RK3568 SDIO控制器配置
1)arch/arm64/boot/dts/rockchip/rk3568.dtsi
## RK3568 SDIO控制器配置
sdmmc2: dwmmc@fe000000 {
compatible = "rockchip,rk3568-dw-mshc",
"rockchip,rk3288-dw-mshc";
reg = <0x0 0xfe000000 0x0 0x4000>; ## SDIO寄存器基地址和映射大小
interrupts = <GIC_SPI 100 IRQ_TYPE_LEVEL_HIGH>; ## SDIO中断,对应RK3568 SPI 132(100+32)号中断
max-frequency = <150000000>; ## SDIO最大运行频率
clocks = <&cru HCLK_SDMMC2>, <&cru CLK_SDMMC2>, ## SDIO控制器时钟
<&cru SCLK_SDMMC2_DRV>, <&cru SCLK_SDMMC2_SAMPLE>;
clock-names = "biu", "ciu", "ciu-drive", "ciu-sample";
fifo-depth = <0x100>;
resets = <&cru SRST_SDMMC2>;
reset-names = "reset";
status = "disabled";
};
2)arch/arm64/boot/dts/rockchip/rk3568-firefly-port.dtsi
&sdmmc2 {
max-frequency = <150000000>;
supports-sdio;
bus-width = <4>;
disable-wp;
cap-sd-highspeed;
cap-sdio-irq;
keep-power-in-suspend;
pinctrl-names = "default";
pinctrl-0 = <&sdmmc2m0_bus4 &sdmmc2m0_cmd &sdmmc2m0_clk>;
sd-uhs-sdr104;
mmc-pwrseq = <&sdio_pwrseq>;
non-removable;
status = "disabled";
};
其中:
max-frequency
:SDIO
在该模式下支持的最大运行频率,单位HZ
。
注:根据不同的模式进行调整该值,注意和数据传输速率(Max Data Transfer rate,MB/s
)区别。
supports-sdio
:表示为SDIO
功能,必须添加,否则无法正常初始化。
bus-width
:SDIO
使用4线模式。
cap-sd-highspeed
:high speed SDIO
外设。
cap-sdio-irq
:WIFI
模块是否支持SDIO
中断。
keep-power-in-suspend
:支持睡眠时不掉电,默认加入,WIFI
模块默认有睡眠唤醒的需求。
pinctrl-names
:SDIO
控制器引脚。
sd-uhs-sdr104
:支持SDIO 3.0
。
注:SDIO 3.0
引脚电压必须为1.8V
。
&pmu_io_domains {
status = "okay";
...
vccio6-supply = <&vcc_1v8>; ## SDIO引脚电源域
...
};
WIFI
电源域vccio6-supply
配置为vcc_1v8
。
mmc-pwrseq
:WIFI
模块的的电源控制。对应连接到WIFI
模块的WL_REG_ON
引脚,必须配置,否则WIFI
模块无法正常初始化。
non-removable
:表示该卡槽为不可移动设备,必须添加。
2、WIFI配置
## 配置WL_REG_ON引脚
sdio_pwrseq: sdio-pwrseq {
compatible = "mmc-pwrseq-simple";
...
pinctrl-names = "default";
pinctrl-0 = <&wifi_enable_h>;
reset-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>;
};
## 配置WL_HOST_WAKE引脚,OOB模式时,该引脚必须配置
wireless_wlan: wireless-wlan {
compatible = "wlan-platdata";
rockchip,grf = <&grf>;
pinctrl-names = "default";
pinctrl-0 = <&wifi_host_wake_irq>;
WIFI,host_wake_irq = <&gpio3 RK_PD4 GPIO_ACTIVE_HIGH>;
status = "disabled";
};
AP WIFI模块最好使用OOB(Out-Of-Band)模式;如果使用In-Band模式,可能会遇到:在使用WIFI传输文件时,通信断开的问题。
3、使能SDIO和WIFI模块
arch/arm64/boot/dts/rockchip/rk3568-firefly-roc-pc.dtsi
&sdio_pwrseq {
status = "okay";
reset-gpios = <&gpio3 RK_PD5 GPIO_ACTIVE_LOW>;
post-power-on-delay-ms = <100>;
};
&sdmmc2 {
status = "okay";
};
&wireless_wlan {
wifi_chip_type = "ap6275s";
status = "okay";
};
注:
wifi_chip_type
:WIFI
模块名称。
四、RK3568 SDIO和WIFI驱动
1、RK3568 SDIO驱动
RK3568 SDIO
控制器使用Synopsys IP
。
RK3568
驱动文件:drivers/mmc/host/dw_mmc-rockchip.c
,主要关注:
static const struct dw_mci_drv_data rk3288_drv_data = {
.caps = dw_mci_rk3288_dwmmc_caps,
.num_caps = ARRAY_SIZE(dw_mci_rk3288_dwmmc_caps),
.set_ios = dw_mci_rk3288_set_ios,
.execute_tuning = dw_mci_rk3288_execute_tuning,
.parse_dt = dw_mci_rk3288_parse_dt,
.init = dw_mci_rockchip_init,
};
2、WIFI模块驱动
AP6275S WIFI
模块驱动路径:drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/
WIFI
模块OOB
中断配置:drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/Kconfig
choice
depends on BCMDHD && BCMDHD_SDIO
prompt "Interrupt type"
default BCMDHD_OOB
help
Interrupt type
config BCMDHD_OOB
depends on BCMDHD && BCMDHD_SDIO
bool "Out-of-Band Interrupt"
help
Interrupt from WL_HOST_WAKE.
config BCMDHD_SDIO_IRQ
depends on BCMDHD && BCMDHD_SDIO
bool "In-Band Interrupt"
help
Interrupt from SDIO DAT[1]
endchoice
drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/Makefile
MODULE_NAME := bcmdhd
CONFIG_BCMDHD_SDIO := y
CONFIG_BCMDHD_OOB := y
五、WIFI调试
5.1、 RK3568 SDIO驱动加载
在加载Linux
内核时,RK3568 SDIO
控制器驱动加载信息如下:
[ 0.962352] dwmmc_rockchip fe000000.dwmmc: IDMAC supports 32-bit address mode.
[ 0.963068] dwmmc_rockchip fe000000.dwmmc: Using internal DMA controller.
[ 0.963090] dwmmc_rockchip fe000000.dwmmc: Version ID is 270a
[ 0.963150] dwmmc_rockchip fe000000.dwmmc: DW MMC controller at irq 45,32 bit host data width,256 deep fifo
[ 0.963337] dwmmc_rockchip fe000000.dwmmc: allocated mmc-pwrseq
5.2、查看RK3568 SDIO属性
[root@xiaotianbsp:/sys/kernel/debug/mmc3]# cat ios
clock: 100000000 Hz
actual clock: 50000000 Hz
vdd: 21 (3.3 ~ 3.4 V)
bus mode: 2 (push-pull)
chip select: 0 (don't care)
power mode: 2 (on)
bus width: 2 (4 bits) ## SDIO数据位宽
timing spec: 6 (sd uhs SDR104) ## SDIO速度模式
signal voltage: 1 (1.80 V) ## SDIO引脚电平
driver type: 0 (driver type B)
5.3、查看WIFI节点
WIFI
模块初始化成功后,会出现wlan0
节点。
[root@xiaotianbsp:/]# ifconfig
...
wlan0 Link encap:Ethernet HWaddr 10:2C:xx:xx:xx:xx
inet addr:169.254.26.98 Bcast:169.254.255.255 Mask:255.255.0.0
inet6 addr: fe80::2dfc:f254:5101:95f8/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:0 errors:0 dropped:0 overruns:0 frame:0
TX packets:23 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:0 (0.0 B) TX bytes:4059 (3.9 KiB)
5.4、打开WIFI
打开WIFI
时,日志如下:
[root@xiaotianbsp:/]# ifconfig wlan0 up
[ 405.513485] dhd_open: Enter wlan0
[ 405.513522] dhd_open : no mutex held. set lock
[ 405.513536]
[ 405.513536] Dongle Host Driver, version 100.10.545.9 (r826445-20200316-8)
[ 405.513557] [dhd-wlan0] wl_android_wifi_on : in g_wifi_on=0
[ 405.513565] wifi_platform_set_power = 1, delay: 200 msec
[ 405.513588] ======== PULL WL_REG_ON(-1) HIGH! ========
[ 405.513601] [WLAN_RFKILL]: rockchip_wifi_power: 1
[ 405.513612] [WLAN_RFKILL]: rockchip_wifi_power: toggle = false
[ 405.513624] [WLAN_RFKILL]: wifi turn on power [GPIO-1-0]
[ 405.818656] sdio_reset_comm():
[ 405.938727] mmc_host mmc3: Bus speed (slot 0) = 375000Hz (slot req 400000Hz, actual 375000HZ div = 0)
[ 405.955841] mmc_host mmc3: Bus speed (slot 0) = 375000Hz (slot req 100000Hz, actual 93750HZ div = 2)
[ 405.973628] mmc_host mmc3: Bus speed (slot 0) = 375000Hz (slot req 375000Hz, actual 375000HZ div = 0)
[ 405.988219] mmc3: queuing unknown CIS tuple 0x80 (2 bytes)
[ 405.990388] mmc3: queuing unknown CIS tuple 0x80 (3 bytes)
[ 405.992435] mmc3: queuing unknown CIS tuple 0x80 (3 bytes)
[ 405.996773] mmc3: queuing unknown CIS tuple 0x80 (7 bytes)
[ 406.101352] mmc_host mmc3: Bus speed (slot 0) = 50000000Hz (slot req 100000000Hz, actual 50000000HZ div = 0)
[ 406.116274] dwmmc_rockchip fe000000.dwmmc: Successfully tuned phase to 348
[ 406.116438] sdioh_start: set sd_f2_blocksize 256
[ 406.117013] dhd_bus_devreset: == Power ON ==
[ 406.117231] F1 signature read @0x18000000=0x1042aae8
[ 406.124901] F1 signature OK, socitype:0x1 chip:0xaae8 rev:0x2 pkg:0x4
[ 406.126138] DHD: dongle ram size is set to 1310720(orig 1310720) at 0x170000
[ 406.126276] dhd_bus_devreset: making DHD_BUS_DOWN
[ 406.126376] dhdsdio_probe_init: making DHD_BUS_DOWN
[ 406.126665] [dhd] dhd_conf_read_config : Ignore config file /vendor/etc/firmware/config.txt
[ 406.126723] [dhd] dhd_conf_set_path_params : Final fw_path=/vendor/etc/firmware/fw_bcm43752a2_ag.bin
[ 406.126742] [dhd] dhd_conf_set_path_params : Final nv_path=/vendor/etc/firmware/nvram_ap6275s.txt
[ 406.126757] [dhd] dhd_conf_set_path_params : Final clm_path=/vendor/etc/firmware/clm_bcm43752a2_ag.blob
[ 406.126777] [dhd] dhd_conf_set_path_params : Final conf_path=/vendor/etc/firmware/config.txt
[ 406.127377] dhd_os_open_image1: /vendor/etc/firmware/fw_bcm43752a2_ag.bin (743607 bytes) open success
[ 406.264024] dhd_os_open_image1: /vendor/etc/firmware/nvram_ap6275s.txt (8361 bytes) open success
[ 406.264122] NVRAM version: AP6275S_NVRAM_V1.2.1_20200311
[ 406.265835] dhdsdio_write_vars: Download, Upload and compare of NVRAM succeeded.
[ 406.327008] dhd_bus_init: enable 0x06, ready 0x06 (waited 0us)
[ 406.327414] bcmsdh_oob_intr_register: HW_OOB irq=113 flags=0x4
[ 406.328627] get_mem_val_from_file: File [/data/misc/wifi/.memdump.info] doesn't exist
[ 406.328655] dhd_get_memdump_info: MEMDUMP ENABLED = 3
[ 406.330645] dhd_tcpack_suppress_set: TCP ACK Suppress mode 0 -> mode 1
[ 406.333701] dhd_os_open_image1: /vendor/etc/firmware/clm_bcm43752a2_ag.blob (28865 bytes) open success
[ 406.335142] dhd_check_current_clm_data: ----- This FW is not included CLM data -----
[ 406.371248] dhd_check_current_clm_data: ----- This FW is included CLM data -----
[ 406.375300] Firmware up: op_mode=0x0005, MAC=10:2c:6b:7f:a1:e0
[ 406.385020] dhd_preinit_ioctls: event_log_max_sets: 26 ret: 0
[ 406.414727] Driver: 100.10.545.9 (r826445-20200316-8)
[ 406.414727] Firmware: wl0: Jul 13 2020 18:32:45 version 18.35.387.23.7 (b328500@shgit) (wlan=r880297) FWID 01-f50fdff0
[ 406.414727] CLM: 9.9.5_SS (2019-12-04 01:26:12)
[ 406.418036] dhd_txglom_enable: enable 1
[ 406.418097] [dhd] dhd_conf_set_txglom_params : txglom_mode=copy
[ 406.418123] [dhd] dhd_conf_set_txglom_params : txglomsize=36, deferred_tx_len=0
[ 406.418145] [dhd] dhd_conf_set_txglom_params : txinrx_thres=128, dhd_txminmax=-1
[ 406.418166] [dhd] dhd_conf_set_txglom_params : tx_max_offset=0, txctl_tmo_fix=300
[ 406.418203] [dhd] dhd_conf_get_disable_proptx : fw_proptx=1, disable_proptx=-1
[ 406.424486] dhd_wlfc_hostreorder_init(): successful bdcv2 tlv signaling, 64
[ 406.430395] dhd_pno_init: Support Android Location Service
[ 406.457125] rtt_do_get_ioctl: failed to send getbuf proxd iovar (CMD ID : 1), status=-23
[ 406.457203] dhd_rtt_init : FTM is not supported
[ 406.458183] dhd_rtt_ftm_config : failed to set config
[ 406.463334] dhd_ecounter_autoconfig Ecounter autoconfig in FW not supported
[ 406.464525] failed to start ecounters
[ 406.464589] dhd_ecounter_configure Ecounters start failed
[ 406.473894] [INIT] logset:8 is preserve/chatty
[ 406.476035] [INIT] logset:10 is preserve/chatty
[ 406.492804] [dhd] dhd_conf_set_country : set country CN, revision 0
[ 406.498223] [dhd] dhd_conf_set_country : Country code: CN (CN/0)
[ 406.510819] [dhd-wlan0] wl_android_wifi_on : Success
[ 406.565995] dhd_open : the lock is released.
[ 406.566020] dhd_open: Exit wlan0 ret=0
[ 406.566028] [wlan0] tx queue started
打开WIFI
时,如果没有正确配置上电引脚WL_REG_ON
,会出现WIFI
模块初始化失败,日志如下:
[ 1.236141] dhd_module_init: in Dongle Host Driver, version 100.10.545.9 (r826445-20200316-8)
[ 1.236163] ======== dhd_wlan_init_plat_data ========
[ 1.236174] [WLAN_RFKILL]: rockchip_wifi_get_oob_irq: Enter
[ 1.236229] dhd_wlan_init_gpio: WL_HOST_WAKE=-1, oob_irq=113, oob_irq_flags=0x414
[ 1.236236] dhd_wlan_init_gpio: WL_REG_ON=-1
[ 1.236242] dhd_wifi_platform_load: Enter
[ 1.236248] Power-up adapter 'DHD generic adapter'
[ 1.236286] wifi_platform_set_power = 1, delay: 200 msec
[ 1.236298] ======== PULL WL_REG_ON(-1) HIGH! ========
[ 1.236308] [WLAN_RFKILL]: rockchip_wifi_power: 1
[ 1.236317] [WLAN_RFKILL]: rockchip_wifi_power: toggle = false
[ 1.236326] [WLAN_RFKILL]: wifi turn on power [GPIO-1-0]
[ 1.312616] devfreq fde60000.gpu: Couldn't update frequency transition information.
[ 1.542011] wifi_platform_bus_enumerate device present 1
[ 1.542053] ======== Card detection to detect SDIO card! ========
[ 1.542079] mmc3:mmc host rescan start!
[ 2.457697] phy phy-fe8a0000.usb2-phy.6: charger = USB_SDP_CHARGER
[ 3.358562] fusb302 0-0022: PD disabled
[ 3.688850] failed to power up DHD generic adapter, 0 retry left
[ 3.704991] wifi_platform_set_power = 0, delay: 0 msec
[ 3.705005] ======== PULL WL_REG_ON(-1) LOW! ========
[ 3.705010] [WLAN_RFKILL]: rockchip_wifi_power: 0
[ 3.705016] [WLAN_RFKILL]: rockchip_wifi_power: toggle = false
[ 3.705022] [WLAN_RFKILL]: wifi shut off power [GPIO-1-1]
[ 3.705026] wifi_platform_bus_enumerate device present 0
[ 3.705031] ======== Card detection to remove SDIO card! ========
[ 3.705036] mmc3:mmc host rescan start!
[ 3.705041] failed to power up DHD generic adapter, max retry reached**
[ 3.705047] unregister wifi platform drivers
[ 3.705052] wifi_platform_bus_enumerate device present 0
[ 3.705056] ======== Card detection to remove SDIO card! ========
[ 3.705060] mmc3:mmc host rescan start!
[ 3.705064] ======== dhd_wlan_deinit_plat_data ========
[ 3.705070] dhd_module_init: Failed to load the driver, try cnt 0
[ 3.705117] dhd_module_init: Failed to load driver max retry reached**
[ 3.705127] dhd_module_init: Exit err=-19
5.5、WIFI映像
打开WIFI
时,会加载/vendor/etc/firmware/
下WIFI
模块的映像。如果WIFI
模块映像不存在,也会导致WIFI
打开失败。
[root@xiaotianbsp:/]# cd /vendor/etc/firmware/
[root@xiaotianbsp:/vendor/etc/firmware]# ls
BCM4362A2.hcd fw_bcm43752a2_ag_apsta.bin nvram_ap6275s.txt
clm_bcm43752a2_ag.blob fw_bcm43752a2_ag_mfg.bin
fw_bcm43752a2_ag.bin nvram.txt
WIFI
模块映像配置文件:drivers/net/wireless/rockchip_wlan/rkwifi/bcmdhd_wifi6/Kconfig
config BCMDHD_FW_PATH
depends on BCMDHD
string "Firmware path"
default "/vendor/etc/firmware/fw_bcmdhd.bin"
help
Path to the firmware file.
config BCMDHD_NVRAM_PATH
depends on BCMDHD
string "NVRAM path"
default "/vendor/etc/firmware/nvram.txt"
help
Path to the calibration file.
5.6、32.768KHZ晶振
如果AP6275S WIFI
模块没有外接32.768KHZ
晶振,WIFI
模块驱动加载时会出现:
[ 12.077762] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[ 12.077810] dhd_bus_init: clock state is wrong. state = 1
[ 12.278468] dhdsdio_htclk: HT Avail timeout (1000000): clkctl 0x50
[ 12.286051] dhd_bus_stop: making DHD_BUS_DOWN
此时,需要做两次ifconfig wlan0 down
和ifconfig wlan0 up
操作才能正常打开WIFI
。
5.7、WIFI通信失败
如果在使用WIFI
传输文件时,提示如下错误,则需要考虑SDIO
引脚驱动电流强度。
[ 109.361499] [dhd] sdioh_request_packet_chain: TX FAILED 00000000928ce921[0], addr=0x08000, pkt_len=17920, ERR=-84
[ 109.461882] [dhd] sdioh_request_packet_chain: TX FAILED 000000005a564233[0], addr=0x08000, pkt_len=17408, ERR=-84
[ 109.506734] [dhd] bcmsdh_sdmmc: Failed to Read byte F1:@0x1000e=ff, Err: -5
[ 109.507793] [dhd] bcmsdh_sdmmc: Failed to Read byte F1:@0x1000e=ff, Err: -5
[ 109.510452] [dhd] bcmsdh_sdmmc: Failed to Read byte F1:@0x1000e=ff, Err: -5
5.8、配置WIFI网络
可通过如下命令连接网络。
## TP-LINK:SSID; 12345678:密码。
wpa_passphrase "TP-LINK" "12345678" /etc/wpa_supplicant
##生成的psk,配置到/etc/wpa_supplicant.conf中
wpa_supplicant -i wlan0 -c /etc/wpa_supplicant.conf -B
配置成脚本后,执行如下:
[root@xiaotianbsp:/]# wifi_start.sh "TP-LINK" "12345678"
connect to WiFi ssid: TP-LINK, Passwd: 12345678
killall: wpa_supplicant: no process killed
Successfully initialized wpa_supplicant
[ 31.473999] P2P interface registered
[ 31.474027] wl_cfgp2p_add_p2p_disc_if: wdev: 000000000c5ec882, wdev->net: (null)
[ 34.201611] [dhd-wlan0] wl_cfg80211_connect : Connecting with 54:xx:xx:xx:xx:xx ssid "TP-LINK", len (12), sec=wpa2psk/mfpn/aes, channel=153
[ 34.226004] dhd_dbg_start_pkt_monitor, 1622
[ 34.458621] [dhd-wlan0] wl_iw_event : Link UP with 54:xx:xx:xx:xx:xx
[ 34.458676] [dhd-wlan0] wl_ext_iapsta_event : [S] Link UP with 54:xx:xx:xx:xx:xx
[ 34.461832] [dhd-wlan0] wl_bss_connect_done : Report connect result - connection succeeded
[ 34.580969] [dhd-wlan0] wl_add_keyext : key index (0)
[root@xiaotianbsp:/]# ifconfig
...
wlan0 Link encap:Ethernet HWaddr 10:2C:xx:xx:xx:xx
inet addr:192.168.0.109 Bcast:192.168.0.255 Mask:255.255.255.0
inet6 addr: fe80::d4b6:3ff4:82a6:ff22/64 Scope:Link
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
RX packets:4 errors:0 dropped:0 overruns:0 frame:0
TX packets:35 errors:0 dropped:0 overruns:0 carrier:0
collisions:0 txqueuelen:1000
RX bytes:993 (993.0 B) TX bytes:3619 (3.5 KiB)
也可以用wpa_cli
命令进行WIFI
驱动相关测试。
5.9、ping单通
WIFI
配置成功后,可以通过ping
命令测试。如果从PC
端可以ping
通单板,从单板端不能ping
通PC
,则需要关闭PC
上的防火墙。
## PC防火墙已打开
[root@xiaotianbsp:/]# ping 192.168.0.107
PING 192.168.0.107 (192.168.0.107) 56(84) bytes of data.
^C
--- 192.168.0.107 ping statistics ---
3 packets transmitted, 0 received, 100% packet loss, time 2024ms
## PC防火墙已关闭
[root@xiaotianbsp:/]# ping 192.168.0.107
PING 192.168.0.107 (192.168.0.107) 56(84) bytes of data.
64 bytes from 192.168.0.107: icmp_seq=1 ttl=128 time=13.0 ms
64 bytes from 192.168.0.107: icmp_seq=2 ttl=128 time=13.9 ms
^C
--- 192.168.0.107 ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 13.089/13.499/13.910/0.426 ms
5.10、WIFI带宽测试
使用iperf3
命令,可以测试WIFI
网络带宽。方法如下:
PC
端(server
端)输入:
C:\Users\xiaotianbsp>iperf3 -s
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
Accepted connection from 192.168.0.109, port 51436
[ 5] local 192.168.0.107 port 5201 connected to 192.168.0.109 port 51438
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-1.00 sec 10.8 MBytes 90.4 Mbits/sec
[ 5] 1.00-2.00 sec 12.4 MBytes 104 Mbits/sec
[ 5] 2.00-3.00 sec 12.3 MBytes 103 Mbits/sec
[ 5] 3.00-4.00 sec 7.31 MBytes 61.0 Mbits/sec
[ 5] 4.00-5.00 sec 12.6 MBytes 106 Mbits/sec
[ 5] 5.00-6.00 sec 12.5 MBytes 105 Mbits/sec
[ 5] 6.00-7.00 sec 12.8 MBytes 107 Mbits/sec
[ 5] 7.00-8.00 sec 12.3 MBytes 103 Mbits/sec
[ 5] 8.00-9.00 sec 12.2 MBytes 103 Mbits/sec
[ 5] 9.00-10.00 sec 11.9 MBytes 99.6 Mbits/sec
[ 5] 10.00-10.05 sec 630 KBytes 116 Mbits/sec
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bandwidth
[ 5] 0.00-10.05 sec 0.00 Bytes 0.00 bits/sec sender
[ 5] 0.00-10.05 sec 118 MBytes 98.3 Mbits/sec receiver
-----------------------------------------------------------
Server listening on 5201
-----------------------------------------------------------
-s
:以server
模式运行。
单板端输入:
[root@xiaotianbsp:/]# iperf3 -c 192.168.0.107 -i 1 -t 10
Connecting to host 192.168.0.107, port 5201
[ 5] local 192.168.0.109 port 51438 connected to 192.168.0.107 port 5201
[ ID] Interval Transfer Bitrate Retr Cwnd
[ 5] 0.00-1.00 sec 11.8 MBytes 98.6 Mbits/sec 0 211 KBytes
[ 5] 1.00-2.00 sec 12.2 MBytes 102 Mbits/sec 0 211 KBytes
[ 5] 2.00-3.00 sec 12.6 MBytes 106 Mbits/sec 0 211 KBytes
[ 5] 3.00-4.00 sec 7.07 MBytes 59.4 Mbits/sec 2 211 KBytes
[ 5] 4.00-5.00 sec 12.7 MBytes 106 Mbits/sec 0 211 KBytes
[ 5] 5.00-6.00 sec 12.3 MBytes 103 Mbits/sec 0 211 KBytes
[ 5] 6.00-7.00 sec 12.8 MBytes 107 Mbits/sec 0 211 KBytes
[ 5] 7.00-8.00 sec 12.5 MBytes 105 Mbits/sec 0 211 KBytes
[ 5] 8.00-9.00 sec 12.1 MBytes 101 Mbits/sec 0 211 KBytes
[ 5] 9.00-10.00 sec 12.0 MBytes 101 Mbits/sec 0 211 KBytes
- - - - - - - - - - - - - - - - - - - - - - - - -
[ ID] Interval Transfer Bitrate Retr
[ 5] 0.00-10.00 sec 118 MBytes 99.0 Mbits/sec 2 sender
[ 5] 0.00-10.00 sec 118 MBytes 98.7 Mbits/sec receiver
iperf Done.
-c
:以client
模式运行,并指定server
端IP
地址。
-i
:每次报告的间隔时间,单位秒。
-t
:总测试时间,单位秒。
iperf3
下载路径:https://iperf.fr/iperf-download.php
5.11、关闭WIFI
关闭WIFI
时,日志如下:
[root@xiaotianbsp:/]# ifconfig wlan0 down
[ 401.324832] [wlan0] tx queue stopped
[ 401.324866] dhd_stop: Enter wlan0
[ 401.324874] dhd_stop: ######### dhd_stop called for ifidx=0 #########
[ 401.324884] dhd_stop: making dhdpub up FALSE
[ 401.333502] [dhd] CFGP2P-ERROR) wl_cfgp2p_disable_discovery : do nothing, not initialized
[ 401.334734] dhd_tcpack_suppress_set: TCP ACK Suppress mode 1 -> mode 0
[ 401.334758] [dhd-wlan0] wl_android_wifi_off : in g_wifi_on=1, on_failure=1
[ 401.335240] dhd_dbg_detach_pkt_monitor, 2100
[ 401.335256] dhd_bus_devreset: == Power OFF ==
[ 401.335526] dhd_bus_stop: making DHD_BUS_DOWN
[ 401.335590] bcmsdh_oob_intr_unregister: Enter
[ 401.335630] dhd_bus_devreset: making dhdpub up FALSE
[ 401.335648] dhd_txglom_enable: enable 0
[ 401.335661] dhd_bus_devreset: making DHD_BUS_DOWN
[ 401.335674] dhd_bus_devreset: WLAN OFF DONE
[ 401.335792] wifi_platform_set_power = 0, delay: 0 msec
[ 401.335814] ======== PULL WL_REG_ON(-1) LOW! ========
[ 401.335828] [WLAN_RFKILL]: rockchip_wifi_power: 0
[ 401.335851] [WLAN_RFKILL]: rockchip_wifi_power: toggle = false
[ 401.335864] [WLAN_RFKILL]: wifi shut off power [GPIO-1-1]
[ 401.335874] [dhd-wlan0] wl_android_wifi_off : out
[ 401.361919] dhd_stop: Exit wlan0
注:
1、上面调试方法也适用于其它一些APXXXX WIFI
模组。
2、在调试WIFI模块时,发现WIFI模块有时会进入睡眠模式,会导致ping包中time时间过长(例:超过200ms)或WIFI断开。
注:转载请注明作者。