Porting MCP WLAN to Android

From OMAPpedia

Revision as of 16:31, 25 April 2011 by ElizaK (Talk | contribs)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to: navigation, search

Contents

[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

For the details of SoftAP porting and testing on Android platform, please refer to 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.

Note:

[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 WiFi HW 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 (...device/ti/blaze/) file
BOARD_WPA_SUPPLICANT_DRIVER := CUSTOM
choose the supplicant version for GingerBread:
WPA_SUPPLICANT_VERSION := VER_0_6_X
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:
BOARD_WLAN_DEVICE := wl1283
In our case, Android builds the following components
So We specify the folder and name of the driver module in BoardConfig.mk:
BOARD_SOFTAP_DEVICE := wl1283
WIFI_DRIVER_MODULE_PATH := "/system/etc/wifi/tiwlan_drv.ko"
WIFI_DRIVER_MODULE_NAME := "tiwlan_drv"
WIFI_FIRMWARE_LOADER := "wlan_loader"
By the way, make sure the system property file (device/ti/blaze/system.prop) has definition for wifi interface:
wifi.interface=tiwlan0
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/bg/n (2.4 and 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 again 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
...

Note:

[edit] Setup Android GUI for testings

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

[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
a)Goto 
  Settings -> Location & Security -> Use secure credentials 
  Type credential storage password minimum 8 characters.
b)Goto 
  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:
c)Goto
  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 (non GUI) for testings

NOTE:

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 192.168.0.101 netmask 255.255.255.0
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 WwiFi interface on the laptop:
Set management mode to Ad-hoc
#/ m m 0
Perform a scan
#/ a s
View the list of networks
#/ c b
Connect to the Ad-Hoc network you created on laptop
#/ c c name

[edit] Roaming (CLI)

  1. Have 2 AP configured with the same SSID.
  2. On OMAP4(Blaze), follow the procedured above to launch the WLAN TI CLI
  3. After launching the CLI, do the following to enable roaming
#/ g e
Store the scan policy in scan menu
#/ a p s
Start a scan
#/ a s
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 WLAN Iperf Instruction to measure WLAN throughput using iperf

[edit] Summary

OS Kernel: Linux® 2.6.35
WLAN Driver Version: MCP-WiLink_Driver_2.5.3.0.18
WLAN Firmware Version: Rev 7.1.3.10.54
SOFT AP Driver Version: WiLink_Driver_AP_6.2.0.0.50
SOFT AP Firmware Version: Rev 7.2.0.0.48
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
Namespaces
Variants
Actions
Navigation
Toolbox