# Development Environment¶

## Hardware Requirements and Configurations¶

### BeagleBone Black With CoProcessor and Multiple Sensors¶

The TI 15.4-Stack SDK Linux Example Applications can be executed from BBB as explained in this document. The following hardware is required:

Figure 4. Network Configuration With Application Running on the BBB

### Linux® x86 PC With CoProcessor and Multiple Sensors¶

The TI 15.4-Stack Linux SDK Example Application can be executed from an x86 machine running Ubuntu® connected through a USB to a CC13x0 LP running a MAC CoProcessor Application. The following hardware is required:

• A Linux x86 PC running Ubuntu OS 14.04 LTS (x86_64 Bit)

• USB cable to connect to the LP

• At least two or more CC13x0 LPs

• LP1—Acts as the CoProcessor, which is the interface to the 802.15.4 network
• LP2 to N—For the network nodes that join the TI 15.4-Stack-based network

Figure 5. Network Configuration With Application Running on the x86_64 PC Running Ubuntu® OS

## Required Software¶

This section explains how to set up the hardware with the desired software to build and run the TI 15.4- Stack Linux SDK out-of-box example applications and setup to develop custom applications.

### Linux® Development Host¶

The x86 machine running Ubuntu can be used to develop and run the application or cross compile the applications for the BBB platform. This section provides setup instructions to build, develop, and run the applications on an x86 machine. This section also provides setup instructions for the x86 machine for cross-compiling on the BBB platform.

Note

When developing for the BBB platform on an x86 machine, the C code is cross-compiled and linked as a BBB application on your host x86 Linux_64 machine. The ARM executable is then copied to the BBB to run the application.

When cross-compiling, executables are named host_<name>, which means the compilation host. The prefix bbb_<name> is used as a target prefix for the BBB.

Install the following software on your x86_64 machine running Ubuntu 14.04 LTS 64-bit to run the TI 15.4-Stack Linux SDK out-of-box example applications.

1. Install the TI 15.4-Stack Linux SDK

2. Downloaded installer; the filename is: ti15.4stack_linux_x64_02_10_00_xx.run where xx is the final build number for the installer.

Note

Because the installer is a 64-bit Linux executable, it requires a 64-bit Linux machine.

3. On the host (Linux x86_64) machine, go to the directory where the Linux Installer is located and use the following commands to install:

bash$chmod +x ti15.4stack_linux_x64_02_10_00_xx.run bash$ ./ti15.4stack_linux_x64_02_10_00_xx.run


Note

