RK3568外接AP6275SWIFI模块调试详解

一口Linux 2022-12-13 11:50
点击左上方蓝色“一口Linux”,选择“设为星标


第一时间看干货文章 

【干货】嵌入式驱动工程师学习路线
【干货】一个适合初学者的Linux物联网综合项目
【干货】Linux嵌入式知识点-思维导图-免费获取



 1

本文分享下RK3568外接AP6275S WIFI模块的调试方法。

AP6275S是一款集SDIO接口的WIFIUART/PCM接口的蓝牙功能为一体的无线模块。

一、RK3568 SDIO控制器

SDIO(Secure Digital Input and Output)即安全数字输入输出接口,定义了一种外设接口。

SDIO协议是由SD卡协议演进而来,向前兼容SD卡协议,并在此基础上增加了CMD52CMD53命令。

RK3568 SDIO接口特性如下:

1)兼容SDIO3.0协议

2)支持1/4bit模式下的SDIO中断

3)SDIO3.0支持4bit模式

4)支持 SDIO睡眠唤醒操作

5)支持 SDIO读等待操作

二、WIFI模块硬件连接

RK3568AP6275S WIFI模块之间的连接方式见下图:


RK3568 SDIO引脚电源域


RK3568 WIFI连接

注:

1)SDIO3.0 IO电压为1.8VSDIO2.0 IO电压为3.3V1.8V

2)SDMMC2_CLK_M0引脚不需要接上拉电阻。

3)SDMMC2_D0/1/2/3/CMD_M0电源域为VCCI06 Domain,需要在dts中正确配置。

4)WIFI模块的WL_REG_ONWL_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 = 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-frequencySDIO在该模式下支持的最大运行频率,单位HZ

注:根据不同的模式进行调整该值,注意和数据传输速率(Max Data Transfer rate,MB/s)区别。

supports-sdio:表示为SDIO功能,必须添加,否则无法正常初始化。

bus-widthSDIO使用4线模式。

cap-sd-highspeedhigh speed SDIO外设。

cap-sdio-irqWIFI模块是否支持SDIO中断。

keep-power-in-suspend:支持睡眠时不掉电,默认加入,WIFI模块默认有睡眠唤醒的需求。

pinctrl-namesSDIO控制器引脚。

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-pwrseqWIFI模块的的电源控制。对应连接到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_typeWIFI模块名称。

四、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 downifconfig 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通单板,从单板端不能pingPC,则需要关闭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模式运行,并指定serverIP地址。

-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断开。

作者:小田BSP

end


一口Linux 


关注,回复【1024】海量Linux资料赠送

精彩文章合集


文章推荐

【专辑】ARM
【专辑】粉丝问答
专辑linux入门
专辑计算机网络
专辑Linux驱动
【干货】嵌入式驱动工程师学习路线
【干货】Linux嵌入式所有知识点-思维导图

