Porting WLAN to Android

From OMAPpedia

Jump to: navigation, search


[edit] MCP 2.5.1 WiLink Driver: Description

MCP WiLink Driver 2.5.1 source code was tested as a standalone component on OMAP4 Blaze / OMAP4 BlazeTablet platforms with WiLink 1283 PG2.21 connectivity hardware.

[edit] WLAN features are supported

[edit] Improvements in SoftAP 2.09

Porting and Testing SoftAP on Android

[edit] Procedures to port WLAN driver on Android File System (AFS)

This section explains the build procedure of porting WLAN driver in Android on OMAP4 platform. Refer to www.omapzoom.org website for instructions on how to create a repo. Once you have the repo ready, follow the steps below.


[edit] To Enable WLAN on Linux Kernel

 # make menuconfig
Enable wireless extension in networking support (Default setting):
 [*] Networking Support --->
 [*] Wireless --->
Enable MMC5 support in OMAP:
 Device Drivers --->
 <*> MMC/SD/SDIO card Support --->
 <*> TI OMAP High Speed Multimedia Card Interface support
Disable Module Versioning Support:
 [*] Enable loadable module support --->
 [ ] Module versioning support
Enable TI WLAN enhanced SDIO support and interface controller number to 5 in system type:
 System Type --->
 [*] Enable WiFi control function abstraction
 [*] TI WLAN Enhanced SDIO Controller support
 (5) MMC Controller number that TI WLAN chip is connected to
Update following environment variables and build the Kernel:

Please note Toolchain required is 2010q1-202.[1]

 # export YOUR_PATH=`pwd`
 # export PATH=${YOUR_PATH}/u-boot/tools:${PATH} //path of mkimage for uImage
 # export PATH=$PATH:${YOUR_PATH}/toolchain/arm-2010q1/bin //path of cross complier
 # cd ${YOUR_PATH}/kernel/android-2.6.35 
 # export CROSS_COMPILE=arm-none-linux-gnueabi-
 # export ARCH=arm
 # make android_4430_defconfig
 # make uImage

[edit] To Build WLAN Driver Procedures

Go to WLAN Driver location:
# cd hardware/ti/wlan/wl1283
Go to the build path:
# cd platform/os/linux
Update following environment variables:
# export KERNEL_DIR = ${YOUR_PATH}/kernel/android-2.6.35 
Start the build:
# make TNETW=1283
Place where the target files are placed after build:
Module 		File Name 	Location
WLAN Driver 	tiwlan_drv.ko 	platform/os/linux/
INI File 	tiwlan.ini 	config/
FIRMWARE 	firmware.bin 	downloaded from https://gforge.ti.com/gf/project/wilink_drivers/

[edit] Porting WLAN Driver To ANDROID File system (AFS)

This section we showed how to build ANDROID file system with all configuration files required for WLAN are placed in appropriate locations. And also wlan_loader and wlan_cu are built as part of Android file system. The functionality of wlan loader is used to download the WLAN firmware. The configuration utility (wlan_cu) provided by TI is used to configure WLAN driver and firmware, and to perform most WLAN operations, such as scanning, connecting, TX, RX, and calibration procedures.

Android uses a modified wpa_supplicant daemon for wifi support which is controlled through a socket by WiFiHW that gets controlled from Android UI through android.net.wifi package.

Location and versions:
wpa_supplicant ver 0.5.x --> ${YOUR_PATH}/external/wpa_supplicant
wpa_supplicant ver 0.6.x --> ${YOUR_PATH}/external/wpa_supplicant_6
wpa_supplicant library --> ${YOUR_PATH}/hardware/ti/wlan/wl1283/wpa_supplicant_lib/
To tell the Android build system to build supplicant with custom wpa_supplicant_library we add below lines to BoardConfig.mk file
choose the supplicant version for GingerBread:
The way WiFi driver in Gingerbread is selected by the variable of BOARD_WLAN_DEVICE in BoardConfig.mk file. We just specify the folder name of driver located in mydroid/hardware/ti/wlan folder as value of the variable:
In our case, Android builds the following components
So We specify the folder and name of the driver module and SoftAP in BoardConfig.mk:
WIFI_DRIVER_MODULE_PATH := "/system/etc/wifi/tiwlan_drv.ko"
WIFI_FIRMWARE_LOADER := "wlan_loader"
By the way, make sure the system property file (device/ti/blaze/system.prop)has definition for wifi interface:
Finally, these files need to be placed in properly locations on target platform before testing:
Kernel image         --> /root/uImage
Driver module        --> /system/etc/wifi/tiwlan_drv.ko
WLAN Firmware file   --> /system/etc/wifi/firmware.bin

