|
|||||||||||||
"microchip,wilc1000" "microchip,wilc3000
*_wilc.dtso
in the dt-overlay-mchp repository.
To load WILC overlay, follow the next steps:Hit any key to stop autoboot
message appears on console:
U-Boot 2019.04-linux4sam_6.2 (Oct 25 2019 - 03:10:23 +0000) CPU: SAM9X60 Crystal frequency: 24 MHz CPU clock : 600 MHz Master clock : 200 MHz DRAM: 256 MiB MMC: sdhci-host@80000000: 0 Loading Environment from FAT... OK In: serial Out: serial Err: serial Net: eth0: ethernet@f802c000 Hit any key to stop autoboot: 32. Edit
bootcmd
U-Boot environment variable and add #wilc
string at the end:
U-Boot> edit bootcmd edit: fatload mmc 0:1 0x24000000 sam9x60ek.itb; bootm 0x24000000#kernel_dtb#wilc3. Enter
boot
command. The Linux kernel would be loaded using the WILC device tree overlay:U-Boot> boot 4508836 bytes read in 225 ms (19.1 MiB/s) ## Loading kernel from FIT Image at 24000000 ... Using 'kernel_dtb' configuration Trying 'kernel' kernel subimage Description: Linux4SAM Linux kernel Type: Kernel Image Compression: uncompressed Data Start: 0x240000d8 Data Size: 4447104 Bytes = 4.2 MiB Architecture: ARM OS: Linux Load Address: 0x22000000 Entry Point: 0x22000000 Hash algo: crc32 Hash value: 2c706949 Hash algo: sha1 Hash value: d8d72f7fb8603a35a39a6803d9b418abebbca9a5 Verifying Hash Integrity ... crc32+ sha1+ OK ## Loading fdt from FIT Image at 24000000 ... Using 'kernel_dtb' configuration Trying 'base_fdt' fdt subimage Description: SAM9X60-EK Flattened Device Tree blob Type: Flat Device Tree Compression: uncompressed Data Start: 0x2443dd90 Data Size: 28407 Bytes = 27.7 KiB Architecture: ARM Load Address: 0x23000000 Hash algo: crc32 Hash value: b8c3d3b7 Hash algo: sha1 Hash value: b538fc9f410be576b6bba6e18add7010e68f6f7b Verifying Hash Integrity ... crc32+ sha1+ OK Loading fdt from 0x2443dd90 to 0x23000000 ## Loading fdt from FIT Image at 24000000 ... Using 'wilc' configuration Trying 'fdt_wilc' fdt subimage Description: Device Tree blob WILC3000 overlay Type: Flat Device Tree Compression: uncompressed Data Start: 0x2444b168 Data Size: 1572 Bytes = 1.5 KiB Architecture: ARM Load Address: 0x23180000 Hash algo: crc32 Hash value: e8fbf3b2 Hash algo: sha1 Hash value: e36920209c1e758e6e67207b4a1646896b3a8784 Verifying Hash Integrity ... crc32+ sha1+ OK Loading fdt from 0x2444b168 to 0x23180000 Booting using the fdt blob at 0x23000000 Loading Kernel Image ... OK Loading Device Tree to 2feeb000, end 2fef51c8 ... OK Starting kernel ...
cfg80211.ko pwrseq_sd8787.ko wilc-sdio.koCheck that the above modules are inserted by running
lsmod
command:
root@sama5d27-wlsom1-ek-sd:~# lsmod Module Size Used by pwrseq_sd8787 12288 1 cfg80211 311296 0 usb_f_acm 12288 1 u_serial 16384 1 usb_f_acm g_serial 12288 0 libcomposite 40960 2 g_serial,usb_f_acm atmel_usba_udc 20480 0 autofs4 24576 0If one of the above modules is missing, try inserting them using
insmod
or modprobe
command. In the above example, the wilc-sdio.ko module is missing. To insert it:
root@sama5d27-wlsom1-ek-sd:~# insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/microchip/wilc1000/wilc-sdio.ko wilc_sdio mmc1:0001:1: Driver Initializing successIn case the other modules are missing, try inserting them using
insmod
or modprobe
commands:
insmod /lib/modules/$(uname -r)/kernel/net/wireless/cfg80211.ko insmod /lib/modules/$(uname -r)/kernel/drivers/mmc/core/pwrseq_sd8787.ko insmod /lib/modules/$(uname -r)/kernel/drivers/net/wireless/microchip/wilc1000/wilc-sdio.koAfter all kernel modules are installed, the
wlan0
interface should appear in ifconfig
:
root@sama5d27-wlsom1-ek-sd:~# ifconfig -a eth0 Link encap:Ethernet HWaddr 54:10:ec:ff:fa:16 UP BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) Interrupt:30 Base address:0x8000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr: ::1/128 Scope:Host UP LOOPBACK RUNNING MTU:65536 Metric:1 RX packets:2 errors:0 dropped:0 overruns:0 frame:0 TX packets:2 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:140 (140.0 B) TX bytes:140 (140.0 B) p2p0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) sit0 Link encap:UNSPEC HWaddr 00-00-00-00-00-00-00-00-00-00-00-00-00-00-00-00 NOARP MTU:1480 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B) wlan0 Link encap:Ethernet HWaddr 00:00:00:00:00:00 BROADCAST MULTICAST MTU:1500 Metric:1 RX packets:0 errors:0 dropped:0 overruns:0 frame:0 TX packets:0 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:0 (0.0 B) TX bytes:0 (0.0 B)From here on, the WILC device could be used in either direct WiFi client mode, Access Point mode or BT.
/etc/wpa_supplicant.conf
file. The content of file should be as follows:
ctrl_interface=/var/run/wpa_supplicant update_config=1 network={ ssid="access-point-name" psk="access-point-password" }Where the SSID and PSK variables keep the access point name and password, the WILC device will be connected. Save the file. Stop the hostapd service using the following command (if it is already running ):
systemctl stop hostapd@<Configured authentication mode>where
Configured authentication mode
might be any one of open
, wpa
or wep
.
Replace network configurations from existing examples in rootfs and start the WPA supplicant service using the following commands:
For Buildroot:
cp /usr/lib/systemd/system/wpa_supplicant.service.example /etc/systemd/system/wpa_supplicant.service cp /usr/lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/wlan0.network systemctl restart wpa_supplicant.serviceFor Yocto Project:
cp /lib/systemd/network/80-wifi-station.network.example /etc/systemd/network/wlan0.network systemctl restart wpa_supplicant.serviceReload the network configuration using the following command:
networkctl reloadAt this point, an IP address should be assigned to the WLAN interface, and IP connectivity should be active.
/root/Start_STA.shNote: Starting with the Linux4SAM-2024.04 release, the Yocto Project also includes the predefined scripts in root filesystem.
/root/Start_Provision.sh
:
/root/Start_Provision.shThis will reboot the board. After reboot, the WILC device will enter
SoftAP
mode with name wilc_SoftAP
and IP 192.168.0.1
. This allow connecting to the WILC device using any Wi-Fi device for provisioning. Connecting to 192.168.0.1
will allow the configuration for Access Point to connect to. The meaning of fields in the opened web page are as follows:
Network Name: The Access Point name that WILC in STA mode should connect to Pass phrase: The Access Point password Device Name: The name of the WILC deviceAfter filling in the above fields and pressing the
Connect
button, the board will reboot, and the WILC device will start in STA mode and connect to the configured access point.
wilc_OpenAP
(No Password
), wilc_WepAP
(Password
= 1234567890
) and wilc_WpaAP
(Password
= 12345678
) respectively.
To configure custom ssid names
and passphrases
, one can edit hostapd configuration files available in the /etc/*
directory, where the configuration file could be one of the following:
/etc/wilc_hostapd_open.conf /etc/wilc_hostapd_wep.conf /etc/wilc_hostapd_wpa.confNote: Starting with the Linux4SAM-2024.04 release, both Buildroot and the Yocto Project root filesystem include the required hostapd configuration files in the
/etc/*
directory itself.
Stop the wpa_supplicant service using the following command( if it is already running):
systemctl stop wpa_supplicant.serviceReplace network configurations from existing examples in rootfs and reload network configurations using the following commands: For Buildroot:
cp /usr/lib/systemd/system/hostapd@.service.example /etc/systemd/system/hostapd@.service cp /usr/lib/systemd/network/80-wifi-softap.network.example /etc/systemd/network/wlan0.network networkctl reloadFor Yocto Project:
cp /lib/systemd/network/80-wifi-softap.network.example /etc/systemd/network/wlan0.network networkctl reloadBring up the wlan0 interface using the following command:
networkctl up wlan0
hostapd
service with any one of the following commands, depending on authentication:
systemctl start hostapd@open.serviceor
systemctl start hostapd@wpa.serviceor
systemctl start hostapd@wep.serviceThis will start the WILC device in the corresponding access point mode.Connect from an WiFi client to the newly created access point and try a ping. To switch between different authentication modes in run time, make sure the current
hostapd
service stopped properly using systemctl stop
command and wilc-sdio
module need to be reloaded using insmod
or modprobe
command.
Note: Default build support for WEP Authentication was removed from the hostapd 2.10 version, so this test will
fail by default. (CONFIG_WEP=y can be used to enable it if needed).
/etc/wpa_supplicant.conf
file. The content of file should be as follows:
ctrl_interface=/var/run/wpa_supplicant update_config=1 network={ ssid="access-point-name" psk="access-point-password" }Where the SSID and PSK variables keep the access point name and password, the WILC device will be connected. Save the file. Start the WPA supplicant service using the following command:
wpa_supplicant -B -iwlan0 -Dnl80211 -c /etc/wpa_supplicant.conf &Initiate a DHCP request so that a proper IP address and DNS settings can be installed for the WILC device:
udhcpc -i wlan0 &At this point, an IP address should be assigned to the WLAN interface, and IP connectivity should be active.
/etc/wilc_hostapd_open.conf
file as follows:
interface=wlan0 driver=nl80211 ctrl_interface=/var/run/hostapd ssid=wilc_OpenAP dtim_period=2 beacon_int=100 channel=7 hw_mode=g max_num_sta=8 ap_max_inactivity=300Where the Access Point name would be
wilc_OpenAP
.
/etc/wilc_hostapd_wep.conf
file as follows:
interface=wlan0 driver=nl80211 ctrl_interface=/var/run/hostapd ssid=wilc_WepAP 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=300Where the access point name would be
wilc_WepAP and password =1234567890
.
Note: Default build support for WEP Authentication was removed from the hostapd
2.10 version, so this test will
fail by default. (CONFIG_WEP=y can be used to enable it if needed).
/etc/wilc_hostapd_wpa.conf
file as follows:
interface=wlan0 driver=nl80211 ctrl_interface=/var/run/hostapd ssid=wilc_WpaAP 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=CCMPWhere the Access Point name would be
wilc_WpaAP
and password would be 12345678
.
/etc/dhcp/dhcpd.conf
with the following content (if the image is based on Buildroot):
option domain-name "tecmint.lan"; option domain-name-servers ns1.tecmint.lan, ns2.tecmint.lan; default-lease-time 3600; max-lease-time 7200; authoritative; subnet 192.168.1.0 netmask 255.255.255.0 { option routers 192.168.1.1; option subnet-mask 255.255.255.0; option domain-search "tecmint.lan"; option domain-name-servers 192.168.1.1; range 192.168.1.10 192.168.1.100; range 192.168.1.110 192.168.1.200; }If the image is based on the Yocto Project, Create or edit* /etc/kea/kea-dhcp4.conf with the contents below:
{ "Dhcp4": { "interfaces-config": { "interfaces": ["wlan0"] }, "subnet4": [ { "subnet": "192.168.1.0/24", "pools": [ { "pool": "192.168.1.100 - 192.168.1.200" } ], "option-data": [ { "code": 3, "data": "192.168.1.1" }, { "code": 6, "data": "192.168.1.1, 8.8.8.8" } ] } ] } }
hostapd
service with file configured above:
hostapd -B <configuration file>where the configuration file could be one of the following:
/etc/wilc_hostapd_open.conf /etc/wilc_hostapd_wep.conf /etc/wilc_hostapd_wpa.conf2. Configure an IP address for the wlan0 interface:
ifconfig wlan0 192.168.1.1 netmask 255.255.255.0 up3. Start DHCP server: For Buildroot:
dhcpd -cf /etc/dhcp/dhcpd.confFor Yocto Project:
keactrl startThis will start WILC device in Open Access Point mode. 4. Connect from an WiFi client to newly created access point and try a ping.
|
|||||||||||||||||||||||||||||||||||||
echo BT_SDIO_INIT > /dev/wilc_bt 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 <bluetooth-serial> any 115200 noflow # see table at the beginning of this chapter hciconfig hci0 up ln -svf /usr/libexec/bluetooth/bluetoothd /usr/sbin bluetoothd -p time -n &If the last command returns a D-Bus error, check if the
bluetooth
daemon is already started. If yes, kill it and retry the last command:
kill bluetoothd bluetoothd -p time -n &Check bluetooth interface status:
hciconfig -aEnable LE activity:
hciconfig hci0 leadvTry to scan and connect to a device.
bluetoothctl scan on connect <identifier-listed-by-scan>If scan fails, run the following command:
power on
/root/Start_BT.shThis will start WILC device in Bluetooth mode.
WebFaqBaseForm | |
---|---|
Boards | Sam9x60Curiosity, Sama7g5-ek, Sama5d2-icp, Sam9x60EK, Sama5d27WLSom1EK |
Components | Kernel |
Summary | How to use WILC3000 on SAM development boards |
Copyright © by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Linux® is the registered trademark of Linus Torvalds in the U.S. and other countries.
Microchip and others, are registered trademarks or trademarks of Microchip Technology Inc. and its subsidiaries.
Arm® and others are registered trademarks or trademarks of Arm Limited (or its affiliates). Other terms and product names may be trademarks of others.
Ideas, requests, contributions ? Connect to LinksToCommunities page.