一口Linux 写点代码,写点人生!
评论
  • 遇到部分串口工具不支持1500000波特率,这时候就需要进行修改,本文以触觉智能RK3562开发板修改系统波特率为115200为例,介绍瑞芯微方案主板Linux修改系统串口波特率教程。温馨提示:瑞芯微方案主板/开发板串口波特率只支持115200或1500000。修改Loader打印波特率查看对应芯片的MINIALL.ini确定要修改的bin文件#查看对应芯片的MINIALL.ini cat rkbin/RKBOOT/RK3562MINIALL.ini修改uart baudrate参数修改以下目
    Industio_触觉智能 2024-12-03 11:28 112浏览
  • RDDI-DAP错误通常与调试接口相关,特别是在使用CMSIS-DAP协议进行嵌入式系统开发时。以下是一些可能的原因和解决方法: 1. 硬件连接问题:     检查调试器(如ST-Link)与目标板之间的连接是否牢固。     确保所有必要的引脚都已正确连接,没有松动或短路。 2. 电源问题:     确保目标板和调试器都有足够的电源供应。     检查电源电压是否符合目标板的规格要求。 3. 固件问题: &n
    丙丁先生 2024-12-01 17:37 114浏览
  • 最近几年,新能源汽车愈发受到消费者的青睐,其销量也是一路走高。据中汽协公布的数据显示,2024年10月,新能源汽车产销分别完成146.3万辆和143万辆,同比分别增长48%和49.6%。而结合各家新能源车企所公布的销量数据来看,比亚迪再度夺得了销冠宝座,其10月新能源汽车销量达到了502657辆,同比增长66.53%。众所周知,比亚迪是新能源汽车领域的重要参与者,其一举一动向来为外界所关注。日前,比亚迪汽车旗下品牌方程豹汽车推出了新车方程豹豹8,该款车型一上市就迅速吸引了消费者的目光,成为SUV
    刘旷 2024-12-02 09:32 140浏览
  • TOF多区传感器: ND06   ND06是一款微型多区高集成度ToF测距传感器,其支持24个区域(6 x 4)同步测距,测距范围远达5m,具有测距范围广、精度高、测距稳定等特点。适用于投影仪的无感自动对焦和梯形校正、AIoT、手势识别、智能面板和智能灯具等多种场景。                 如果用ND06进行手势识别,只需要经过三个步骤: 第一步&
    esad0 2024-12-04 11:20 109浏览
  • 作为优秀工程师的你,已身经百战、阅板无数!请先醒醒,新的项目来了,这是一个既要、又要、还要的产品需求,ARM核心板中一个处理器怎么能实现这么丰富的外围接口?踌躇之际,你偶阅此文。于是,“潘多拉”的魔盒打开了!没错,USB资源就是你打开新世界得钥匙,它能做哪些扩展呢?1.1  USB扩网口通用ARM处理器大多带两路网口,如果项目中有多路网路接口的需求,一般会选择在主板外部加交换机/路由器。当然,出于成本考虑,也可以将Switch芯片集成到ARM核心板或底板上,如KSZ9897、
    万象奥科 2024-12-03 10:24 96浏览
  • 戴上XR眼镜去“追龙”是种什么体验?2024年11月30日,由上海自然博物馆(上海科技馆分馆)与三湘印象联合出品、三湘印象旗下观印象艺术发展有限公司(下简称“观印象”)承制的《又见恐龙》XR嘉年华在上海自然博物馆重磅开幕。该体验项目将于12月1日正式对公众开放,持续至2025年3月30日。双向奔赴,恐龙IP撞上元宇宙不久前,上海市经济和信息化委员会等部门联合印发了《上海市超高清视听产业发展行动方案》,特别提到“支持博物馆、主题乐园等场所推动超高清视听技术应用,丰富线下文旅消费体验”。作为上海自然
    电子与消费 2024-11-30 22:03 109浏览
  • 光伏逆变器是一种高效的能量转换设备,它能够将光伏太阳能板(PV)产生的不稳定的直流电压转换成与市电频率同步的交流电。这种转换后的电能不仅可以回馈至商用输电网络,还能供独立电网系统使用。光伏逆变器在商业光伏储能电站和家庭独立储能系统等应用领域中得到了广泛的应用。光耦合器,以其高速信号传输、出色的共模抑制比以及单向信号传输和光电隔离的特性,在光伏逆变器中扮演着至关重要的角色。它确保了系统的安全隔离、干扰的有效隔离以及通信信号的精准传输。光耦合器的使用不仅提高了系统的稳定性和安全性,而且由于其低功耗的
    晶台光耦 2024-12-02 10:40 144浏览
  • 11-29学习笔记11-29学习笔记习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习笔记&记录学习习笔记&记学习学习笔记&记录学习学习笔记&记录学习习笔记&记录学习学习笔记&记录学习学习笔记记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&记录学习学习笔记&学习学习笔记&记录学习学习笔记&记录学习学习笔记&记
    youyeye 2024-12-02 23:58 94浏览
  • 当前,智能汽车产业迎来重大变局,随着人工智能、5G、大数据等新一代信息技术的迅猛发展,智能网联汽车正呈现强劲发展势头。11月26日,在2024紫光展锐全球合作伙伴大会汽车电子生态论坛上,紫光展锐与上汽海外出行联合发布搭载紫光展锐A7870的上汽海外MG量产车型,并发布A7710系列UWB数字钥匙解决方案平台,可应用于数字钥匙、活体检测、脚踢雷达、自动泊车等多种智能汽车场景。 联合发布量产车型,推动汽车智能化出海紫光展锐与上汽海外出行达成战略合作,联合发布搭载紫光展锐A7870的量产车型
    紫光展锐 2024-12-03 11:38 126浏览
  •         温度传感器的精度受哪些因素影响,要先看所用的温度传感器输出哪种信号,不同信号输出的温度传感器影响精度的因素也不同。        现在常用的温度传感器输出信号有以下几种:电阻信号、电流信号、电压信号、数字信号等。以输出电阻信号的温度传感器为例,还细分为正温度系数温度传感器和负温度系数温度传感器,常用的铂电阻PT100/1000温度传感器就是正温度系数,就是说随着温度的升高,输出的电阻值会增大。对于输出
    锦正茂科技 2024-12-03 11:50 143浏览
  • 概述 说明(三)探讨的是比较器一般带有滞回(Hysteresis)功能,为了解决输入信号转换速率不够的问题。前文还提到,即便使能滞回(Hysteresis)功能,还是无法解决SiPM读出测试系统需要解决的问题。本文在说明(三)的基础上,继续探讨为SiPM读出测试系统寻求合适的模拟脉冲检出方案。前四代SiPM使用的高速比较器指标缺陷 由于前端模拟信号属于典型的指数脉冲,所以下降沿转换速率(Slew Rate)过慢,导致比较器检出出现不必要的问题。尽管比较器可以使能滞回(Hysteresis)模块功
    coyoo 2024-12-03 12:20 170浏览
我要评论
0
点击右上角,分享到朋友圈 我知道啦
请使用浏览器分享功能 我知道啦