NOTICE: The Processors Wiki will End-of-Life on January 15, 2021. It is recommended to download any files or other content you may need that are hosted on processors.wiki.ti.com. The site is now set to read only.

Using the WL18xx Cape with BeagleBone Black

From Texas Instruments Wiki
Jump to: navigation, search

Read this first![edit]

Note: This page was created as an early effort to get the WL18xx cape operational with the BeagleBone Black. This capability is now supported officially in the following wiki page:


There are several pages that now provide complete build scripts for BeagleBoneBlack + WL1835 Capes

It is recommended to reference the page above for integrating WL18xx with BeagleBone Black.

Linux and WL18xx Sources[edit]

The Linux kernel sources for the Beagle Bone Black is maintained on Github.com/TI-Wilink8

The TI Openlink wl18xx sources for the Beagle Bone Black are maintained on Github.com/TI-Openlink and Github.com/TI-Wilink8/compat respectively.

The production and validation of these kernels is done with the Angstrom Distribution and meta-beagleboard with the OpenEmbedded build system. The sources shared here are done for convenience for those familiar with the git version control system.

The Beagleboneblack patches and build scripts are stored above git reposities.

Use following command to install git:

   ~$sudo apt-get install git

Installing ARM Cross Compiler Toolchain[edit]

To compile the linux kernel for the BeagleBone Black, you must first have an ARM cross compiler installed. Use gcc-4.7-arm-linux-gnueabi-base that comes with Ubuntu 12.04. To install the compiler run:

~$sudo apt-get install gcc-arm-linux-gnueabi

       Cross-compiler is installed under /usr/bin.

OR

~$wget http://web.archive.org/web/20130823131954/http://www.angstrom-distribution.org/toolchains/angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 ~$sudo tar -C / -xjf angstrom-2011.03-x86_64-linux-armv7a-linux-gnueabi-toolchain-qte-4.6.3.tar.bz2 ~$export PATH=/usr/local/angstrom/arm/bin:$PATH

Build procedure for BeagleBone Black 3.8.13 Angstrom Linux Kernel[edit]

Environment Variables[edit]

NOTE:

1) To keep cleaner and simple build process for WiLink8 support on Beaglebone Black, create "BUILD_DIR" envrionment variable which contains source folder for kernel and wl18xx modules.

2) For example "ti-wl18xx" is the workspace source directory under $HOME contains sub-folder as "kernel" and "wl18xx", which contains sources for kernel and wl18xx components. export "ti-wl18xx" as "BUILD_DIR". For ex:

$export BUILD_DIR=/ti-wl18xx

3) Create partial "partial_rootfs" folder in $BUILD_DIR to keep and install Angstrom kernel modules and all wl18xx compat-wireless modules. Export WILINK8_PARTIAL_ROOTFS_DIR to this newly created directory. For example:

$mkdir -p $BUILD_DIR/partial_rootfs

$export WILINK8_PARTIAL_ROOTFS_DIR=$BUILD_DIR/partial_rootfs

Download Kernel sources with WL18xx patch for BBB[edit]

Change into $BUILD_DIR

~$cd $BUILD_DIR

Checkout updated kernel source for Beaglebone Black from below github

~$git clone git://github.com/TI-Wilink8/kernel.git && cd kernel ~/kernel$git checkout wl18xx_bbb_support ~/kernel$./patch.sh

Note:

1) LZO compression is being used for the uImage. Use following command to install LZO.

~kernel$sudo apt-get install lzop

2) mkimage is being used for the uImage. Use following command to install mkimage.

~kernel$sudo apt-get install ubuntu-mkimage

Building Kernel sources with WL18xx patch for BBB[edit]

1) Copy configs file to kernel

~/kernel$cp configs/beaglebone kernel/arch/arm/configs/beagleboneblack_defconfig

2) Copy firmware.bin to kernel

~/kernel$wget http://arago-project.org/git/projects/?p=am33x-cm3.git\;a=blob_plain\;f=bin/am335x-pm-firmware.bin\;hb=HEAD -O kernel/firmware/am335x-pm-firmware.bin

3) Building kernel and modules

~/kernel$ cd kernel

Build the config

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- beagleboneblack_defconfig

Build uImage and dtb

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 uImage dtbs