[edit] Testing WiFi on Blaze Platform with GingerBread

[edit] TxBiP Calibration

Congratulation! Now you have the kernel, WLAN driver and file system built, follow the procedure below to calibrate and set up testing WLAN on Android platform.

[edit] TxBiP Calibration Procedure

The TX calibration aims to reduce/eliminate any temperature/voltage/process variations and to optimize the wireless performance. It is mandatory for every hardware plaform to have TxBip calibration before any testing or using. WLAN calibrations need to be applied by the customer as part of a TX BiP (TX Built In Production line testing).

Before executing calibration, you could see the following lines on your console as you turn on Wi-Fi:

TIWLAN: 1089.979242: Starting to process NVS...
TIWLAN: 1089.983698: No Nvs, Setting default MAC address
TIWLAN: 1089.989007: pHwInit->uEEPROMCurLen: 1c
TIWLAN: 1089.993462: ERROR: If you are not calibating the device, you will soon get errors !!!
Follow the procedures to perform calibration for your Blaze:
Insert WLAN driver kernel module:
# insmod system/etc/wifi/tiwlan_drv.ko
Load the firmware and bring the interface up by issuing commands below. Use appropriate IP address:
# start wlan_loader
# ifconfig tiwlan0 up
Launch the WLAN TI CLI with supplicant and start executing WLAN commands:
# wlan_cu –b // Bypass supplicant and for calibration
then, run the following commands:

For 802.11bg/n (2.4 GHz):

# / w p 1 l 2 f 2         //Activate the power and set default power level to be "Awake"
# / t b v 21              //Set the NVS to be Rev 2.1
# / t b t 1 0 0 0 0 0 0 0 //Filling MAC address to NVS 

For 802.11a (5 GHz):

# / w p 1 l 2 f 2
# / t b v 21
# / t b t 1 1 1 1 1 1 1 1
# / q
Now you have a NVS File in your setup:
remove the WLAN driver and finish the calibration:
# rmmod tiwlan_drv
Turn off and turn on Wifi to have the NVS file to take effect...
TIWLAN: 1109.092335: Working on a 1283 PG 2.21 board.
TIWLAN: 1109.126821: Starting to process NVS...
TIWLAN: 1109.131307: NVS found, EEPROM Image addr=0xeed03c00, EEPROM Len=0x0x1d4


[edit] Setup Android GUI for testings

Menu --> Settings --> Wireless & Networks --> WiFi Settings
Turn on WiFi

[edit] Web Browsing

[edit] WLAN Security

WLAN driver supports WEP (40 bit), WEP (128bit), WPA-PSK (TKIP) and WPA2-PSK (AES)

[edit] Enterprise Security: EAP PEAP and TLS

Please ensure that following lines are present in the init.rc file which are required for storing certification files (credentials) in Android system:
mkdir /data/misc/keystore 0777 keystore keystore
service keystore /system/bin/keystore /data/misc/keystore
   user keystore
  group keystore
 socket keystore stream 666
  Settings -> Location & Security -> Use secure credentials 
  Type credential storage password minimum 8 characters.
  Settings -> Location & Security -> Install from SD card 
  Click on <any name>.p12 and give the following credentials
     -Enter the password to extract the certificates when prompted(password must be same that you specified while exporting the certificate)
     -Enter <any name> for Name the certificate
     -Enter credential storage password that you have set in step (a) 
     You should see that certificate installed message is displayed:
  Settings --> Wireless & Networks --> WiFi Settings 
  You must see Access Point (AP) that you have configured in Enterprise security mode. 
  Click on AP that is secured with 802.1x EAP and give the following credentials
     -Select PEAP or TLS EAP method
     -Phase 2 authentication None
     -CA certificate Name that you have installed
     -Client certificate Name that you have installed
     -Identity the User Identity
     -Anonymous Identity blank
     -Wireless password
  Click on "Connect".
  You should see that it acquires IP address from that AP and gets connected

