AM335x添加WiFi模块WILC1000

基于TI 的PSDK的linux和文件系统添加wilc1000。sdk版本:ti-processor-sdk-linux-am335x-evm-06.03.00.106。

1.硬件连接

wilc1000    ----------------  am335x

RESET_N   --------------  GPMC_A6------------- gpio1_22

WAKE ----------------------GPMC_BEN1 ----------gpio1_28

IRQN -----------------------GPMC_CSN0 ----------gpio1_29

SDCLK---------------------MMC0_CLK

SD_CMD------------------MMC0_CMD

SD_DATA0-3-------------MMC0_DATA0-3

SDIO_SPI_CFG ----------接地 (P10的配置引脚,固定接地为SDIO通迅模式)

2.驱动库准备

基于linux内核4.xx.xx版本的源码:

Microchip ATWILC Wireless Devices · GitHubResources for using Microchip ATWILC Wireless Devices on Linux - Microchip ATWILC Wireless Deviceshttps://github.com/linux4wilc2.1 驱动源码添加

从上述源码仓库中下载Driver项目目录下的源码包并解压。

2.1.1 源码拷贝

将文件夹:wilc整个拷贝至linux源码目录中:ti-processor-sdk-linux-am335x-evm-06.03.00.106/board-support/linux-4.19.94+gitAUTOINC+be5389fd85-gbe5389fd85/drivers/staging

保留原wilc1000目录不去动它,两个平级。

2.1.2 修改MakeFile

修改staging目录下的MakeFile文件:

将  obj-$(CONFIG_WILC)        += wilc1000/ 改成 :obj-$(CONFIG_WILC)        += wilc/

2.1.3 修改Kconfig

修改staging目录下的Kconfig文件:

将source "drivers/staging/wilc1000/Kconfig"   改成:source "drivers/staging/wilc/Kconfig"

2.2 wifi固件拷贝

下载源码仓库中firmware项目目录的内容,并解压。

将mhcp文件夹拷贝至ti-processor-sdk-linux-am335x-evm-06.03.00.106/board-support/linux-4.19.94+gitAUTOINC+be5389fd85-gbe5389fd85/firmware。这步可能不需要,主要是看到wilc的驱动说明里说,新版本WIFI固件会编译进内核,所以先拷贝(其实最终,WIFI测试的时候,WIFI固件还是在测试时间动态发送给wifi模块然后再运行的)。

同时,将mhcp文件夹拷贝至根文件系统中:lib/firmware/

2.3 添加config配置

 我使用的是修改Ti的tisdk_am335x-evm_defconfig  文件,因为Ti的sdk编译使用menuconfig界面配置无效,最终会被内核编译时,make linux时,使用tisdk_am335x-evm_defconfig 内容替换。

 添加如下

CONFIG_WLAN_VENDOR_MCHP=y
CONFIG_WILC=m
CONFIG_WILC_SDIO=m

以上配置,参考WILC的驱动移植说明文档,在git里有下载链接。从后续测试情况看,CONFIG_WILC应该是y就行了,因为m也无法产生.ko模块。

其中WILC_SDIO依赖CFG80211 && INET && MMC,而所依赖的几项,原来已经配置过了。注意CFG80211,在WIFI测试的时候会讲。

2.4 添加设置树

添加如下:

mmc1_pins: pinmux_mmc1_pins {
		pinctrl-single,pins = <
			/* AM33XX_IOPAD(0x960, PIN_INPUT | MUX_MODE7)	*/ 	/* spio0_cs1.gpio0_6 */
			AM33XX_IOPAD(0x8fc, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat0.mmc0_dat0 */
			AM33XX_IOPAD(0x8f8, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat1.mmc0_dat1 */
			AM33XX_IOPAD(0x8f4, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat2.mmc0_dat2 */
			AM33XX_IOPAD(0x8f0, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_dat3.mmc0_dat3 */
			AM33XX_IOPAD(0x904, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_cmd.mmc0_cmd */
			AM33XX_IOPAD(0x900, PIN_INPUT_PULLUP | MUX_MODE0)	/* mmc0_clk.mmc0_clk */

			AM33XX_IOPAD(0x858, PIN_OUTPUT_PULLUP | MUX_MODE7)	/* gpmc_a6   reset*/
		    	AM33XX_IOPAD(0x878, PIN_OUTPUT_PULLUP | MUX_MODE7) 	/* gpmc_ben1 chipen*/
		    	AM33XX_IOPAD(0x87c, PIN_INPUT_PULLUP | MUX_MODE7) 	/* gpmc_csn0 irq*/
		>;
	};


&mmc1 {
	vmmc-supply = <&vmmcsd_fixed>;
	pinctrl-names = "default";
	pinctrl-0 = <&mmc1_pins>;
	// non-removable;
	bus-width = <4>;
	status = "okay";

	wilc_sdio@0 {
		compatible = "microchip,wilc1000", "microchip,wilc3000";
		irq-gpios = <&gpio1 29 0>;
		reset-gpios = <&gpio1 22 1>;  //<&gpio1 22 GPIO_ACTIVE_LOW>;
		chip_en-gpios = <&gpio1 28 1>;
		interrupt-parent = <&gpio1>;
		interrupts = <29 0x2>; /* Falling edge only */
		// clocks = <&pck1>;
		// clock-names = "rtc_clk";
		// assigned-clocks = <&pck1>;
		// assigned-clock-rates = <32768>;
		status = "okay";
		reg = <0>;
		bus-width = <4>;
	};
};

2.5 编译

shell中cd到sdk根目录ti-processor-sdk-linux-am335x-evm-06.03.00.106/。

make linux-clear
make linux

编译驱动没有报错,设备树配置容易出错。最终得到wilc-sdio.ko模块。再三确认,没有wilc.ko模块。因为测试时,按atmel文档是先安装wilc.ko模块。忽略不用管便可。

注:源码包里的设备树配置,reset,en有效都是0,如下

        reset-gpios = <&gpio1 22 0>;  //<&gpio1 22 GPIO_ACTIVE_LOW>;
        chip_en-gpios = <&gpio1 28 0>;

虽然能用,但是用示波器量,en引脚的电平并没有反向,还是一样的,但低电平脉宽不正常。这部分参考了网友的设置:

AM335X BeagleBoneBlack wilc3000蓝牙wifi驱动移植_MC_J的博客-CSDN博客

3. WIFI测试

3.1 驱动模块安装

将wilc-sdio.ko拷贝至/lib/modules/4.19.94-gbe5389fd85/kernel/drivers/staging/wilc

确保之前WIFI固件已拷贝至lib/firmware/。2.2节有描述。

在wilc-sdio.ko目录下,执行  insmod wilc-sdio.ko。但会出错,如下。

/wilc# insmod wilc-sdio.ko
[   88.260186] wilc_sdio: module is from the staging directory, the quality is unknown, you have been warned.
[   88.274813] wilc_sdio: Unknown symbol cfg80211_inform_bss_frame_data (err -2)
[   88.283120] wilc_sdio: Unknown symbol cfg80211_scan_done (err -2)
[   88.291112] wilc_sdio: Unknown symbol cfg80211_remain_on_channel_expired (err -2)
[   88.299387] wilc_sdio: Unknown symbol cfg80211_ref_bss (err -2)
[   88.305453] wilc_sdio: Unknown symbol cfg80211_find_ie_match (err -2)
[   88.313364] wilc_sdio: Unknown symbol cfg80211_disconnected (err -2)
[   88.320555] wilc_sdio: Unknown symbol wiphy_new_nm (err -2)
[   88.326216] wilc_sdio: Unknown symbol cfg80211_ready_on_channel (err -2)
[   88.333931] wilc_sdio: Unknown symbol wiphy_register (err -2)
[   88.340321] wilc_sdio: Unknown symbol cfg80211_put_bss (err -2)
[   88.346476] wilc_sdio: Unknown symbol ieee80211_get_channel (err -2)
[   88.353796] wilc_sdio: Unknown symbol wiphy_unregister (err -2)
[   88.360765] wilc_sdio: Unknown symbol cfg80211_get_bss (err -2)
[   88.366796] wilc_sdio: Unknown symbol cfg80211_mgmt_tx_status (err -2)
[   88.374337] wilc_sdio: Unknown symbol ieee80211_channel_to_frequency (err -2)
[   88.382177] wilc_sdio: Unknown symbol cfg80211_rx_mgmt (err -2)
[   88.388827] wilc_sdio: Unknown symbol cfg80211_get_p2p_attr (err -2)
[   88.395265] wilc_sdio: Unknown symbol ieee80211_frequency_to_channel (err -2)
[   88.403414] wilc_sdio: Unknown symbol cfg80211_find_vendor_ie (err -2)
[   88.411496] wilc_sdio: Unknown symbol cfg80211_connect_done (err -2)
[   88.419173] wilc_sdio: Unknown symbol wiphy_free (err -2)
insmod: ERROR: could not insert module wilc-sdio.ko: Unknown symbol in module

是因为缺少依赖模块cfg80211.ko模块。所以要先 安装 cfg80211.ko再安装wilc-sdio.ko。

其实还有直接识别依赖自动安装的指令modprobe wilc-sdio。要想使用modprobe 需要先depmod。

cd到wilc-sdio的目录,即/lib/modules/4.19.94-gbe5389fd85/kernel/drivers/staging/wilc

cd /lib/modules/4.19.94-gbe5389fd85/kernel/drivers/staging/wilc

depmod  // 这时,会自动为目录下的ko模块创建依赖关系 ,在/lib/modules/4.19.94-gbe5389fd85/kernel的文件modules.dep中  操作过后,模块信息已被记录,此时在文件系统的任意目录都可以执行modprobe指令。

modprobe wilc-sdio    //不要后缀.ko, 自动先安装 cfg80211,然后再安装wilc-sdio 安装完成后,即可看到wlan0无线网卡

正常安装后信息:

root@am335x-evm:/lib/modules/4.19.94-gbe5389fd85/kernel/drivers/staging/wilc# cd ~
root@am335x-evm:~# modprobe wilc-sdio
[  658.706632] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  658.878954] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  658.893357] wilc_sdio: module is from the staging directory, the quality is unknown, you have been warned.
[  658.927438] Registering wifi device
[  658.930973] Max scan ids= 10,Max scan IE len= 1000,Signal Type= 1,Interface Modes= 844
[  658.955773] Initializing Locks ...
[  658.975673] wifi_pm : 0
[  658.997477] wilc_sdio mmc0:0001:1: succesfully got gpio_reset
[  659.003400] wilc_sdio mmc0:0001:1: succesfully got gpio_chip_en
[  659.052433] wifi_pm : 1
[  659.066825] wilc_sdio mmc0:0001:1: succesfully got gpio_reset
[  659.083410] wilc_sdio mmc0:0001:1: succesfully got gpio_chip_en
[  659.140057] wilc_sdio mmc0:0001:1: Driver Initializing success
root@am335x-evm:~# [  659.287039] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]MAC OPEN[76a1e170] wlan0
[  659.311024] WILC POWER UP
[  659.323226] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_init_host_int]Host[76a1e170][8831ded1]
[  659.336117] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]*** re-init ***
[  659.349653] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_init]Initializing WILC_Wlan
[  659.365461] wilc_sdio mmc0:0001:1: SDIO speed: 50000000
[  659.385204] wilc_sdio mmc0:0001:1: chipid 001003a0
[  659.403571] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_initialize]WILC Initialization done
[  659.426636] wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Initializing Threads ...
[  659.447824] wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Creating kthread for transmission
[  659.471783] wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Creating kthread for Debugging
[  659.481913] wilc_sdio mmc0:0001:1: got gpio_irq successfully
[  659.504321] wilc_sdio mmc0:0001:1 wlan0: INFO [init_irq]IRQ request succeeded IRQ-NUM= 79
[  659.518559] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]Detect chip WILC1000
[  659.532769] wilc_handle_isr,>> UNKNOWN_INTERRUPT - 0x00000000
[  659.542031] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]loading firmware mchp/wilc1000_wifi_firmware.bin
[  659.564507] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]WLAN firmware: mchp/wilc1000_wifi_firmware.bin
[  659.604947] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Downloading Firmware ...
[  659.613951] wilc_wlan_firmware_downloadDownloading firmware size = 144876
[  659.634809] wilc_wlan_firmware_download Offset = 126916
[  659.641579] wilc_wlan_firmware_download Offset = 144876
[  659.646845] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Download Succeeded
[  659.660034] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Starting Firmware ...
[  659.671027] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Waiting for FW to get ready ...
[  659.797963] cfg_indicate_rx: Info message received
[  659.803285] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Firmware successfully started
[  659.828104] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_initialize]WILC Firmware Ver = WILC_WIFI_FW_REL_15_6 Build: 12804
[  659.843042] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_init_fw_config]Start configuring Firmware
[  659.998277] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]Mac address: 60:8a:10:b6:68:62
[  660.006796] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 1.
[  660.016540] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.041675] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 2.
[  660.051410] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.060472] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  660.076985] wilc_sdio mmc0:0001:1 wlan0: INFO [set_power_mgmt]dev [wlan0]
[  660.086195] wilc_sdio mmc0:0001:1 wlan0: INFO [set_power_mgmt] Power save Enabled= 1 , TimeOut = -1
[  660.131505] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 3.
[  660.141250] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.150297] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  660.159311] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  660.184399] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 4.
[  660.194144] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.203187] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  660.212203] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  660.221220] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[3]: 01:80:c2:00:00:00
[  660.263214] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 5.
[  660.272946] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.281998] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  660.291018] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  660.300030] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[3]: 01:80:c2:00:00:00
[  660.309045] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[4]: 01:80:c2:00:00:03
[  660.330315] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 6.
[  660.340000] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  660.349047] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  660.358063] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  660.367068] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[3]: 01:80:c2:00:00:00
[  660.376081] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[4]: 01:80:c2:00:00:03
[  660.385101] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[5]: 01:80:c2:00:00:0e
[  662.042010] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 7.
[  662.051858] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  662.060968] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  662.070051] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  662.079121] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[3]: 01:80:c2:00:00:00
[  662.088200] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[4]: 01:80:c2:00:00:03
[  662.097269] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[5]: 01:80:c2:00:00:0e
[  662.106312] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[6]: 33:33:00:00:00:fb
[  662.139624] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Setting mcast List with count = 8.
[  662.149329] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[0]: 33:33:00:00:00:01
[  662.158379] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[1]: 01:00:5e:00:00:01
[  662.167395] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[2]: 33:33:ff:b6:68:62
[  662.176398] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[3]: 01:80:c2:00:00:00
[  662.185426] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[4]: 01:80:c2:00:00:03
[  662.194443] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[5]: 01:80:c2:00:00:0e
[  662.203455] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[6]: 33:33:00:00:00:fb
[  662.212471] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_set_multicast_list]Entry[7]: 33:33:00:01:00:03