Build modules

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- -j4 modules

4) Install kernel modules into rootfs

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- INSTALL_MOD_PATH=$WILINK8_PARTIAL_ROOTFS_DIR modules_install

5) Build uImage-dtb

~/kernel/kernel$make ARCH=arm CROSS_COMPILE=arm-linux-gnueabi- uImage-dtb.am335x-boneblack

Build procedure for BeagleBone Black WL18XX Components[edit]

Download components and checkout appropriate commit.

$ cd $BUILD_DIR
$ git clone git://github.com/TI-OpenLink/wl18xx.git && cd wl18xx && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-OpenLink/hostap.git && cd hostap && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-OpenLink/compat-wireless.git && cd compat-wireless && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-OpenLink/18xx-ti-utils.git && cd 18xx-ti-utils && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-OpenLink/wl18xx_fw.git && cd wl18xx_fw && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-OpenLink/wl12xx_target_scripts.git && cd wl12xx_target_scripts && git checkout ol_r8.a7.01 -b working-branch && cd ..
$ git clone git://github.com/TI-Wilink8/compat.git && cd compat && git checkout wl18xx_bbb_support && git reset --hard 5cc37a00cc395a59f54344b04c86aa3e322c0117 && cd ..

System Build Scripts:

The build script located in github and can be cloned as follows:

user@ubuntu:/home/usr/ti-wl18xx# mkdir utility
user@ubuntu:/home/usr/ti-wl18xx# cd utility
user@ubuntu:/home/usr/ti-wl18xx/utility#git clone git://github.com/TI-ECS/build-utilites.git
user@ubuntu:/home/usr/ti-wl18xx/utility#cd build-utilites/

Here's what the directory looks like:

 utility/build-utilites/
 |-- functions
 |-- patches
 |-- README
 |-- scripts
 |-- setup-env
 |-- setup-env.sample
 |-- wl12xx_build_bt.sh
 |-- wl12xx_build.sh
 |-- wl18xx_build_ble.sh
 |-- wl18xx_build_bt.sh
 |-- wl18xx_build_nfc.sh
 |-- wl18xx_build_nfc.sh~
 |-- wl18xx_build.sh
 `-- wlan_enable_config.sh

user@ubuntu:/home/usr/ti-wl18xx/utility/build-utilites#

Build script Enviroment file 'setup-env.sample' file is used as base of "setup-env" that includes user specific environment variables. User should copy the setup-env.sample to setup-env and edit the variables according to user specific environment Typical file will be as follows: <syntaxhighlight lang="bash">

  1. User specific environment settings
  2. Change 'CROSS_COMPILE=arm-none-linux-gnueabi-' to 'CROSS_COMPILE=arm-linux-gnueabi-'

export CROSS_COMPILE="arm-linux-gnueabi-"

export PATH=$PATH:/usr/bin export ROOTFS=$WILINK8_PARTIAL_ROOTFS_DIR export WORK_SPACE=/home/user/ti-wl18xx export KLIB_BUILD=$BUILD_DIR/kernel/kernel

  1. MACHINE_TYPE - The target machine type. Can have one of the following values: "am1808" ,"omap3evm" , "am335x",beaglebone black
  2. This is needed to build bluetooth components.
  3. This parameter is not relevant for ti814x board.

export MACHINE_TYPE="am335x" export BUILD_VERSION="r8"

  1. ===========================================================

export ARCH="arm" export MY_PREFIX="/usr" export MY_SYSCONFDIR="/etc" export MY_LOCALSTATEDIR="/var" export CC="${CROSS_COMPILE}gcc" export CXX="${CROSS_COMPILE}g++" export AR="${CROSS_COMPILE}ar" export RANLIB="${CROSS_COMPILE}ranlib" export CFLAGS="${CFLAGS} -I${ROOTFS}${MY_PREFIX}/include" export CPPFLAGS="${CFLAGS}" export LDFLAGS="${LDFLAGS} -L${ROOTFS}${MY_PREFIX}/lib" export PKG_CONFIG_SYSROOT_DIR=${ROOTFS} export PKG_CONFIG_PATH="${ROOTFS}${MY_PREFIX}/lib/pkgconfig:${ROOTFS}/lib/pkgconfig" export PKG_CONFIG_LIBDIR="" export PKG_CONFIG_ALLOW_SYSTEM_CFLAGS="" export PKG_CONFIG_ALLOW_SYSTEM_LIBS="" </syntaxhighlight>

The main settings user should provide are: ROOTFS - path to target root file system PATH - add to the PATH environment variable toolchain path (after "$PATH:"). KLIB_BUILD - Path to the kernel sources CROSS_COMPILE - the begin part of cross compiler executable name, for example "arm-none-linux-gnueabi-" WORK_SPACE - Work directory for download and build process Note: 1) setup-env file should to be placed in the same directory together with build scripts(wl18xx_build.sh,wl18xx_build_bt.sh etc.) 2) On some Ubuntu systems,if not already installed install following packages

	~$sudo apt-get install corkscrew
	~$sudo apt-get install python-m2crypto

Build wl18xx_modules using below command

	~$./wl18xx_build.sh wl18xx_modules build
	~$sudo ./wl18xx_build.sh wl18xx_modules install

Building WLAN - wl18xx_build.sh file This script compiles one of following utilities: libnl, openssl, hostapd, wpa_supplicant,wl18xx_modules,firmware,crda,calibrator,wlconf by calling specific utility name and action.

	~$./wl18xx_build.sh <utility-name> <action>

where available utility-name is:

  • libnl
  • openssl
  • iw
  • hostapd
  • wpa_supplicant
  • crda
  • ti-utils
  • wl18xx-firmware
  • compat-wireless
  • wlconf

Note:

  1. By default sources for 'openssl', 'libnl', 'crda', 'hostapd', 'iw' and 'wpa_supplicant' are exists as part of git checkout. It will be downloaded before it gets builds.
  2. For the first time, make sure you build all the components and install. Later, specific components can be build.

After building and installing all modules, check rootfs directory contains all modules which are build for wl18xx. Enter into rootfs for wl18xx modules, which is referring $WILINK8_PARTIAL_ROOTFS_DIR

root@xxxx:/home/usr#cd WILINK8_PARTIAL_ROOTFS_DIR

Here xxxx - Host Name of the Ubuntu machine Contains below top-level directories

 rootfs
 |-- etc
 |   `-- libnl
 |-- include
 |   `-- netlink
 |-- lib
 |   |-- modules
 |   `-- pkgconfig
 `-- usr
     |-- bin
     |-- include
     |-- lib
     |-- local
     `-- sbin

