LSR TiWi WL-1271 WiFi

From RidgeRun Developer Wiki

Enable kernel drivers

Configure the kernel so there variable are set as follows:

CONFIG_WL1271=m
CONFIG_WL1271_SDIO=m
CONFIG_WL12XX_PLATFORM_DATA=y
CONFIG_WIRELESS=y
CONFIG_WIRELESS_OLD_REGULATORY=y
CONFIG_WIRELESS_EXT=y
CONFIG_WIRELESS_EXT_SYSFS=y

Enable helper applications

Configure the Wifi tools so they get built.

CONFIG_FS_APPS_WIRELESS_TOOLS=y
CONFIG_FS_APPS_WPASUPPLICANT=y
ONFIG_FS_APPS_COMPAT_WIRELESS_MISTRAL=y
CONFIG_FS_APPS_TI_WIRELESS_UTILS=y

Kernel hardware detection

When you load the WL1271 SDIO driver, the kernel will detect the hardware:

modprobe wl12xx_sdio

with output similar to:

compat-wireless backport release: compat-wireless-2011-12-05-1-g84dbe2c
Backport based on wl12xx.git v2.6.39-1328-g0890f48
cfg80211: Calling CRDA to update world regulatory domain
mmc1: card claims to support voltages below the defined range. These will be ignored.
mmc1: new SDIO card at address 0001
wl1271: loaded

You may see mmc0 depending on which SD slot is used.

Several drivers were also loaded by modprode, you can see this using lsmod

lsmod

with output similar to:

wl12xx_sdio 3494 0 - Live 0xbf10c000
wl12xx 142792 1 wl12xx_sdio, Live 0xbf0dc000
compat_firmware_class 5457 1 wl12xx, Live 0xbf0d4000
mac80211 255433 1 wl12xx, Live 0xbf07e000
cfg80211 151074 2 wl12xx,mac80211, Live 0xbf048000
compat 16833 3 wl12xx,mac80211,cfg80211, Live 0xbf03a000

Verifying WL1271 chip detect

On a DM368 or DM365, the following entries should exist in sysfs.

For SD slot 0:

cd /sys/devices/platform/davinci_mmc.0/mmc_host/mmc0/mmc0:0001/mmc0:0001:1
echo class: `cat class`, vendor: `cat vendor`, device: `cat device`

For SD slot 1:

cd /sys/devices/platform/davinci_mmc.1/mmc_host/mmc1/mmc1:0001/mmc1:0001:1
echo class: `cat class`, vendor: `cat vendor`, device: `cat device`

The output should be:

class: 0x02, vendor: 0x0097, device: 0x4076

Verifying SDIO hardware interface configuration

The debugfs file system contains entries that contain the current settings for the MMC/SD/SDIO interface of interest.

mount -t debugfs none /sys/kernel/debug
cat /sys/kernel/debug/mmc0/ios
cat /sys/kernel/debug/mmc1/ios

with output similar to:

clock:		25000000 Hz
vdd:		20 (3.2 ~ 3.3 V)
bus mode:	2 (push-pull)
chip select:	0 (don't care)
power mode:	2 (on)
bus width:	2 (4 bits)
timing spec:	0 (legacy)

If you don't see any output, you may need to increase the printk debug level:

echo 8 > /proc/sys/kernel/printk

or you can look in the kernel message buffer

dmesg | tail -n 6

Verifying wlan0 exists

Make sure Linux network interface and wireless LAN interface are both found

ifconfig wlan0
iw list | head -n 13

You should get output like:

wlan0     Link encap:Ethernet  HWaddr 84:DD:20:D7:C4:B6  
          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)

Wiphy phy0
	Band 1:
		Capabilities: 0x130
			HT20
			Static SM Power Save
			RX Greenfield
			RX HT20 SGI
			RX STBC 1-stream
			Max AMSDU length: 3839 bytes
			No DSSS/CCK HT40
		Maximum RX AMPDU length 8191 bytes (exponent: 0x000)
		Minimum RX AMPDU time spacing: 8 usec (0x06)

Power on WiFi sub-system

ifconfig wlan0 up

with output:

wl1271: firmware booted (Rev 6.3.6.0.79_1)
wl1271: Driver version: R4_SP2_02_03

Scan for access points

iw wlan0 scan

which lists access points that are in range. Output from a XyXEL MWR102 looks lie:

