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 CC2564 with Linux
The aim of this page is to explain how to integrate a CC2564B Dual Mode Bluetooth device into a Linux system running on the AM335x with SDK7.0 using the Bluetopia stack.
There are two hardware configurations described for using the CC2564EM board.
- AM335x EVM + CC2564EM
- BeagleBoneBlack + RF Cape + CC2564EM
The same SDK7.0 SD card image will run on both these board combinations.
Contents
Hardware Configuration[edit]
It is possible to use CC2564EM board on either AM335x EVM or BeagleBoardBlack (White can be supported by migrating the appropriate device tree patch)
The CC2564EM board provides both a COM8 100pin connector which is used with the AM335x EVM and an EM connector that will fit in the BeagleBone RF Cape (BB-BONE-RF-01).
The processor board supplies the Vdd and slow clock by default. The software modifications are to the device tree to configure the 4 wire UART and link it to the shared transport driver, and to configure a GPIO pin for nSHUTD. Currently the software does not configure PCM audio lines.
AM335x EVM[edit]
In order to use with the AM335x some hardware modifications are required which will then prevent its use with the RF Cape. These are to: Remove R9 from the EM board to disable the level shifters that pass signals from the 3.3V EM connectors which allows the 32kHz slow clock and UART signals to be fed directly at 1.8v from the COM8 connector Remove the EM sockets RF1 and RF2 from the base to allow it to mechanically fit into the COM8 connector on the EVM.
BeagleBoneBlack[edit]
In order to use on the BeagleBoneBlack it is simply a case of plugging the CC2564EM board into the RF Cape and plugging that into the BeagleBone.
Building the Software[edit]
The two prerequisites to building the software are to:
- download and install AM335x SDK7 from http://software-dl.ti.com/sitara_linux/esd/AM335xSDK/07_00_00_00/index_FDS.html
- download and install Bluetopia stack LINUXEZSDK-WILINK8-BT from http://www.ti.com/tool/wilink-sw. Install it into the base directory of SDK7. Note that although this is described as working on WL183x it also works on CC2564 if you have the installer with the suffix U.
Now download the following patch file and extract into the base directory of the SDK.
The build file build-cc2564.sh will patch and build the kernel device tree files to support the CC2564EM board in the EVM and BeagleBoneBlack as well as adding HCI Shared Transport support to defconfig. The script also adds some patches for MMC driver for Wi-fi for WL183x but these are just maintained for WL8/CC2564 build compatibility.
Once the kernel is built, the script configures a clean arago filesystem with the appropriate configuration and services before creating tarballs containing the boot and rootfs partitions which can be programmed to an SD card with the standard SDK scripts.
The contents of the script are shown below for reference
#!/bin/bash # script to build a basic root file system for the cc2564 EM # set main directories in use SDK_DIR=`pwd` FS="cc2564-filesystem" TAR_DIR="tar-files-${FS}" export TI_SDK_PATH=${SDK_DIR} export CROSS_COMPILE="arm-linux-gnueabihf-" export PATH="$PATH:${SDK_DIR}/linux-devkit/sysroots/i686-arago-linux/usr/bin" export INSTALL_PATH="${SDK_DIR}/${FS}" export USR_INCLUDE_PATH="${SDK_DIR}/linux-devkit/sysroots/cortexa8hf-vfp-neon-3.8-oe-linux-gnueabi/usr" export BLUETOPIA="${SDK_DIR}/AM335xBluetopiaLinuxProduction-4.0.1.4.2U" if [ ! -e ${FS} ] then mkdir ${FS} else cd ${FS} sudo rm -r * cd .. fi if [ ! -e ${TAR_DIR} ] then mkdir ${TAR_DIR} fi cd ${FS} sudo tar -xf ../filesystem/arago-base-tisdk-image-am335x-evm.tar.gz . cd .. if [ ! -f kernel.built ] then cd board-support/ #if a clean tar file does not exist then create one if [ ! -e linux-3.12.10-ti2013.12.01.tar.gz ] then tar -czf linux-3.12.10-ti2013.12.01.tar.gz linux-3.12.10-ti2013.12.01 # and move current directory to a backup cp linux-3.12.10-ti2013.12.01 linux-3.12.10-ti2013.12.01-clean else # as tar file exists then delete working build and repopulate with clean tar echo "extract tar kernel" sudo rm -r linux-3.12.10-ti2013.12.01 tar -xf linux-3.12.10-ti2013.12.01.tar.gz fi cd .. # clean it just to be sure make linux_clean cd board-support/linux-3.12.10-ti2013.12.01 ####### Wifi patches do not affect operation of CC2564 on AM335x EVM ######## #### They are here just to maintain compatibility with wl18xx operation ##### #now patch it with patches from http://processors.wiki.ti.com/index.php/WL18xx_AMxxx_platform_integration_guide curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/c70bf7a930c7989c9e446eb546cd04ee9c6090fa?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/3bae30822f5bf95f1299b8a0647a58c8184983ec?format=patch | patch -p1 # this is a patch for omap2 config and not SDK7 #curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/c9635f9555f0d7db9406191a2caa525790b52ca8?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/2ca1d8b5a9106bafc27c663a618083e656df3049?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/5a8bd88760ca76fbc957adf8dfbed8a6dfbab89a?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/23e9f53a25ca852b48bce587dbece767a28ee4c2?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/a0ed76ed648893fb595b6b147f66433c7d59594a?format=patch | patch -p1 curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/3b9357943ac676aa5862a0577d41216c55de3ad3?format=patch | patch -p1 # this is a patch for omap2 config and not SDK7 #curl -k https://git.ti.com/wilink8-wlan/wilink8-wlan-ti-linux-kernel/commit/5db3de412b214c84119a53974dab0e31eb0179a2?format=patch | patch -p1 patch -p1 < ../../patches/kernel-patches/0007-update-sdk-config-for-r8-4-options.patch ##### Patches to add Shared Transport for Bluetooth ######## patch -p1 < ../../patches/kernel-patches/0008-enable-st-hci-for-bluetooth.patch ###### This is key one for CC2564EM ####### patch -p1 < ../../patches/kernel-patches/0020-replace-wl8-cape-with-rf-cape-for-cc2564EM.patch cd ../.. # create this file to say kernel has been patched. To recreate from scratch delete this file touch kernel.built fi make linux || exit #The main linux_install script uses Rules.mak to set filesystem. We are not using that directory here and so # we will explicitly call the install routines so ${FS} can be passed #sudo make linux_install sudo install -d ${FS}/boot sudo install board-support/linux-3.12.10-ti2013.12.01/arch/arm/boot/zImage ${FS}/boot # reduce filesystem size by not installing vmlinux (109Mb) and removing original zImage sudo rm ${FS}/boot/zImage-3.12.10-ti2013.12.01 #remove this line for creating a smaller filesystem (vmlinux is 109Mb) #sudo install board-support/linux-3.12.10-ti2013.12.01/vmlinux ${FS}/boot sudo install board-support/linux-3.12.10-ti2013.12.01/System.map ${FS}/boot sudo cp -f board-support/linux-3.12.10-ti2013.12.01/arch/arm/boot/dts/*.dtb ${FS}/boot/ sudo make -C board-support/linux-3.12.10-ti2013.12.01 ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- INSTALL_MOD_PATH=${SDK_DIR}/${FS} modules_install #extract latest bts files for CC2564 (Service Pack v2.14) and CC2564B (Service Pack v1.1) and move to filesystem if [ ! -e CC2564_BT_BLE_SP_BTS.zip ] then wget http://processors.wiki.ti.com/images/1/1e/CC2564_BT_BLE_SP_BTS.zip fi unzip CC2564_BT_BLE_SP_BTS.zip CC2564_BT_BLE_SP_BTS/bluetooth_init_cc2564_2.14.bts sudo mv CC2564_BT_BLE_SP_BTS/bluetooth_init_cc2564_2.14.bts ${FS}/lib/firmware/TIInit_6.6.15.bts if [ ! -e CC2564B_BT_BLE_SP_BTS.zip ] then wget http://processors.wiki.ti.com/images/7/7b/CC2564B_BT_BLE_SP_BTS.zip fi unzip CC2564B_BT_BLE_SP_BTS.zip CC2564B_BT_BLE_SP_BTS/bluetooth_init_cc2564B_1.1_BT_Spec_4.0.bts sudo mv CC2564B_BT_BLE_SP_BTS/bluetooth_init_cc2564B_1.1_BT_Spec_4.0.bts ${FS}/lib/firmware/TIInit_6.7.16.bts cd ${FS} cd home/root sudo mkdir -p sso cd ../.. # Need to install UIM so that BTH will work sudo tar -xvf ../filesystem/tisdk-rootfs-image-am335x-evm.tar.gz ./usr/bin/uim ./etc/init.d/uim-sysfs # and insert link to start it cd etc/rc5.d sudo ln -s ../init.d/uim-sysfs S03-uimsysfs cd ../.. # back to sdk root dir cd .. # copy in SSO binaries sudo cp ${BLUETOPIA}/bin/* ${FS}/home/root/sso/ # and make them executable sudo chmod a+x ${FS}/home/root/sso/* cd ${FS} sudo tar -czf ../${TAR_DIR}/${FS}_rootfs_partition.tar.gz * # change to boot, and only remove files if that 'cd' command executed correctly # remove existing mlo, u-boot from directory, we can't copy symbolic links to FAT # ensure it is target filesystem boot and not host /boot !!! cd ../${FS}/boot && sudo rm -r * # as we are writing to a FAT ultimately symbolic links don't work, so remove them by writing to target names #use default for MLO and u-boot as we've not changed them sudo cp ../../board-support/prebuilt-images/MLO-am335x-evm MLO sudo cp ../../board-support/prebuilt-images/u-boot-am335x-evm.img u-boot.img sudo tar -czf ../../${TAR_DIR}/${FS}_boot_partition.tar.gz * cd ../..
Creating an SD card[edit]
The demo can be run by either downloading pre-built tarballs for boot and rootfs or by running the script above. Use the standard SDK7.0 tool /bin/create-sd.sh to write the boot and rootfs partition tar balls.
The script to create the SD card must be run as sudo
$cd bin $sudo ./create-sd.sh
Once the partitioning steps have been done select the custom file paths option
2) Enter in custom boot and rootfs file paths
and the path to the downloaded boot partition tarball. At the next option select Kernel and device tree from rootfs.
1) Reuse kernel image and device tree files found in the selected rootfs
and the path to the rootfs partition tarball.
Running the Software[edit]
The build process puts all the Bluetopia demo executables in directory sso in the target root directory. To run the demos follow the the instructions here. Full details on rebuilding the Bluetopia code are found here.