Note: At this stage, you have the sd-card pre-built image with Angstrom and BEAGLE_BONE partition created. Pre-built image can be downloaded from either

  1. http://dominion.thruhere.net/koen/angstrom/beaglebone/Angstrom-Cloud9-IDE-GNOME-eglibc-ipk-v2012.12-beaglebone-2013.06.20.img.xz or
  2. http://beagleboard.org/latest-images

Copying Build Files to SD card[edit]

Baseline file system image[edit]

We're going to start with a known good Angstrom image and then update/replace some of the files to add the WL18xx support.

First, you'll want to download the uSD card image from beagleboard.org. This validation used the 2013-06-20 4GB SD card image for BeagleBone Black.

Directions for writing the image to an SD card can be found here in the section where Image Writer is discussed.

Once you've flashed the baseline image to your card then you can proceed to the next steps to update the necessary files.

Updating kernel in file system[edit]

Following procedures explains on setting up rootfs (Root File System) with newly build kernel and compat-wireless modules Connect SD card with card-reader on the host machine and check whether its mounted properly. For Example: /media/Angstrom path for Angstrom partition which has the root filesystem for Angstrom Linux Flashing kernel build files Note: Following 'cp' command must be executed with 'sudo' admin privilages, since the root file system is all owned by root. Copy newly build kernel image on to SD Card with following commands. Change into sudo mode

igx@xxxx:~$sudo su

Note: Export same BUILD_DIR and WILINK8_PARTIAL_ROOTFS_DIR environment variables for admin mode.

$export BUILD_DIR=/ti-wl18xx
$export WILINK8_PARTIAL_ROOTFS_DIR=$BUILD_DIR/partial_rootfs

Change in to kernel folder

root@xxxx:/home/usr#cd $BUILD_DIR/kernel/kernel