注1:小插曲,因为每次开机都必须执行安装指令,安装完,重启配置几次后,再执行modprobe wilc-sdio,弹出以下信息

[  658.706632] cfg80211: Loading compiled-in X.509 certificates for regulatory database
[  658.878954] cfg80211: Loaded X.509 cert 'sforshee: 00b28ddf47aef9cea7'
[  658.893357] wilc_sdio: module is from the staging directory, the quality is unknown, you have been warned.

后就没有任何 东西。ifconfig -a后并没有出现wlan0网卡,但lsmod能看到cfg80211,wilc-sdio模块已安装成功。不停重启,断电均无效。后来检测,发现,芯片的复位引脚驱动不对,复位引脚短路。修复后就可以正常通讯了。

注2:加载wifi固件成功后,启动固件运行,会提示超时,Failed to start firmware。在如下位置 ,提示的不是成功,是超时失败,后来修复复位引脚后也成功,没找到其他原因。

[  659.604947] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Downloading Firmware ...
[  659.613951] wilc_wlan_firmware_downloadDownloading firmware size = 144876
[  659.634809] wilc_wlan_firmware_download Offset = 126916
[  659.641579] wilc_wlan_firmware_download Offset = 144876
[  659.646845] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Download Succeeded
[  659.660034] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Starting Firmware ...
[  659.671027] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Waiting for FW to get ready ...
[  659.797963] cfg_indicate_rx: Info message received
[  659.803285] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_start_firmware]Failed to start firmware

