Getting TI MCP drivers working on Android

=MCP 2.5.1 Wilink: Description=

MCP WLAN source code was tested as a component standalone driver on OMAP4 Blaze ES 2.2 platform with 1283 PG2.21 Connectivity hardware

Highlights:
The features are supported in MCP 2.5.1


 * Scanning for AP's and listing the SSID
 * Connecting to the available AP's
 * Web browsing
 * WLAN security (WEP40, WEP128, WPA, WPA2)
 * Roaming (WLAN TI CLI)
 * QoS
 * BT-WLAN Coexistence
 * STA WPS Security
 * HotSpot/SoftAP
 * SoftAP WPS(TIAP CLI)
 * EAP PEAP and TLS
 * 802.11a
 * Ad-hoc(WLAN TI CLI)

Following are improved in SoftAP 2.09
 * Support up to 8 Clients
 * Background Scanning
 * AP Suspend/Resume
 * AP with ACL and SCO
 * SW Recovery
 * ERP Protection
 * High speed SDIO support

=Procedure to build WLAN and test on Android FS=

This section explains the build procedure for including WLAN 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.


 * Step1: Build the kernel with WLAN specific configurations
 * Step2: Build the WLAN driver
 * Step3: Builds Android File System which builds wlan_loader, wlan_cu and also places tiwlan.ini and other wifi related files in /system/etc/wifi location of file system.

Note:
 * Step1 and step2 needs to be done in order. It doesn’t matter when you do step3.
 * Use the same kernel that you built in step1 to use with the WLAN drivers built in step2

To enable WLAN on the Blaze Board Linux Kernel

 * Changes in the Linux Configuration for Kernel Building:


 * 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 3 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
 * Build the Kernel:


 * 1) make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- android_4430_defconfig
 * 2) make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- uImage

WLAN Build Procedures
WLAN Driver location: hardware/ti/wlan/wl1283
 * How to build WLAN driver:


 * Go to the build path:


 * 1) cd platform/os/linux
 * Update following environment variables:

export PATH=:$PATH export CROSS_COMPILE=arm-none-linux-gnueabiexport ARCH=arm export KERNEL_DIR=


 * Start the build:


 * 1) 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 	Obtained from ClearCase or CDP (proprietary)

SOFTAP Build Procedure
WLAN Driver location: hardware/ti/wlan/wl1283_softAP/
 * How to build SOftAP Driver:


 * Go to the build path:


 * 1) cd platforms/os/linux


 * Update the following environment variables:

export PATH=:$PATH export CROSS_COMPILE=arm-none-linux-gnueabiexport ARCH=arm export KERNEL_DIR=


 * Start the build:


 * 1) make TNETW=1283


 * Place where the target files are placed after build:

Module 		File Name 	Location WLAN Driver 	tiap_drv.ko 	platform/os/linux/ INI File 	tiwlan_ap.ini 	config/ FIRMWARE 	firmware_ap.bin Obtained from ClearCase or CDP (proprietary)

ANDROID File system build
Build ANDROID file system so that all configuration file required for WLAN are placed in appropriate location. Also wlan_loader and wlan_cu are built as part of Android file system.
 * How to build up Android File System for WLAN Driver


 * Make sure device/ti/blaze/BoardConfig.mk has all wifi related definitions:

BOARD_WPA_SUPPLICANT_DRIVER := CUSTOM BOARD_WLAN_DEVICE := wl1283 BOARD_SOFTAP_DEVICE := wl1283 WPA_SUPPLICANT_VERSION := VER_0_6_X WIFI_DRIVER_MODULE_PATH := "/system/etc/wifi/tiwlan_drv.ko" WIFI_DRIVER_MODULE_NAME := "tiwlan_drv" WIFI_FIRMWARE_LOADER := "wlan_loader"
 * Make sure the system property file:

device/ti/blaze/system.prop
 * has definition for wifi interface:

wifi.interface=tiwlan0

Android GUI
Once you have the kernel, WLAN driver and file system built and setup follow the procedure below to setup and test WLAN on Android. Menu --> Settings --> Wireless & Networks --> WiFi Settings
 * Place the files tiwlan_drv.ko and firmware.bin in the folder /system/etc/wifi of file system
 * Make sure /system/etc/wifi folder also has tiwlan.ini and wpa_supplicant.conf file. These are placed in the location when file system is built.
 * Make sure you use the same kernel that you built in step1 with the drivers generated in step2.
 * Bring up the Android board. Once you have the UI up and running you can turn on WLAN by going to:

Using WLAN TI CLI interface (non GUI)
NOTE: placed in appropriate place by the framework.
 * Before starting to use WLAN TI CLI turn on wifi once using GUI so that the wpa_supplicant files are
 * Once you have the kernel, WLAN driver and file system built and setup follow the procedure below to setup and test WLAN on Android.


 * Place the files:

tiwlan_drv.ko and firmware.bin
 * in folder:

/system/etc/wifi of your filesystem


 * Make sure:

/system/etc/wifi folder also has tiwlan.ini and wpa_supplicant.conf

These are placed in the location when file system is built


 * Insert WLAN driver kernel module:


 * 1) insmod tiwlan_drv.ko
 * Load the firmware and bring the interface up by issuing commands below. Use appropriate IP address:


 * 1) start wlan_loader
 * 2) ifconfig tiwlan0 192.168.0.101 netmask 255.255.255.0
 * Start wpa_supplicant by this command:


 * 1) start wpa_supplicant
 * Launch the WLAN TI CLI with supplicant and start executing wlan commands:

OR
 * 1) wlan_cu –itiwlan0 // Connect with supplicant and start executing wlan commands
 * 1) wlan_cu –b // Bypass supplicant and for calibration

TxBip Calibration Procedure
Follow the above mentioned test setup Using WLAN TI CLI interface (non GUI): wlan_cu –b


 * Run the following commands:

―/ w p 1 l 2 f 2‖ ―/ t b v 21‖ ―/ t b t 1 1 1 1 1 1 1 1 ‖


 * Now you have a NVS File in your setup:


 * Make sure your MAC address is updated and unique. Turn off and turn on Wifi to have the NVS file to take effect

Note:
 * Don’t turn on wifi using UI for calibration
 * This calibration is board specific so NVS file generated on one board cannot be used on another OMAP4 board.
 * It is one time procedure for a board

Scan & Connect

 * On the Android UI go to:

Menu --> Settings --> Wireless & Networks --> WiFi Settings
 * Click on:

Turn on WiFi You should see that wifi is turned on and list of available Access Points (AP) are shown
 * Click on any AP you wish to connect and click on:

Connect You should see that it acquires IP address from that AP and gets connected
 * If it fails turn off wifi and turn on again:

Web Browsing

 * Follow the procedure in section Scan & Connect to connect to a desired AP
 * Now launch the browser and start using it for web browsing

WLAN Security
WLAN driver supports WEP (40 bit), WEP (128bit), WPA-PSK (TKIP) and WPA2-PSK (AES)
 * 1) Configure the AP to one of the security type above with appropriate passkey
 * 2) Follow the procedure in section Scan & Connect to scan for networks
 * 3) Click on the AP SSID that you configured for security, enter the passkey and click connect
 * 4) You should be now connected to AP with security

Ad-hoc (CLI)
Ad-hoc (IBSS) or peer to peer connection can be tested only with WLAN TI CLI. Joining existing Ad-Hoc network
 * Create an Ad-hoc network in any laptop which has wifi.
 * 1) When creating the ad-hoc network choose Network Authentication as open and Data Encryption as disabled:
 * 2) Disable all other interfaces on that Laptop:
 * 3) Configure a static IP address for the wifi interface on laptop:
 * On OMAP4 follow the procedure in section 3.1 to launch the WLAN TI CLI
 * After launching the CLI do the following
 * 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):
 * Now you should be connected to Ad-Hoc network

Roaming (CLI)
# 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)
 * Roaming feature of WiFi can also be tested only through WLAN TI CLI.
 * 1) Have 2 AP configured with same SSID.
 * 2) On OMAP4 follow the procedure in section 3.1 to launch the WLAN TI CLI
 * 3) After launching the CLI do the following to enable roaming
 * Now if you turn off the AP that Blaze board was connected to it will automatically connect to the other AP with same SSID

SOFT AP Setup

 * 1) Once you have the kernel, SOFT AP driver and file system built follow the procedure below to setup and test SOFT AP on Android. Place the files tiap_drv.ko and firmware_ap.bin in the folder of /system/etc/wifi/softap
 * 2) Make sure /system/etc/wifi/softap folder also has tiwlan_ap.ini and hostapd.conf. These are placed in the location when file system is built.
 * 3) Make sure you use the same kernel that you built in step1 with the drivers generated in step2

SOFT AP Testing
Note: Before making OMAP4 in AP mode make sure normal wifi is turned off and similarly if you want to use normal wifi turn off AP mode. Settings --> Wireless & Networks --> Tethering & HotSpot
 * 1) SoftAP can now be tested through HotSpot option in Android UI.
 * 2) Click
 * to configure and start using:

SOFT AP Testing TI CLI(non GUI)

 * Please follow section SOFT AP Setup:
 * cd:

/system/etc/wifi/softap
 * Insert kernel modules:


 * 1) insmod tiap_drv.ko
 * Load the firmware and bring the interface up by issuing commands below:
 * Use appropriate IP address:


 * 1) start wlan_ap_loader
 * 2) ifconfig tiap0 up
 * Start hostapd by this command:
 * Before starting hostapd make sure you have:

hostapd.conf
 * file placed in /data/misc/wifi of your file system:


 * 1) start hostapd
 * Launch the WLAN SOFT API CLI with supplicant and start executing tiap commands:


 * 1) tiap_cu -b

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

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


 * Ensure that the Android system date and time are set appropriately, as the certificate validation is dependent on these parameters.
 * Ensure that a valid certificate is provided to you from the administrator in pkcs12 format.
 * Rename the certificate from .pfx to .p12 and place it in root of SD card(1st partition)

# Enter the password to extract the certificates when prompted(password must be same that you specified while exporting the certificate) # Enter for Name the certificate # Enter credential storage password that you have set in step (a) You should see that certificate installed message is displayed:
 * To install the certificate on the OMAP4 Blaze
 * 1) Goto Settings -> Location & Security -> Use secure credentials. Type credential storage password minimum 8 characters.
 * 2) Goto Settings -> Location & Security -> Install from SD card
 * 3) Click on .p12 and give the following credentials

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.
 * 1) Goto Settings --> Wireless & Networks --> WiFi Settings

You should see that it acquires IP address from that AP and gets connected

802.11a (CLI)
802.11 a 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 (a) mode and select the channel (40) in the AP
 * 2) On OMAP4 follow the procedure in section 3.1 to launch the WLAN TI CLI
 * 3) After launching the CLI do the following
 * Register ScanComplete event (/ v r 5)

- / a a - g 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

=Summary=
 * 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