AM37x Wireless Connectivity NLCP WLAN Station Terminal

'''  Content is no longer maintained and is being kept for reference only! '''

WLAN Demo usecases
'''  Content is no longer maintained and is being kept for reference only! ''' That Demo use case will provide guides for:
 * Setting the EVM to work as a WiFi station
 * Connect to WiFi network (were we demonstrate 3 options: non secured network, WPA secured network and WPA2 secured network)
 * Set the WLAN MAC and IP address
 * Perform basic traffic transfer (using Ping and Netperf tools)
 * Web Browsing
 * demonstrating the Suspend Resume feature

Running WLAN commands - Basic information
Following are the basic commands used for the Wireless Demo

IW commands
for more detailed information please access the following links:
 * wl12xx IW commands

WPA supplicant commands
please see some examples to wpa_supplicant.txt in the connection to WiFi networks examples below. for more detailed information please access the following links:
 * wl12xx wpa supplicant
 * how to edit configuration file
 * wpa supplicant commands Linux man page
 * wpa supplicant home page

Calibration
for more detailed information please access the following links:
 * wl12xx Calibration
 * wl12xx Calibration Page

How to operate the EVM as WLAN station
There are 3 methods can be used in order to connect to Access point
 * 1) IW commands (mostly used for debug, without Supplicant)
 * 2) WPA supplicant commands
 * 3) WPA supplicant auto connect based on configuration file

WPA supplicant commands
before starting the connection procedure, we first need to run the WPA supplican. Also please note that the following command should be run only once per boot and then modify the security by setting the right commands as describe in the following section root@am37x-evm:/usr/sbin# wpa_supplicant -d -Dnl80211 -c/etc/wpa_supplicant.conf -iwlan0 -B

Connect to non secured network
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt NONE wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"Matterhorn"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