但按github源码的问题反馈里,维护人员一直强调,等待固件运行,会有个wifi模块会产生中断,如果我们的linux驱动没有接收到中断,会产生超时,错误这种 状态。

​​​​​​WILC1000 - "Failed to start firmware" on 4.1.15 kernel - SPI interface · Issue #87 · linux4wilc/driver · GitHub

我也从板子上量了irq中断线,确实并没有产生中断。修复复位引脚后,wifi模块也能正常使用。好像就没有用外部中断线。

注3:在wilc-sdio.ko模块正确安装,且wlan0能运行后,调用reboot指令使系统复位,系统启动后,无法再加载wilc-sdio模块。

经测试发现逻辑:

a)复位重启前,ifconfig wlan0 down,重启后可正常安装

b)复位重启前,rmmod wilc-sdio卸载模块后,重启可正常安装

c) 在重启后,无法安装的条件 前,复位WIFI模块,失能WIFI模块,即(reset,en引脚拉低),再使能,再安装模块,均没有用。

d)复位后,但内核 不重启。此时,复位WIFI模块,重启后可正常安装

后经调试发现,只要WIFI正常启动后,没有去让网卡下线或卸载模块,WIFI模块一直处于正常工作 状态,而此时linux内核重启,会造成mmc0初始化失败,所以重启后安装时,mmc0无效无法安装。但这个错误,在安装时没有信息提示。

