AM335X BeagleBoneBlack wilc3000蓝牙wifi驱动移植

1.源码移植

(1)将源码复制到drivers/staging/wilc1000目录下替换原来此目录下的程序。

(2)将driver/staging/Makefile文件中的CONFIG_WILC1000修改为CONFIG_WILC

(3)将固件复制到文件系统的lib/firmware/mchp目录下

2.内核编译选项

3.设备树配置

spi1_pins: pinmux-spi1-pins {
		pinctrl-single,pins = <
AM33XX_IOPAD(0x99c, PIN_OUTPUT | MUX_MODE3)                   /* spi1_cs0.spi1_cs0, OUTPUT_PULLUP*/
		    AM33XX_IOPAD(0x994, PIN_OUTPUT | MUX_MODE3)                 
/* spi1_d0.spi1_d0, INPUT_PULLUP*/
		    AM33XX_IOPAD(0x998, PIN_INPUT | MUX_MODE3)    
/* spi1_d1.spi1_d1, OUTPUT_PULLUP*/
		    AM33XX_IOPAD(0x990, PIN_INPUT | MUX_MODE3)     
/* spi1_SCLK.spi1_SCLK, OUTPUT_PULLUP*/

		    AM33XX_IOPAD(0x9a4, PIN_OUTPUT_PULLUP | MUX_MODE7)		
/*reset*/
		    AM33XX_IOPAD(0x9ac, PIN_OUTPUT_PULLUP | MUX_MODE7) 					/*chipen*/
		    AM33XX_IOPAD(0x844, PIN_INPUT_PULLUP | MUX_MODE7) 						/*irq*/
		>;
};	

uart1_pins: pinmux_uart1_pins {
		pinctrl-single,pins = <
			AM33XX_IOPAD(0x980, PIN_INPUT_PULLUP | MUX_MODE0)
			AM33XX_IOPAD(0x984, PIN_OUTPUT_PULLDOWN | MUX_MODE0)	
		>;
};

uart4_pins: pinmux-uart4-pins {
		pinctrl-single,pins = <
		    AM33XX_IOPAD(0x874, PIN_OUTPUT_PULLUP | MUX_MODE6) 	
		    AM33XX_IOPAD(0x870, PIN_INPUT_PULLUP | MUX_MODE6) 	
		>;
};

&spi1{
	status = "okay";	
	pinctrl-names = "default";
	pinctrl-0 = <&spi1_pins>;
	ti,pindir-d0-out-d1-in = <1>;
	wilc_spi: wilc_spi@0 {
		status = "okay";
		compatible = "microchip,wilc3000","microchip,wilc1000";
		spi-max-frequency = <6000000>;
		interrupt-parent = <&gpio1>;
		reg = <0>;
		reset-gpios = <&gpio3 19 1>;
		chip_en-gpios = <&gpio3 21 1>;
		irq-gpios = <&gpio1 17 0>;
	};
};

&uart1 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&uart1_pins>;
};

&uart4 {
	status = "okay";
	pinctrl-names = "default";
	pinctrl-0 = <&uart4_pins>;
};

4.基本命令

(1)modprobe wilc-spi   //下载固件

 

(2)蓝牙

echo BT_POWER_UP > /dev/wilc_bt

echo BT_FW_CHIP_WAKEUP > /dev/wilc_bt

echo BT_DOWNLOAD_FW > /dev/wilc_bt

echo BT_FW_CHIP_ALLOW_SLEEP > /dev/wilc_bt

hciattach ttyS1 any 115200 noflow

hciconfig hci0 up

ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin/

hciconfig hci0 leadv  //广播

btgatt-server -i hci0 -s low -t public -r -v  //GATT服务例程

 

(3)WIFI  AP:模式

hostapd /etc/hostapd.conf -B

udhcpd -f /etc/udhcpd.conf

 

(4) WIFI  STA模式

wpa_supplicant -iwlan0 -Dnl80211 -c /etc/wilc_wpa_supplicant.conf -B

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

2) wpa_cli -p /var/run/wpa_supplicant add_network

3)  wpa_cli -p /var/run/wpa_supplicant set_network 0 ssid ‘”DEMO_LINUX” ’

4)  wpa_cli -p /var/run/wpa_supplicant set_network 0 key_mgmt WPA-PSK

5)  wpa_cli -p /var/run/wpa_supplicant set_network 0 psk ‘”12345678’”

6) wpa_cli -p /var/run/wpa_supplicant select_network 0

7) udhcpc -iwlan0