Note: Before copying uImage on boot folder, remove softlink for uImage exists with default pre-build image (i.e rm uImage) and copy newly build uImage to sdcard '/media/Angstrom/boot' folder.

root@xxxx:/home/usr/kernel/kernel# rm -f /media/Angstrom/boot/uImage

copy uImage to sdcard

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/uImage /media/Angstrom/boot/

copy am335x-bone.dtb to sdcard

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/dts/am335x-bone.dtb /media/Angstrom/boot/

copy am335x-boneblack.dtb to sdcardcp

root@xxxx:/home/usr/kernel/kernel#cp arch/arm/boot/dts/am335x-boneblack.dtb /media/Angstrom/boot/

copy kernel modules to sdcard

root@xxxx:/home/usr/kernel/kernel#cp -rf $WILINK8_PARTIAL_ROOTFS_DIR/lib/modules/3.8.13-dirty /media/Angstrom/lib/modules/

Flashing Wl18xx build files[edit]

Enter into wl18xx modules rootfs

root@xxxx:/home/usr/kernel/kernel#cd $WILINK8_PARTIAL_ROOTFS_DIR

copy compat-wireless(wl18xx) modules to sdcard using below commands Note: To keep newly build wl18xx modules, create a separate folder "wl18xx_modules" on the target root filesystem and copy compat-wireless modules in it.

