Porting WLAN to Android
From OMAPpedia
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
- Scanning for and listing AP's SSID
- Connecting to the available AP
- Web browsing
- WLAN security (WEP40, WEP128, WPA, WPA2)
- Roaming (WLAN TI CLI)
- QoS
- BT-WLAN Coexistence
- STA WPS Security
- HotSpot(aka: SoftAP)
- SoftAP WPS(supported via TIAP CLI)
- EAP PEAP and TLS
- 802.11a
- Ad-hoc(WLAN TI CLI)
[edit] Improvements in SoftAP 2.09
- Support up to 8 clients
- Background scanning
- AP with ACL and SCO
- ERP protection
- Support High Speed SDIO
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.
- Step1: Build the kernel with WLAN specific configurations
- Step2: Build the WLAN driver
- Step3: Builds Android File System which includes wlan_loader, wlan_cu. Also places tiwlan.ini and other wifi related files under the path of /system/etc/wifi.
Note:
- Step1 and step2 needs to be done in order and use the same kernel.
[edit] To Enable WLAN on Linux Kernel
- Make sure the Linux Configuration before Kernel Building:
# 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
- How to build WLAN driver:
- 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)
- How to build up Android File System with TI WLAN Driver
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
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
- wlan_loader
- wlan_cu
- wpa_supplicant_lib (driver_ti.c) and automatically copies tiwlan.ini and other configuration files to the appropriate location on target file system
- So We specify the folder and name of the driver module and SoftAP 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.
- 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 the kernel image as the WLAN drivers.
[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
Note:
- Never 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. Tx BIP should be run only once per platform. This calibration is board specific and and the data you get from it is saved to the NVS file, which generated on one board cannot be used on another OMAP4 board. By the way, you do not need to run Tx BIP again for costumer modifications in the INI file.
- Make sure your MAC address is updated and unique.
- Please refer to WLAN Firmware and Calibration for the details.
[edit] Setup Android GUI for testings
- Bring up the Android board. Once you have the UI up and running, you can turn on WLAN by going 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.
[edit] 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
[edit] WLAN Security
WLAN driver supports WEP (40 bit), WEP (128bit), WPA-PSK (TKIP) and WPA2-PSK (AES)
- Configure the AP to one of the security type above with appropriate passkey
- Follow the procedure in section Scan & Connect to scan for networks
- Click on the AP SSID that you configured for security, enter the passkey and click connect
- You should be now connected to AP with security
[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
- 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) - To install the certificate on the OMAP4 Blaze
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.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 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 interface (non GUI)for testings
NOTE:
- Before starting to use WLAN TI CLI, turn on wifi once using GUI so that the wpa_supplicant files are placed in appropriate place by the framework.
- 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
- Create an Ad-hoc network in any laptop which has wifi.
- When creating the ad-hoc network choose Network Authentication as "open" and Data Encryption as "disabled":
- Disable all other wireless interfaces on that laptop:
- Configure a static IP address for the wifi interface on the laptop:
- On OMAP4 platform(Blaze), follow the procedure above to launch the WLAN TI CLI
- After launching the CLI do the following
- 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)
- Now you should be connected to Ad-Hoc network
[edit] Roaming (CLI)
- Roaming feature of WiFi can also be tested only through WLAN TI CLI.
- Have 2 AP configured with same SSID.
- On OMAP4(Blaze), follow the procedure above to launch the WLAN TI CLI
- After launching the CLI do the following to enable roaming
- 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)
- Now if you turn off the AP that Blaze board was connected to it will automatically connect to the other AP with same 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)
- Enable 802.11a mode and select the channel (40) in the AP
- On OMAP4 follow the procedure in "Using WLAN TI CLI interface" to launch the WLAN TI CLI
- After launching the CLI, do the following procedures
- Register ScanComplete event (/ v r 5)
- / a a - g1 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.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