[edit] Using WLAN TI CLI interface (non GUI)for testings


Insert WLAN driver kernel module:
# insmod tiwlan_drv.ko
Load the firmware and bring the interface up by issuing commands below. Use appropriate IP address:
# start wlan_loader
# ifconfig tiwlan0 netmask
Start wpa_supplicant by this command:
# start wpa_supplicant
Launch the WLAN TI CLI with supplicant and start executing wlan commands:
# wlan_cu –itiwlan0 // Connect with supplicant and start executing wlan commands

[edit] Ad-hoc (CLI)

Ad-hoc (IBSS) or peer to peer connection can be tested only with WLAN TI CLI. Joining existing Ad-Hoc network

  1. When creating the ad-hoc network choose Network Authentication as "open" and Data Encryption as "disabled":
  2. Disable all other wireless interfaces on that laptop:
  3. Configure a static IP address for the wifi interface on the laptop:
  1. Set management mode to Ad-hoc (/ m m 0)
  2. Perform a scan (/ a s)
  3. View the list of networks (/ c b)
  4. Connect to the Ad-Hoc network you created on laptop (/ c c name)

[edit] Roaming (CLI)

  1. Have 2 AP configured with same SSID.
  2. On OMAP4(Blaze), follow the procedure above to launch the WLAN TI CLI
  3. After launching the CLI do the following to enable roaming
  4. Enable roaming (/ g e)
  5. Store the scan policy in scan menu (/ a p s)
  6. Start a scan (/ a s)
  7. Connect to the AP name that you configured (/ c c SSID)

[edit] Iperf (Throughput Measurement)

Iperf instructions are in separate document. Follow the procedure mentioned in WCG_WLAN_Android_Iperf_Instruction.doc to measure WLAN throughput using iperf

[edit] 802.11a (CLI)

802.11a mode can also be tested only through WLAN TI CLI. (copy tiwlan_dual.ini from the clearcase and rename to tiwlan.ini into folder system/etc/wifi)

  1. Enable 802.11a mode and select the channel (40) in the AP
  2. On OMAP4 follow the procedure in "Using WLAN TI CLI interface" to launch the WLAN TI CLI
  3. After launching the CLI, do the following procedures
Register ScanComplete event (/ v r 5)
- / a a
- g <empty> 1 1 3 32 0 12
- c 0 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 36
- c 1 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 40
- c 2 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 44
- c 3 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 48
- c 4 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 52
- c 5 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 56
- c 6 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 60
- c 7 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 64
- c 8 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 149
- c 9 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 153
- c 10 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 157
- c 11 ff:ff:ff:ff:ff:ff 60000 30000 0 0 250 161
- d
- ..
- s
- / c b
- / c c ssid
Wait for IpcEvent_PrintEvent - received IPC_EVENT_SCAN_COMPLETE message
View the list of networks (/ c b)
You should be able to see the AP that is configured for (1) band and verify the channel it is operating in is 40
Connect to the network (/ c c name)
Now you should be connected to network

Note: You can refer to WLAN Firmware and Calibration for the RF calibration in 802.11a.

[edit] Summary

OS Kernel: Linux® 2.6.35
WLAN Driver Version: MCP-WiLink_Driver_2.
WLAN Firmware Version: Rev
SOFT AP Driver Version: WiLink_Driver_AP_6.
SOFT AP Firmware Version: Rev
Hardware: OMAP4 Blaze(ES 2.2) (with 1283 PG 2.21 Connectivity device)

GIT Project: git://git.omapzoom.org/platform/hardware/ti/wlan.git
Commit Id: 263d8ce082a823185ea0e13d8ccd58491b13177a

Back to Connectivity Home Page

Personal tools