root@xxxx:/home/usr/ti-wl18xx/rootfs#mkdir -p /media/Angstrom/home/root/wl18xx_modules/
root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf lib/modules/3.8.13-00726-gda51976-dirty/updates/* /media/Angstrom/home/root/wl18xx_modules/

Finally after copy, following directories exits under 'wl18xx_modules' directory

/media/Angstrom/home/root/wl18xx_modules
   |-- compat
   |   `-- compat.ko
   |-- drivers
   |   `-- net
   |       `-- wireless
   |           `-- ti
   |               |-- wl18xx
   |               |   `-- wl18xx.ko
   |               `-- wlcore
   |                   |-- wlcore.ko
   |                   |-- wlcore_sdio.ko
   |                   `-- wlcore_spi.ko
   `-- net
       |-- mac80211
       |   `-- mac80211.ko
       |-- rfkill
       |   |-- rfkill-gpio.ko
       |   `-- rfkill-regulator.ko
       |-- wireless
           `-- cfg80211.ko

Copy firmware into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs# mkdir -p /media/Angstrom/lib/firmware/ti-connectivity
root@xxxx:/home/usr/ti-wl18xx/rootfs# cp -rf $BUILD_DIR/wl18xx_fw/*.bin /media/Angstrom/lib/firmware/ti-connectivity
root@xxxx:/home/usr/ti-wl18xx/rootfs# cp usr/sbin/wlconf/wl18xx-conf-default.bin /media/Angstrom/lib/firmware/ti-connectivity/wl18xx-conf.bin

Note: Cross verify once under ti-connectivity directory wl18xx-fw-2.bin should be there. Copy libnl into sdcard using below command

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf etc/libnl/* /media/Angstrom/etc/libnl

Copy libnl library files into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf lib/libnl* /media/Angstrom/lib/

Copy udev rules to SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp etc/udev/rules.d/85-regulatory.rules /media/Angstrom/etc/udev/rules.d/

Copy crda and regdbdump into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf sbin/* /media/Angstrom/sbin/

Copy crda regulatory.bin into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/lib/crda /media/Angstrom/usr/lib/

Copy crda man page into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/share/man/man8 /media/Angstrom/usr/share/man/

Copy iw into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp usr/sbin/iw /media/Angstrom/usr/sbin/

Copy wpa_supplicant into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp usr/local/sbin/wpa_supplicant /media/Angstrom/usr/sbin/

Copy hostapd into SD card

root@xxxx:/home/usr/ti-wl18xx/rootfs#cp -rf usr/local/bin/hostapd /media/Angstrom/usr/sbin/

Finally,

  1. Unmount the SD card safely.
  2. Insert sdcard into beaglebone black uSD card slot.
  3. To boot the board, simply apply power to the Beaglebone black by plugging in the 5V Power Supply. If the USB cable is plugged in and the serial port is configured correctly you should see output on your serial terminal(will take 1-2 min to load). You will see the board reach u-boot, and then automatically boot into the Linux kernel,BF_EN LED also should glow on Wi-Link8 cape.
  4. When prompted for a login use root.

Testing Custom Build[edit]

After successfully boot with newly build kernel, check and make sure following files/directory are available on the target

  1. wl18xx_modules directory in /home/root : contains compat wireless modules
  2. wl18xx-fw-2.bin and wl18xx-conf.bin in /lib/firmware/ti-connectivity - TI Wilink8 Firmware files

Connect to a Wi-Fi Access-point[edit]

The following instructions will guide you how to configure the station mode and connect to non secured AP using IW commands. Connect to AP procedure - using IW commands.

First run dmesg to look at the boot log:

root@beaglebone:~# dmesg

You should see something such as this in your output:

[   13.228022] wlcore: wl18xx driver version: ol_r8.a7.01-dirty
[   13.577391] wlcore: wl18xx HW: RDL 2, 1857 MIMO, PG 2.2 (ROM 0x11)
[   13.588812] wlcore: loaded
[   13.588856] wlcore: driver version: ol_r8.a7.01-dirty
[   13.588866] wlcore: compilation time: Mon Jan 13 15:33:24 2014

Bring up the WLAN:

root@beaglebone:~# ifconfig wlan0 up

Now let's scan the AP's around in order to connect the desired one. This is done by iw command:

root@beaglebone:~# iw wlan0 scan | grep SSID
    SSID: blrAirtel
    SSID: AR4100_WPA2
    SSID: Roam_Test_WPA2
    SSID: testbbb

In order to connect to AP use the command "iw wlan0 connect " In the example the SSID is testbbb.

iw wlan0 connect testbbb

We can check the connection by invoking:

iw wlan0 link


The expected result is something like:

Connected to f8:d1:11:2c:d1:78 (on wlan0)
        SSID: testbbb
        freq: 2417
        RX: 528 bytes (8 packets)
        TX: 99 bytes (2 packets)
        signal: -32 dBm
        tx bitrate: 1.0 MBit/s
        bss flags:      short-preamble short-slot-time
        dtim period:    1
        beacon int:     100

Now configure IP address using DHCP:

root@beaglebone:~# udhcpc -i wlan0

You should see something like this:

udhcpc (v1.20.2) started
Sending discover...
Sending select for 192.168.1.100...
Lease of 192.168.1.100 obtained, lease time 7200
/etc/udhcpc.d/50default: Adding DNS 192.168.1.1

In order to verify the connection use ping command For example, the AP IP address is 192.168.1.1, we will invoke the following command on the beaglebone black:

root@beaglebone:~# ping 192.168.1.1

We should see the an output like:

PING 192.168.1.1 (192.168.1.1) 56(84) bytes of data.
64 bytes from 192.168.1.1: icmp_req=1 ttl=64 time=18.7 ms
64 bytes from 192.168.1.1: icmp_req=2 ttl=64 time=2.47 ms
64 bytes from 192.168.1.1: icmp_req=3 ttl=64 time=2.10 ms
64 bytes from 192.168.1.1: icmp_req=4 ttl=64 time=2.11 ms
64 bytes from 192.168.1.1: icmp_req=5 ttl=64 time=2.32 ms
^C
--- 192.168.1.1 ping statistics ---
5 packets transmitted, 5 received, 0% packet loss, time 4007ms
rtt min/avg/max/mdev = 2.108/5.563/18.786/6.613 ms

Pressing Ctrl+C will end the loop

E2e.jpg {{
  1. switchcategory:MultiCore=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Using the WL18xx Cape with BeagleBone Black here.

Keystone=
  • For technical support on MultiCore devices, please post your questions in the C6000 MultiCore Forum
  • For questions related to the BIOS MultiCore SDK (MCSDK), please use the BIOS Forum

Please post only comments related to the article Using the WL18xx Cape with BeagleBone Black here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Using the WL18xx Cape with BeagleBone Black here.

}}

Hyperlink blue.png Links

Amplifiers & Linear
Audio
Broadband RF/IF & Digital Radio
Clocks & Timers
Data Converters

DLP & MEMS
High-Reliability
Interface
Logic
Power Management

Processors

Switches & Multiplexers
Temperature Sensors & Control ICs
Wireless Connectivity