connect to secured network - WPA
wpa_cli -iwlan0 disconnect for i in `wpa_cli list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK wpa_cli -iwlan0 set_network 0 psk '"12345678"' wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

connect to secured network - WPA2
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK wpa_cli -iwlan0 set_network 0 psk '"12345678"' wpa_cli -iwlan0 set_network 0 proto RSN wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"Matterhorn"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

connect to secured network - any WPA PSK
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-PSK wpa_cli -iwlan0 set_network 0 psk '"12345678"' wpa_cli -iwlan0 set_network 0 pairwise CCMP TKIP wpa_cli -iwlan0 set_network 0 group CCMP TKIP wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status

connect to secured network - WEP 40 Open
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 wep_key0 1234567890 wpa_cli -iwlan0 set_network 0 key_mgmt NONE wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

connect to secured network - WEP 128 Open
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 wep_key0 ABCdef1234567890abcDEF3333 wpa_cli -iwlan0 set_network 0 key_mgmt NONE wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

Enterprise enviroment: connect to WPA EAP TLS
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP wpa_cli -iwlan0 set_network 0 pairwise TKIP wpa_cli -iwlan0 set_network 0 group TKIP wpa_cli -iwlan0 set_network 0 proto WPA wpa_cli -iwlan0 set_network 0 eap TLS wpa_cli -iwlan0 set_network 0 identity '"test"' wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"' wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"' wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"' wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

Enterprise enviroment: connect to WPA EAP PEAP0
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP wpa_cli -iwlan0 set_network 0 pairwise TKIP wpa_cli -iwlan0 set_network 0 group TKIP wpa_cli -iwlan0 set_network 0 proto WPA wpa_cli -iwlan0 set_network 0 eap PEAP wpa_cli -iwlan0 set_network 0 identity "test" wpa_cli -iwlan0 set_network 0 password "test" wpa_cli -iwlan0 set_network 0 phase1 "peapver=0" wpa_cli -iwlan0 set_network 0 phase2 "MSCHAPV2" wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

Enterprise enviroment: connect to WPA2 EAP TLS
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 proactive_key_caching 1 wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP wpa_cli -iwlan0 set_network 0 pairwise CCMP wpa_cli -iwlan0 set_network 0 group CCMP wpa_cli -iwlan0 set_network 0 proto WPA2 wpa_cli -iwlan0 set_network 0 eap TLS wpa_cli -iwlan0 set_network 0 identity '"test"' wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"' wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"' wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"' wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

Enterprise enviroment: connect to WPA EAP PEAP0
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP wpa_cli -iwlan0 set_network 0 pairwise CCMP wpa_cli -iwlan0 set_network 0 group CCMP wpa_cli -iwlan0 set_network 0 proto WPA2 wpa_cli -iwlan0 set_network 0 eap PEAP wpa_cli -iwlan0 set_network 0 identity '"test"' wpa_cli -iwlan0 set_network 0 password '"test"' wpa_cli -iwlan0 set_network 0 phase1 '"peapver=0"' wpa_cli -iwlan0 set_network 0 phase2 '"MSCHAPV2"' wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link

Enterprise enviroment: connect to any WPA EAP TLS
wpa_cli -iwlan0 disconnect for i in `wpa_cli -iwlan0 list_networks | grep ^[0-9] | cut -f1`; do wpa_cli -iwlan0 remove_network $i; done wpa_cli -iwlan0 add_network wpa_cli -iwlan0 set_network 0 auth_alg OPEN wpa_cli -iwlan0 set_network 0 key_mgmt WPA-EAP wpa_cli -iwlan0 set_network 0 proto WPA2 wpa_cli -iwlan0 set_network 0 eap TLS wpa_cli -iwlan0 set_network 0 identity '"test"' wpa_cli -iwlan0 set_network 0 client_cert '"/etc/certs/cert.pem"' wpa_cli -iwlan0 set_network 0 private_key '"/etc/certs/key.pem"' wpa_cli -iwlan0 set_network 0 private_key_passwd '"test"' wpa_cli -iwlan0 set_network 0 mode 0 wpa_cli -iwlan0 set_network 0 ssid '"vic_BSS"' wpa_cli -iwlan0 select_network 0 wpa_cli -iwlan0 enable_network 0 wpa_cli -iwlan0 reassociate wpa_cli -iwlan0 status iw wlan0 link
 * 1) wpa_cli -iwlan0 set_network 0 pairwise CCMP TKIP
 * 2) wpa_cli -iwlan0 set_network 0 group CCMP TKIP

Connect to non secured WiFi network
Bring up the WLAN port root@am37x-evm:/# ifconfig wlan0 10.1.7.220 netmask 255.255.255.0 up [  79.959808] wl1271: firmware booted (Rev 6.1.5.50.69) root@am37x-evm:/# ifconfig eth0 20.1.1.20 netmask 255.255.255.0 up root@am37x-evm:/# cd /usr/sbin/ perform Scan for WiFi networks root@am37x-evm:/usr/sbin# iw wlan0 scan In order to see reduced Scan results that contains SSID only root@am37x-evm:/usr/sbin# iw wlan0 scan | grep SSID

following is the Scan results BSS 00:19:a9:cd:c6:80 (on wlan0) TSF: 2984923701 usec (0d, 00:49:44) freq: 2412 beacon interval: 100 capability: ESS ShortPreamble ShortSlotTime (0x0421) signal: -45.00 dBm last seen: 429 ms ago SSID: Cisco1240 Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 DS Parameter set: channel 1 ERP: Extended supported rates: 24.0 36.0 48.0 54.0 WMM:	 * Parameter version 1 * u-APSD * BE: CW 15-1023, AIFSN 3 * BK: CW 15-1023, AIFSN 7 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec * VO: CW 3-7, AIFSN 2, TXOP 1504 usec BSS d0:d0:fd:69:ca:70 (on wlan0) TSF: 2968648942 usec (0d, 00:49:28) freq: 2462 beacon interval: 102 capability: ESS ShortPreamble ShortSlotTime (0x0421) signal: -70.00 dBm last seen: 328 ms ago SSID: Cisco1250 Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 DS Parameter set: channel 11 ERP: Extended supported rates: 24.0 36.0 48.0 54.0 WMM:	 * Parameter version 1 * u-APSD * BE: CW 15-1023, AIFSN 3 * BK: CW 15-1023, AIFSN 7 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec * VO: acm CW 3-7, AIFSN 2, TXOP 1504 usec Connect to Access point with SSID Cisco1250 root@am37x-evm:/usr/sbin# iw wlan0 connect -w Cisco1250 wlan0 (phy #0): [ 117.134643] wl1271: Association completed. connected to d0:d0:fd:69:ca:70 Verify the connection root@am37x-evm:/usr/sbin# iw wlan0 link Connected to d0:d0:fd:69:ca:70 (on wlan0) SSID: Cisco1250 freq: 2462 RX: 2080 bytes (23 packets) TX: 344 bytes (4 packets) signal: -70 dBm tx bitrate: 54.0 MBit/s root@am37x-evm:/usr/sbin#

Connect to secured WiFi network (WEP) - using IW command
Bring up the WLAN port root@am37x-evm:~# cd / root@am37x-evm:/# ifconfig wlan0 10.1.7.220 netmask 255.255.255.0 up [ 377.055969] wl1271: firmware booted (Rev 6.1.5.50.69) root@am37x-evm:/# ifconfig eth0 20.1.1.20 netmask 255.255.255.0 up Perform Scan for WiFi networks root@am37x-evm:/# cd /usr/sbin/ root@am37x-evm:/usr/sbin# iw wlan0 scan BSS 00:19:a9:cd:c6:80 (on wlan0) TSF: 1224147169 usec (0d, 00:20:24) freq: 2412 beacon interval: 100 capability: ESS Privacy ShortPreamble ShortSlotTime (0x0431) signal: -45.00 dBm last seen: 406 ms ago SSID: Cisco Supported rates: 1.0* 2.0* 5.5* 6.0 9.0 11.0* 12.0 18.0 DS Parameter set: channel 1 ERP: Extended supported rates: 24.0 36.0 48.0 54.0 WMM:    * Parameter version 1 * u-APSD * BE: CW 15-1023, AIFSN 3 * BK: CW 15-1023, AIFSN 7 * VI: CW 7-15, AIFSN 2, TXOP 3008 usec * VO: CW 3-7, AIFSN 2, TXOP 1504 usec Connect to Access Point root@am37x-evm:/usr/sbin# iw wlan0 connect -w Cisco key 0:1234567890

Connect to secured WiFi network (WEP) - using wpa supplicant
create wpa_supplicant.txt file and put it in the file system under /usr/sbin The wpa_supplicant.txt content defines the Access Point profile that we are about to connect too. ctrl_interface=/var/run/wpa_supplicant update_config=1

network={ ssid="Cisco" key_mgmt=NONE pairwise=NONE group=WEP40 auth_alg=OPEN wep_key0=1234567890 wep_key1=0000000000 wep_key2=0000000000 wep_key3=0000000000 } then run the following commend to connect root@am37x-evm:/usr/sbin# wpa_supplicant -d -Dnl80211 -c/usr/sbin/wpa_supplicant.txt -iwlan0 -B

Connect to secured WiFi network (WPA)
create wpa_supplicant.txt file and put it in the file system under /usr/sbin The wpa_supplicant.txt content defines the Access Point profile that we are about to connect too. ctrl_interface=/var/run/wpa_supplicant update_config=1

network={ ssid="Cisco" proto=WPA key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP psk="1234567890" priority=2 } then run the following commend to connect root@am37x-evm:/usr/sbin# wpa_supplicant -d -Dnl80211 -c/usr/sbin/wpa_supplicant.txt -iwlan0 -B

Connect to secured WiFi network (WPA2)
create wpa_supplicant.txt file and put it in the file system under /usr/sbin The wpa_supplicant.txt content defines the Access Point profile that we are about to connect too. ctrl_interface=/var/run/wpa_supplicant update_config=1

network={ ssid="Cisco" proto=WPA key_mgmt=WPA-PSK pairwise=CCMP TKIP group=CCMP TKIP psk="1234567890" priority=2 } then run the following commend to connect root@am37x-evm:/usr/sbin# wpa_supplicant -d -Dnl80211 -c/usr/sbin/wpa_supplicant.txt -iwlan0 -B

Getting IP address

 * Static IP
 * Dynamic IP (DHCP)

Passing Traffic (using Netperf)

 * Downstream TCP
 * Downstream UDP
 * Upstream TCP
 * Upstream UDP

Suspend Resume
There are 2 mode of operation:
 * 1) Shutdown mode
 * 2) Connection idle

Shutdown mode
Shutdown mode is the default mode, in that case the 1271 connectivity chip enters shutdown mode on suspend, it is done by cutting off the Power from the chip in suspend mode Assuming the Station is already connected to Access point and transfer data [ 3] 240.0-250.0 sec  23.6 MBytes  19.8 Mbits/sec [ 3] 250.0-260.0 sec  22.7 MBytes  19.0 Mbits/sec [ 3] 260.0-270.0 sec  23.0 MBytes  19.3 Mbits/sec [ 3] 270.0-280.0 sec  24.6 MBytes  20.6 Mbits/sec Enter to suspend mode by using the following command, and wait for several seconds to let the EVM to enter suspend mode and to the WLAN to disconnect from the WiFi network root@am37x-evm:/usr/bin# echo mem > /sys/power/state The following log shows that the Host is entering to suspend mode [ 9873.475219] PM: Syncing filesystems ... done. [ 9873.498291] PM: Preparing system for mem sleep [ 3] 280.0-290.0 sec  22.3 MBytes  18.7 Mbits/sec [ 9874.513397] Freezing user space processes ... (elapsed 0.01 seconds) done. [ 9874.539764] Freezing remaining freezable tasks ... (elapsed 0.02 seconds) done. [ 9874.570678] PM: Entering mem sleep [ 9874.575164] Suspending console(s) (use no_console_suspend to debug) [ 9874.584167] wl1271: down [ 9874.588775] wl1271: wl1271_suspend: wow_enabled: 0 [ 9874.819549] PM: suspend of devices complete after 235.900 msecs [ 9874.820892] PM: late suspend of devices complete after 1.342 msecs [ 9904.070861] Successfully put all powerdomains to target state [ 9904.071746] PM: early resume of devices complete after 0.762 msecs [ 9904.072265] platform iva.0: omap_voltage_scale: Already at the requestedrate 520000000 [ 9904.072265] platform mpu.0: omap_voltage_scale: Already at the requestedrate 600000000 Resume from Suspend by hitting any key on the terminal keyboard. Notice that after resume the WLAN driver will reconnect to the Access point and traffic will resumed automatically. [ 9904.552398] wl1271: wl1271 resume [ 9905.089660] wl1271: firmware booted (Rev 6.1.5.50.69) [ 9905.134307] PM: resume of devices complete after 1062.438 msecs [ 9905.202453] PM: Finishing wakeup. [ 9905.205963] Restarting tasks ... [ 3] 290.0-300.0 sec    778 KBytes    637 K bits/sec [  3] 300. [ 9905.223297] wlan0: deauthenticated from e0:91:f5:ea:9e:ee (Reason: 7) 0-310.0 sec 0.00 Bytes  0.00 bits/sec [ 3] 310.0-320.0 sec  0.00 Bytes  0.00 bits/sec [ 9905.241302] done.

root@am37x-evm:/usr/bin# [ 9905.360504] cfg80211: Calling CRDA to update world regulatory domain [ 9905.997711] wlan0: authenticate with e0:91:f5:ea:9e:ee (try 1) [ 9906.007141] wlan0: authenticated [ 9906.060241] wlan0: associate with e0:91:f5:ea:9e:ee (try 1) [ 9906.069732] wlan0: RX ReassocResp from e0:91:f5:ea:9e:ee (capab=0x411 status=0 aid=1) [ 9906.078033] wlan0: associated [ 9906.185882] wl1271: Association completed. [ 3] 320.0-330.0 sec  23.7 MBytes  19.9 Mbits/sec [ 3] 330.0-340.0 sec  25.2 MBytes  21.2 Mbits/sec [ 3] 340.0-350.0 sec  26.3 MBytes  22.0 Mbits/sec HOME