8.5 Running in the ATWILC Station Mode
The following example shows how to run the ATWILC device in Station mode and connect to an AP.
- Initialize the ATWILC1000 and
ATWILC3000 driver module using the following
command:
Welcome to Buildroot buildroot login: root root@buildroot ~]# modprobe wilc-sdio linux_sdio_probe init_power =0 wilc_sdio mmc0:0001:1: Driver Initializing success
- Start the WPA supplicant service and
execute
wpa_supplicant
using the following command:# wpa_supplicant -iwlan0 -Dnl80211 -c /etc/wilc_wpa_supplicant.conf & # Successfully initialized wpa_supplicant wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mgmt_frame_register]Frame registering Frame Type: d0: Boolean: 1 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mgmt_frame_register]Return since mac is closed wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]MAC OPEN[d464f800] wlan0 WILC POWER UP wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_init_host_int]Host[d464f800][d463b000] wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]*** re-init *** wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_init_locks]Initializing Locks ... wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_init]Initializing WILC_Wlan wilc_sdio mmc0:0001:1: SDIO speed: 50000000 wilc_sdio mmc0:0001:1: chipid 001003a0 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_initialize]WILC Initialization done wilc_sdio mmc0:0001:1 wlan0: INFO [init_irq]IRQ request succeeded IRQ-NUM= 137 on GPIO: 91 wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Initializing Threads ... wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Creating kthread for transmission wilc_sdio mmc0:0001:1 wlan0: INFO [wlan_initialize_threads]Creating kthread for Debugging wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]Detect chip WILC1000 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]loading firmware mchp/wilc1000_wifi_firmware.bin wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_get_firmware]WLAN firmware: mchp/wilc1000_wifi_firmware.bin wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Downloading Firmware ... wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_firmware_download]Downloading firmware size = 134964 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_firmware_download]Offset = 119660 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_firmware_download]Offset = 134964 wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_firmware_download]Download Succeeded wilc_sdio mmc0:0001:1 wlan0: INFO [linux_wlan_start_firmware]Starting Firmware ... wilc_sdio mmc0:0001:1 wlan0: INFO [linux_wlan_start_firmware]Waiting for FW to get ready ... wilc_sdio mmc0:0001:1 wlan0: INFO [linux_wlan_start_firmware]Firmware successfully started wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_wlan_initialize]WILC Firmware Ver = WILC_WIFI_FW_REL_15_01_RC3 Build: 9792 wilc_sdio mmc0:0001:1 wlan0: INFO [linux_wlan_init_test_config]Start configuring Firmware wilc_sdio mmc0:0001:1 wlan0: INFO [wilc_mac_open]Mac address: fa:f0:05:f1:3d:64
- Connect to the Access Point:
- To connect to an unsecured
AP:
Use the following commands to scan and connect to the AP.
# 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"' # wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt NONE # wpa_cli -p/var/run/wpa_supplicant select_network 0
Note: Change the User_AP with the Service Set Identifier (SSID) of the desired AP. - To connect to the WPA secured
Access Point:
Use the following commands to scan and connect to a WPA or WPA2 and Temporal Key Integrity Protocol (TKIP) or Advanced Encryption Standard (AES) protected AP.
# 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"' # wpa_cli -p/var/run/wpa_supplicant set_network 0 key_mgmt WPA-PSK # wpa_cli -p/var/run/wpa_supplicant set_network 0 psk '"12345678"' # wpa_cli -p/var/run/wpa_supplicant select_network 0
Note: Change the User_AP and 12345678 with the SSID and password of the desired AP. - To connect to the WPA2/WPA3 secured Access Point:
Use the following commands to scan and connect to a WPA2 or WPA3 and Counter Mode CBC-MAC Protocol (CCMP) or Advanced Encryption Standard (AES) protected AP.
# 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"' # wpa_cli -i wlan0 set_network 0 ieee80211w 1 # wpa_cli -i wlan0 set_network 0 key_mgmt SAE WPA-PSK WPA-PSK-SHA256 # wpa_cli -i wlan0 set_network 0 pairwise CCMP # wpa_cli -i wlan0 set_network 0 group CCMP # wpa_cli -iwlan0 set_network 0 psk '"1234567811"' # wpa_cli -i wlan0 set_network 0 sae_password '"1234567890"' # wpa_cli -i wlan0 set_network 0 proto RSN # wpa_cli -iwlan0 select_network 0
Note: Change the User_AP, 1234567811 and 1234567890 with the SSID, password and sae_password of the desired AP. - To connect to the WPA3 (only) secured Access Point:
Use the following commands to scan and connect to a WPA3 and Counter Mode CBC-MAC Protocol (CCMP) or Advanced Encryption Standard (AES) protected AP.
# 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"' # wpa_cli -i wlan0 set_network 0 ieee80211w 1 # wpa_cli -i wlan0 set_network 0 key_mgmt SAE # wpa_cli -i wlan0 set_network 0 pairwise CCMP # wpa_cli -i wlan0 set_network 0 group CCMP # wpa_cli -i wlan0 set_network 0 sae_password '"1234567890"' # wpa_cli -i wlan0 set_network 0 proto RSN # wpa_cli -iwlan0 select_network 0
Note: Change the User_AP and 1234567890 with the SSID and sae_password of the desired AP. - Connect to the WPS secured
Access Point Trigger WPS Push-Button mode using the following command:
wpa_cli wps_pbc
(or) to connect using PIN method, use the following command:sudo wpa_cli wps_pin any <the pin>
- To connect to an unsecured
AP:
- Run the DHCP service.
If the IP address can be allocated from the AP automatically, start the DHCP client using the following command:
#dhcpcd wlan0 &
Note: If the AP does not support the DHCP service, manually set the static IP address value using theifconfig wlan0 xxx,xxx.xxx.xxx
command. - Check and validate the connection
status using the following
commands:
# wpa_cli status bssid=88:9b:39:f3:d0:4d ssid=User_AP id=0 mode=station pairwise_cipher=NONE group_cipher=NONE key_mgmt=NONE wpa_state=COMPLETED ip_address=192.168.43.2 address=00:80:c2:b3:d7:4d
The user can save and use the network information to automatically connect to the network using the
wpa_cli save
command in Linux.