The $symbol prompt indicates that this installer should be run as a normal user. Do not run as a ROOT (with the # prompt). The default TI 15.4-Stack install directory is: ${HOME}/ti/simplelink/ti154stack_linux_64_02_10_00_xx

2. Do an update

bash$sudo apt-get update  3. Install the package: build essentials bash$ sudo apt-get install build-essential

4. Install the package: Node.js

bash$sudo apt-get install Node.js  5. Your user name must be a member of the group dialout bash$ sudo adduser $USER dialout  6. To cross-compile for BBB, install TI’s Processor SDK for AM335x Sitara™ Processors – Linux and TI- RTOS Support. TI’s processor SDK for AM335x contains all of the cross-compilation tools, headers, libraries, and other required files for cross-compiling to the BBB. Note 1. In the TI 15.4-Stack Linux SDK, the processor SDK is installed in the following location: /home/${USER}/ti-processor-sdk-linux-am335x-evm-03.01.00.06
2. The TI processor SDK download is very large and expands to an even larger installation (the download is approximately 3GB, the installed footprint is approximately 4.5GB) and is only required to build the Example Applications through a cross-compilation scheme.

If the TI processor SDK is installed in a different location or is a different version, then the following two files must be updated:

• File 1: ${SDK_ROOT}/scripts/front_matter.mak • File 2:${SDK_ROOT}/example/cc13xx-sbl/app/linux/Makefile

Listing 1. is a screenshot from the front_matter.mak file (adjust the version numbers as required).

Listing 1. Screenshot From File front_matter.mak
#========================================
# These *MAY* need to be adjusted to fit your SDK install.
# NOTE: The Boot loader also has a macro that may need updating.
# SEE: ${root}/example/ccl3xx-sbl/app/linux/Makefile #---------------------------------------- # What is the Processor SDK Root directory #---------------------------------------- bbb_TI_PROC_SDK_DIR=${HOME}/ti-processor-sdk-linux-am335x-evm-02.00.02.11


Your x86 machine running Ubuntu should now be ready to run the build and run the example applications or to cross-compile applications for the BBB platform.

7. To test and verify the setup, build the Linux application from source with the following instructions:

1. Change to the TI 15.4-Stack ${SDK_ROOT} installation directory cd${HOME}/ti/simplelink/ti15.4stack_linux_64_02_10_00_xx

2. At the bash$prompt, type the following: # builds the host version bash ./build_all.sh # cross-compiles the BBB version. See Makefile for more details. bash ./build_all.sh bbb  3. The script builds the component libraries and the example applications. Note The script also creates *.log files of the compilation process. 8. Next, configure the BBB (see BeagleBone Black), or go to the step to program the CC13x0 LP with the desired flash images. See Program the CC13x0 LPs (using the CC13x0 Linux Flash Programing tool), or see Running the Example Applications, which discusses the Windows flash tool. ### BeagleBone Black¶ The BBB can be used in two different ways to develop and run the applications: • Method 1: As a runtime environment only, software is generally developed (edited, compiled, and linked) on a host x86 Linux machine and then deployed (or copied) to the BBB. • Method 2: As a development environment, the edit, compile, and link processes are done directly on the BBB. Note The following features are missing from the TI Linux Processor SDK versions before the April 2016 version (0.2.00.02.11): • The Node.js package is not present. • This package is required to run the Gateway Example Application that is based on the Node.js framework. • CONFIG_USB_ACM = (disabled, must be y or m) • This is required because the LP uses USB_ACM to emulate a serial interface with the BBB. • Optional: The Linux USB-Ethernet (RNDIS) driver is not present. • The BBB functions well using a standard Ethernet Cable. • This feature provides Ethernet over USB functionality. The Node.js Web Server Application can be accessed using one of the following: • The standard Ethernet cable • The Ethernet over USB solution The following steps provide details on how to set up the BBB for both methods described previously. 1. Program the micro-SD memory card with the TI Linux Processor SDK version 0.2.00.02.11 or greater (see the previous note). 1. Download the prebuilt processor SDK image am335x-evm-linux-03.01.00.06.img.zip from *PROCESSOR-SDK-LINUX-AM335X 03_00_00_04*. Follow the instructions at the wiki page to program the micro-SD memory card through Windows: *SDK_Linux_Creating_a_SD_Card_with_Windows* The Linux method is described in *Processor SDK Linux create SD card script*. 2. To boot from the SD card, take the following actions: 1. Disconnect power and unplug USB cable from the BBB board. 2. Insert the SD card. 3. Press (and hold) the boot switch (see Figure 6.). 4. Apply power to the BBB board (through a USB or through a barrel connector). 5. Wait a few seconds; then release the boot switch. Note The boot switch is only detected at power up. 6. In about 5 to 15 seconds, the LEDs will start blinking. Figure 6. Boot Switch Location 2. Determine the IP address of the BBB. To monitor and control the TI 15.4-Stack Network when using the TI 15.4-Stack Linux SDK out-of-box Gateway Application, you must know the IP address of the BBB. • Method 1: Connect to the Linux Host PC or Virtual Machine through a USB cable, as shown in Figure 7.. • The USB IP address is hard coded as 192.168.7.2 and is assigned during boot. Figure 7. USB Connection • Method 2: Use a network router or Windows PC, as shown in Figure 8.. Figure 8. Network Router or PC Connection • The network router assigns a random IP address through DHCP to the BBB based on the order in which the devices power up (for example, if today the BBB powers up first, the BBB receives BBB = xx.xx.xx.100 and laptop = xx.xx.xx.101; however, tomorrow the IP address might reverse, or perhaps a new device is present on the router [for example, a cell phone]). The following two options are used to determine the assigned IP address: • Use the Router HTTP Management page. Each router brand is different (the generic name is DHCP Client Table). See Table 1. for a list of example routers. Table 1. DHCP Client Table Examples Brand Example Link LinkSys http://www.linksys.com/us/support-article?articleNum=139502 NetGear http://documentation.netgear.com/fvs336g/enu/202-10257-01/FVS336G_RM-11-07.html Belkin http://www.belkin.com/pyramid/AdvancedInfo/F5D8235-4/Advance/reserveIP.htm • Use an FTDI USB serial cable and a terminal application. Perform the following steps to use an FTDI USB serial cable and a terminal application: 1. Before booting the Beagle board, first connect the Ethernet cable and connect an FTDI (USB serial) cable. Open a terminal program using the settings 115200 8-N-1. 2. Power-cycle the BBB (remember to press and hold the boot switch shown in Figure 6.). 3. Wait until the Beagle board has finished booting. 4. Log into the BBB using the user name root. 5. Type the command ifconfig, then the IP address appears on the screen shown in Figure 9.. 6. Copy the inet addr. Figure 9. Getting the IP Address of BBB 3. Transfer the prebuilt .tar file On the Linux PC, use the following commands to transfer the prebuilt .tar file with built binaries to the BBB. The .tar file can be found here: • In the Linux SDK, the file is under the following:${SDK_ROOT}/prebuilt/bbb_prebuitl.tar.gz
4. Copy the bbb_prebuilt file to the BBB. Substitute the appropriate address for the ${BBB_IP_ADDRESS} that follows: bash$ cd ${SDK_ROOT}/prebuilt bash$ scp bbb_prebuilt.tar.gz root@${BBB_IP_ADDRESS}:~/.  Note 1. Other tools can be used, such as Windows Secure Copy (WinSCP) or FileZilla. 2. The target directory ~/. is shorthand for roots${HOME} directory (that is, /home/root).
3. Later during development, Secure Copy (SCP) can be used to copy new binary files to the BBB.
5. Log into the BBB—(get a shell prompt) and unpack the prebuilt .tar file. Type the following commands:

bash$ssh root@${BBB_IP_ADDRESS} (connect to the BBB)

root@am335x-evm# cd ${HOME} root@am335x-evm# tar xf bbb_prebuilt.tar.gz  The prebuilt applications are found in the prebuilt directory. 6. OPTIONAL: Perform the following steps to copy the Linux example SDK source code to the BBB to build and run the application on BBB: 1. Create a .tar file of the entire${SDK_ROOT} directory.
2. Copy this new .tar file from your Linux host to the BBB through scp (for more details, see the previous note about where the prebuilt files are copied).
3. Unpack the .tar file.
4. See Building the Applications From Source for details about how to build on the BBB.

The BBB is now ready to run the TI 15.4-Stack SDK Linux example applications.

7. Next, flash program the CC13x0 LP devices. See Program the CC13x0 LPs for using the CC13x0 Linux Flash Programing tool; also see Running the Example Applications where the Windows flash tool is discussed.

### Program the CC13x0 LPs¶

This section provides instructions on how to program the CC1310 LPs with the required hex files. Prebuilt firmware files are in the ${SDK_ROOT}/firmware directory. • (See Figure 10. [A].) Program one LP with the$(SDK_ROOT)/firmware/CC1310_LAUNCHXL/CoProcessor_cc1310lp.hex for the CC1310LP or $(SDK_ROOT)/firmware/CC1350_LAUNCHXL/CoProcessor_cc1350lp.hex for the CC1350LP image, label this CC13x0 LP as the CoProcessor. • (See Figure 10. [B].) Program all other LPs with the sensor image$(SDK_ROOT)/firmware/CC1310_LAUNCHXL/default/sensor_default.hex for the CC1310LP or \$(SDK_ROOT)/firmware/CC1350_LAUNCHXL//default/sensor_default.hex for the CC1350LP, label these devices as sensor.

Figure 10. Program the LPs

There are two options to program the LP devices:

The CC13x0 LPs are now ready. Running the Example Applications describes how to run the out-of-box Collector and Gateway

#### Programming the MAC CoProcessor Application on CC13x0 LP¶

The TI 15.4-Stack Linux SDK includes a prebuilt hex file for the MAC CoProcessor. This hex file can be programmed through the SmartRF Flash Programmer v2 (see SmartRF Flash Programmer to download) as explained in the following documentation. In addition, the workspace of the MAC CoProcessor CCS project is included with the Windows Installer. Refer to the TI 15.4-Stack Software Developer’s Guide on how to program the device using CCS.

Open the SmartRF Flash Programmer v2 on the Windows machine. Figure 11. shows the steps to program the CC13x0 device with the desired hex file.

Figure 11. Steps to Program the CC13x0 LP Using the SmartRF Flash Programmer v2

Note

1. When connecting the LP, the SmartRF program might update the debugger firmware in the onboard XDS-110 debug feature.
2. Troubleshooting Hint 1: It is easy to confuse various LPs (that is, sensor versus CoProcessor), so be sure to label each device properly.
3. Troubleshooting Hint 2: To verify a device is programmed correctly, take the following actions:
1. Uncheck Erase.
2. Uncheck Program.
3. Check VERIFY.
4. Choose read-back; this option effectively uploads the hex file from the device and compares the hex file byte-for-byte against the selected hex file.
5. Click the Play/Start button to begin the verify process.

To view this in action:

1. Verify the CoProcessor hex file versus the sensor LP. The result should be Error.
2. Unplug the sensor LP, connect the CoProcessor LP, and click Play/Start. The verification should be Success.