解决办法:

系统复位时,关机服务添加代码,ifconfig wlan0 down

在uboot阶段,控制WIFI模块的复位引脚,我们用的是BBB的UBOOT,所以直接在启动环境变量参数增加一个:gpio clear 54,置低复位脚,然后在启动内核时gpio set 54。

以上操作后,系统启动后,modproge wilc-sdio模块加载成功。

3.2 WIFI功能测试:

添加几个配置文件,以下摘抄手册,其中DHCP部分,我系统是systemd的启动方式,不一样,没有按下面的操作,我也滑额外的配置,目前能直接使用:

Modifying Configuration Files
To use the Wi-Fi module, the user must load a set of default configuration files on the prebuilt image.
These files can be modified as per the requirement described in the following section.
8.4.1
Wi-Fi Protected Access Supplicant
The reference configuration files for Wi-Fi Protected Access (WPA) supplicant are available in: /etc/
directory. The configuration files for both Station and Access Point modes are available in the demo
prebuilt image.
8.4.1.1
Station Mode
The configuration file for Station mode wilc_wpa_supplicant.conf contains the following lines.
ctrl_interface=/var/run/wpa_supplicant
update_config=1
8.4.1.2
Access Point Open Security Mode
The Access Point (AP) mode configuration file with open security wilc_hostapd_open.conf contains
the following lines.
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=wilc1000_SoftAP
dtim_period=2
beacon_int=100
channel=7
hw_mode=g
max_num_sta=8
ap_max_inactivity=300
ATWILC1000/ATWILC3000
Running ATWILC
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 27 8.4.1.3
Access Point Wired Equivalent Privacy Security Mode
The AP mode configuration file for Wired Equivalent Privacy (WEP) Security wilc_hostapd_wep.conf
contains the following lines.
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=wilc1000_SoftAP
dtim_period=2
beacon_int=100
channel=7
hw_mode=g
max_num_sta=8
ap_max_inactivity=300
ieee80211n=1
auth_algs=1
######### WEP ###########
wep_default_key=0
wep_key0=1234567890
wep_key1="vwxyz"
wep_key2=0102030405060708090a0b0c0d
wep_key3=".2.4.6.8.0.23"
wep_key_len_broadcast=5
wep_key_len_unicast=5
wep_rekey_period=300
8.4.1.4
WPA Security Mode
The AP mode configuration file with WPA security wilc_hostapd_wpa.conf contains the following
lines.
interface=wlan0
driver=nl80211
ctrl_interface=/var/run/hostapd
ssid=wilc1000_SoftAP
dtim_period=2
beacon_int=100
channel=7
hw_mode=g
max_num_sta=8
ap_max_inactivity=300
ieee80211n=1
auth_algs=1
######### WPA/WPA2 ###########
wpa=3
wpa_passphrase=12345678
wpa_key_mgmt=WPA-PSK
wpa_pairwise=TKIP CCMP
rsn_pairwise=CCMP
8.4.2
Dynamic Host Configuration Protocol
The reference configuration file for the Dynamic Host Configuration Protocol (DHCP) server is available in
the /etc/dhcp/dhcpd.conf file.
ddns-update-style none;
default-lease-time 600;
max-lease-time 7200;
option subnet-mask 255.255.255.0;
option domain-name-servers 168.126.63.1, 164.124.101.2; # DNS Server IP
option domain-name “sample.example”; # domain name
subnet 192.168.0.0 netmask 255.255.255.0 {
range 192.168.0.100 192.168.0.110; # range ip
option broadcast-address 192.168.0.255;
option routers 192.168.0.1; # gateway ip
}
Log-facility local7;
ATWILC1000/ATWILC3000
Running ATWILC
© 2019 Microchip Technology Inc.
User Guide
DS70005328C-page 28 }
Log-facility local7;
Note:  Each value must be modified as per the test environment.
The location of the dhcpd.conf file should match the location defined in /etc/init.d/S80dhcp
server under: test -f /etc/dhcp/dhcpd.conf || exit 0 .
8.4.3
radvd
For IPv6, the radvd configuration file is required. The reference file on the demo image is available in
the /etc/radvd.conf directory.
interface wlan0
{
AdvSendAdvert on;
prefix 2001:db8:0:2::/64
{
};
};