BSS fc:8f:c4:09:55:0a(on wlan0)
	TSF: 104973623 usec (0d, 00:01:44)
	freq: 2412
	beacon interval: 100 TUs
	capability: ESS Privacy ShortSlotTime (0x0411)
	signal: -45.00 dBm
	last seen: 1710 ms ago
	Information elements from Probe Response frame:
	SSID: ZyXEL-09550B
	Supported rates: 1.0* 2.0* 5.5* 11.0* 6.0 9.0 12.0 18.0 
	DS Parameter set: channel 1
	ERP: <no flags>
	Extended supported rates: 24.0 36.0 48.0 54.0 
	HT capabilities:
		Capabilities: 0x182c
			HT20
			SM Power Save disabled
			RX HT20 SGI
			No RX STBC
			Max AMSDU length: 7935 bytes
			DSSS/CCK HT40
		Maximum RX AMPDU length 32767 bytes (exponent: 0x002)
		Minimum RX AMPDU time spacing: 16 usec (0x07)
		HT RX MCS rate indexes supported: 0-7
		HT TX MCS rate indexes are undefined
	HT operation:
		 * primary channel: 1
		 * secondary channel offset: no secondary
		 * STA channel width: 20 MHz
		 * RIFS: 0
		 * HT protection: no
		 * non-GF present: 0
		 * OBSS non-GF present: 0
		 * dual beacon: 0
		 * dual CTS protection: 0
		 * STBC beacon: 0
		 * L-SIG TXOP Prot: 0
		 * PCO active: 0
		 * PCO phase: 0
	WPA:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: TKIP
		 * Authentication suites: PSK
	RSN:	 * Version: 1
		 * Group cipher: TKIP
		 * Pairwise ciphers: CCMP
		 * Authentication suites: PSK
		 * Capabilities: 1-PTKSA-RC 1-GTKSA-RC (0x0000)
	WMM:	 * Parameter version 1
		 * 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
	WPS:	 * Version: 1.0
		 * Wi-Fi Protected Setup State: 1 (Unconfigured)
		 * Response Type: 3 (AP)
		 * UUID: 63041253-1019-2006-1228-fc8fc409550a
		 * Manufacturer: Realtek Semiconductor Corp.
		 * Model: RTL8xxx
		 * Model Number: EV-2010-09-20
		 * Serial Number: 123456789012347
		 * Primary Device Type: 6-0050f204-1
		 * Device name: RTK_AP_2x
		 * Config methods: Display, PBC
		 * Unknown TLV (0x1049, 6 bytes): 00 37 2a 00 01 20

Attaching WiFi to access point

Check current connection status

iw dev wlan0 link

with output expected to be

Not connected.

You can check the connection status after your attempts to connect to an access point.

Security disabled

iw dev wlan0 connect -w "ZyXEL-09550B"

WEP security

iw dev wlan0 connect -w "ZyXEL-09550B" key 0:0001020304

WPA security

mkdir -p /etc/wpa_supplicant
cat <<EOF >/etc/wpa_supplicant/wpa_supplicant.conf
# Example wpa_supplicant 
network={
	ssid="ZyXEL-09550B"
	psk="2B9300D8"
	priority=5
}
EOF

wpa_supplicant -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf -Dnl80211 -B

With debug output enabled, you will have lots of information on what is not working if you run into a problem. If all goes well, the output will end with:

wl1271: Association completed.

Verifying access point association

You can check you are associated with an access point using

iw dev wlan0 link

With example output being:

Connected to fc:8f:c4:09:55:0a (on wlan0)
	SSID: ZyXEL-09550B
	freq: 2412
	RX: 698 bytes (5 packets)
	TX: 24 bytes (1 packets)
	signal: -45 dBm
	tx bitrate: 48.0 MBit/s

	bss flags:	short-slot-time
	dtim period:	1
	beacon int:	100

If you are having trouble associating with an access point, I find connecting to the AP with my laptop is a good way to verify the AP is configured as expected.

Configuring IP networking

The ZyXEL MWR102 access point that I tested with is pre-configured to use IP address 192.168.100.1

ifconfig wlan0 192.168.100.200
route add -net 0.0.0.0 gw 192.168.100.1 netmask 0.0.0.0 dev wlan0
route -n

With example output:

Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
192.168.100.0   0.0.0.0         255.255.255.0   U     0      0        0 wlan0
0.0.0.0         192.168.100.1   0.0.0.0         UG    0      0        0 wlan0

Functional test

The Google nameserver, which supports ping, is at IP address 8.8.8.8.

ping -c 5 8.8.8.8