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 写点代码,写点人生!
评论
  • 嘿,咱来聊聊RISC-V MCU技术哈。 这RISC-V MCU技术呢,简单来说就是基于一个叫RISC-V的指令集架构做出的微控制器技术。RISC-V这个啊,2010年的时候,是加州大学伯克利分校的研究团队弄出来的,目的就是想搞个新的、开放的指令集架构,能跟上现代计算的需要。到了2015年,专门成立了个RISC-V基金会,让这个架构更标准,也更好地推广开了。这几年啊,这个RISC-V的生态系统发展得可快了,好多公司和机构都加入了RISC-V International,还推出了不少RISC-V
    丙丁先生 2025-01-21 12:10 112浏览
  • Ubuntu20.04默认情况下为root账号自动登录,本文介绍如何取消root账号自动登录,改为通过输入账号密码登录,使用触觉智能EVB3568鸿蒙开发板演示,搭载瑞芯微RK3568,四核A55处理器,主频2.0Ghz,1T算力NPU;支持OpenHarmony5.0及Linux、Android等操作系统,接口丰富,开发评估快人一步!添加新账号1、使用adduser命令来添加新用户,用户名以industio为例,系统会提示设置密码以及其他信息,您可以根据需要填写或跳过,命令如下:root@id
    Industio_触觉智能 2025-01-17 14:14 122浏览
  •     IPC-2581是基于ODB++标准、结合PCB行业特点而指定的PCB加工文件规范。    IPC-2581旨在替代CAM350格式,成为PCB加工行业的新的工业规范。    有一些免费软件,可以查看(不可修改)IPC-2581数据文件。这些软件典型用途是工艺校核。    1. Vu2581        出品:Downstream     
    电子知识打边炉 2025-01-22 11:12 55浏览
  •  万万没想到!科幻电影中的人形机器人,正在一步步走进我们人类的日常生活中来了。1月17日,乐聚将第100台全尺寸人形机器人交付北汽越野车,再次吹响了人形机器人疯狂进厂打工的号角。无独有尔,银河通用机器人作为一家成立不到两年时间的创业公司,在短短一年多时间内推出革命性的第一代产品Galbot G1,这是一款轮式、双臂、身体可折叠的人形机器人,得到了美团战投、经纬创投、IDG资本等众多投资方的认可。作为一家成立仅仅只有两年多时间的企业,智元机器人也把机器人从梦想带进了现实。2024年8月1
    刘旷 2025-01-21 11:15 399浏览
  • 数字隔离芯片是一种实现电气隔离功能的集成电路,在工业自动化、汽车电子、光伏储能与电力通信等领域的电气系统中发挥着至关重要的作用。其不仅可令高、低压系统之间相互独立,提高低压系统的抗干扰能力,同时还可确保高、低压系统之间的安全交互,使系统稳定工作,并避免操作者遭受来自高压系统的电击伤害。典型数字隔离芯片的简化原理图值得一提的是,数字隔离芯片历经多年发展,其应用范围已十分广泛,凡涉及到在高、低压系统之间进行信号传输的场景中基本都需要应用到此种芯片。那么,电气工程师在进行电路设计时到底该如何评估选择一
    华普微HOPERF 2025-01-20 16:50 73浏览
  • 日前,商务部等部门办公厅印发《手机、平板、智能手表(手环)购新补贴实施方案》明确,个人消费者购买手机、平板、智能手表(手环)3类数码产品(单件销售价格不超过6000元),可享受购新补贴。每人每类可补贴1件,每件补贴比例为减去生产、流通环节及移动运营商所有优惠后最终销售价格的15%,每件最高不超过500元。目前,京东已经做好了承接手机、平板等数码产品国补优惠的落地准备工作,未来随着各省市关于手机、平板等品类的国补开启,京东将第一时间率先上线,满足消费者的换新升级需求。为保障国补的真实有效发放,基于
    华尔街科技眼 2025-01-17 10:44 221浏览
  •  光伏及击穿,都可视之为 复合的逆过程,但是,复合、光伏与击穿,不单是进程的方向相反,偏置状态也不一样,复合的工况,是正偏,光伏是零偏,击穿与漂移则是反偏,光伏的能源是外来的,而击穿消耗的是结区自身和电源的能量,漂移的载流子是 客席载流子,须借外延层才能引入,客席载流子 不受反偏PN结的空乏区阻碍,能漂不能漂,只取决于反偏PN结是否处于外延层的「射程」范围,而穿通的成因,则是因耗尽层的过度扩张,致使跟 端子、外延层或其他空乏区 碰触,当耗尽层融通,耐压 (反向阻断能力) 即告彻底丧失,
    MrCU204 2025-01-17 11:30 182浏览
  • 临近春节,各方社交及应酬也变得多起来了,甚至一月份就排满了各式约见。有的是关系好的专业朋友的周末“恳谈会”,基本是关于2025年经济预判的话题,以及如何稳定工作等话题;但更多的预约是来自几个客户老板及副总裁们的见面,他们为今年的经济预判与企业发展焦虑而来。在聊天过程中,我发现今年的聊天有个很有意思的“点”,挺多人尤其关心我到底是怎么成长成现在的多领域风格的,还能掌握一些经济趋势的分析能力,到底学过哪些专业、在企业管过哪些具体事情?单单就这个一个月内,我就重复了数次“为什么”,再辅以我上次写的:《
    牛言喵语 2025-01-22 17:10 41浏览
  • 现在为止,我们已经完成了Purple Pi OH主板的串口调试和部分配件的连接,接下来,让我们趁热打铁,完成剩余配件的连接!注:配件连接前请断开主板所有供电,避免敏感电路损坏!1.1 耳机接口主板有一路OTMP 标准四节耳机座J6,具备进行音频输出及录音功能,接入耳机后声音将优先从耳机输出,如下图所示:1.21.2 相机接口MIPI CSI 接口如上图所示,支持OV5648 和OV8858 摄像头模组。接入摄像头模组后,使用系统相机软件打开相机拍照和录像,如下图所示:1.3 以太网接口主板有一路
    Industio_触觉智能 2025-01-20 11:04 150浏览
  • 本文介绍瑞芯微开发板/主板Android配置APK默认开启性能模式方法,开启性能模式后,APK的CPU使用优先级会有所提高。触觉智能RK3562开发板演示,搭载4核A53处理器,主频高达2.0GHz;内置独立1Tops算力NPU,可应用于物联网网关、平板电脑、智能家居、教育电子、工业显示与控制等行业。源码修改修改源码根目录下文件device/rockchip/rk3562/package_performance.xml并添加以下内容,注意"+"号为添加内容,"com.tencent.mm"为AP
    Industio_触觉智能 2025-01-17 14:09 164浏览
  • 2024年是很平淡的一年,能保住饭碗就是万幸了,公司业绩不好,跳槽又不敢跳,还有一个原因就是老板对我们这些员工还是很好的,碍于人情也不能在公司困难时去雪上加霜。在工作其间遇到的大问题没有,小问题还是有不少,这里就举一两个来说一下。第一个就是,先看下下面的这个封装,你能猜出它的引脚间距是多少吗?这种排线座比较常规的是0.6mm间距(即排线是0.3mm间距)的,而这个规格也是我们用得最多的,所以我们按惯性思维来看的话,就会认为这个座子就是0.6mm间距的,这样往往就不会去细看规格书了,所以这次的运气
    wuliangu 2025-01-21 00:15 186浏览
  • 高速先生成员--黄刚这不马上就要过年了嘛,高速先生就不打算给大家上难度了,整一篇简单但很实用的文章给大伙瞧瞧好了。相信这个标题一出来,尤其对于PCB设计工程师来说,心就立马凉了半截。他们辛辛苦苦进行PCB的过孔设计,高速先生居然说设计多大的过孔他们不关心!另外估计这时候就跳出很多“挑刺”的粉丝了哈,因为翻看很多以往的文章,高速先生都表达了过孔孔径对高速性能的影响是很大的哦!咋滴,今天居然说孔径不关心了?别,别急哈,听高速先生在这篇文章中娓娓道来。首先还是要对各位设计工程师的设计表示肯定,毕竟像我
    一博科技 2025-01-21 16:17 101浏览
我要评论
0
点击右上角,分享到朋友圈 我知道啦
请使用浏览器分享功能 我知道啦