3.2.1 Station模式测试

手机开热点,测试指令如下:

// 以下指令是非加密连接。

# wpa_supplicant -iwlan0 -Dnl80211 -c /etc/wilc_wpa_supplicant.conf &

# wpa_cli -p/var/run/wpa_supplicant ap_scan 1

# wpa_cli -p/var/run/wpa_supplicant add_network 

# wpa_cli -p/var/run/wpa_supplicant set_network 0 ssid '"User_AP"' // User_AP替换为热点SSID

# wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE 

# wpa_cli -p/var/run/wpa_supplicant select_network 0 // 这步才会连入手机热点,前面都没有效提示信息

开始ping测试,由于我们的板子还有有线网口,所以ping 需要指定网卡。

ping -I wlan0 www.baidu.com 很不辛,ping外网不成功

另一台笔记本也接入同一个手机热点,接着ping笔记本IP

ping -I wlan0 192.168.73.55  

此时是ping成功的。

注:所以有个疑问,为什么ping外网没成功,笔记本连手机热点,是可能上网的。如果有朋友测试成功,知道原因,麻烦告知下,万分感谢。

TCP测试的,server  client的QT代码包分享,免分下载,希望CSDN不要调分:

TcpClient  :TcpClient测试-QT文档类资源-CSDN下载

TcpServer:TcpServer测试-QT文档类资源-CSDN下载

演示如下:服务器,本机IP,填写本地主机的IP即可。点监听,成功后会显示如下,监听按键变成断开,即成功。

如下,客户端,服务器IP填写已处于监听状态的服务器IP地址,点连接即可。整个TCP服务器,客户端在AM335x的板子上已测试通过,板子不方便截图,在Windows下运行截个图直观的展示下。

参考:

https://github.com/linux4wilc/driver

WILC1000 - "Failed to start firmware" on 4.1.15 kernel - SPI interface · Issue #87 · linux4wilc/driver · GitHub

AM335X BeagleBoneBlack wilc3000蓝牙wifi驱动移植_MC_J的博客-CSDN博客

一种调试IO方法参考:

 failed to get GPIO · Issue #49 · linux4wilc/driver · GitHub

 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值