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.

Smart Home and Energy Gateway Software Manual

From Texas Instruments Wiki
Jump to: navigation, search
TIBanner.png
Smart Home and Energy Gateway Software Manual
Smart Grid Solutions

READ FIRST[edit]

IMPORTANT

The following instructions have only been tested and verified with the following software versions:
  • Sitara AM335x AMSDK v6.00
  • WiFi version R8.3 SP1
  • Stonestreet One Bluetooth version 4.0.1.3
  • Gateway board support package version 1.3

Please download and install SDK 6.00 before continuing. You will also need the Gateway board support package (BSP). Contact your local TI representative to get access to the Gateway BSP.

For information about the hardware, please see the Smart Home and Energy Gateway Hardware Manual.


U-Boot[edit]

The U-boot on AM335x uses a two stage approach. The size of the internal RAM in AM335X is 128KB out of which 18KB at the end is used by the ROM code. Also, 1 KB at the start (0x402f0000 - 0x402f0400) is secure, and it cannot be accessed. This places a limit of 109KB on the size of the U-Boot binary which the ROM code can transfer to the internal RAM and use as an initial stack before initialization of DRAM.

Since it is not possible to squeeze in all the functionality that is normally expected from U-Boot in less than 110KB (after setting aside some space for stack, heap etc) a two stage approach has been adopted. Initial stage initialize only the required boot devices (NAND, SPI, UART, I2C etc); 2nd full stage install all other devices (Ethernet, timers, clocks etc).


NOTE

In the rest of this document when referring to the binaries, the binary for the 1st stage is referred to as SPL and the binary for the 2nd stage is U-Boot.


Building U-Boot[edit]

Prerequisite[edit]

Verify that SDK 6.00 is installed on your host computer. GNU toolchain for ARM processor from Linaro is recommended to build U-Boot. Linaro toolchain can be found in the linux-devkit directory of the SDK. If you have not already done so, add this compiler to the path by doing:

$ export PATH="<sdk install dir>/linux-devkit/sysroots/i686-arago-linux/usr/bin:$PATH"

Change to the base of the U-Boot directory.

$ cd <sdk install dir>/board-support/u-boot-2013.01.01-psp06.00.00.00

U-boot patch[edit]

Download Gateway board support package (BSP) and apply patches to U-Boot source. The patches are located in the patches/uboot folder of the Gateway BSP.

$ patch -p1 < 0001-Baseline-uboot-patch-for-Gateway.patch
$ patch -p1 < 0002-DDR-and-MPU-speed-increase-and-add-USB-commands.patch

Compile[edit]

Below are instructions on how to generate binaries for the memory or peripheral devices. Building into a separate object directory with the "O=" parameter is strongly recommended.  Note that the board names are different than what is typically used to build U-Boot for other AM335x EVM. 

UART[edit]

$ [ -d ./am335x ] && rm -rf ./am335x
$ make O=am335x CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm am335x_zbgw

In the am335x directory, SPL is spl/u-boot-spl.bin and U-Boot is u-boot.img.

NAND[edit]

$ [ -d ./am335x ] && rm -rf ./am335x
$ make O=am335x CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm am335x_zbgw

In the am335x directory, SPL is MLO and U-Boot is u-boot.img.

SPI[edit]

$ [ -d ./am335x ] && rm -rf ./am335x
$ make O=am335x CROSS_COMPILE=arm-linux-gnueabihf- ARCH=arm am335x_zbgw_spiboot

In the am335x directory, SPL is MLO.byteswap and U-Boot is u-boot.img.


Kernel[edit]

This section will cover the basic steps for building the Linux kernel and driver modules.

Building Linux Kernel[edit]

Prerequisite[edit]

Verify that SDK 6.00 is installed on your host computer. GNU toolchain for ARM processor from Linaro is recommended to build the kernel. Linaro toolchain can be found in the linux-devkit directory of the SDK. If you have not already done so, add this compiler to the path by doing:

$ export PATH="<sdk install dir>/linux-devkit/sysroots/i686-arago-linux/usr/bin:$PATH"

Change to the base of the Kernel directory.

$ cd <sdk install dir>/board-support/linux-3.2.0-psp04.06.00.11

Kernel patch[edit]

Download Gateway board support package (BSP) and apply patches to kernel source. The patches are located in the patches/kernel folder of the Gateway BSP.

$ patch -p1 < 0001-Baseline-kernel-patch-for-Gateway.patch
$ patch -p1 < 0002-Add-USB-modem-kernel-config.patch
$ patch -p1 < 0003-Fixed-SPI-flash-device-name.patch

Cleaning the Kernel sources[edit]

Prior to compiling the Linux kernel, it is often a good idea to make sure that the kernel sources are clean and that there are no remnants left over from a previous build.

NOTE

The next step will delete any saved .config file in the kernel tree as well as the generated object files. If you have done a previous configuration and do not wish to lose your configuration file, save a copy of the configuration file before proceeding.

Clean the kernel

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- mrproper

Configure the Kernel[edit]

Before compiling the Linux kernel, it needs to be configured to select what components will become part of the kernel image, which components will be built as dynamic modules, and which components will be left out all together. 

Set default kernel configuration

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- tisdk_am335x-evm_defconfig

If you would like to customize the kernel configuration, run the following command

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- menuconfig

Compile[edit]

Once the kernel has been configured, it must be compiled to generate the bootable kernel image, as well as any dynamic kernel modules that were selected. 

Build the kernel image. The resulting kernel image file will be located in the arch/arm/boot directory called uImage.

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- uImage

Build the dynamic modules. This will result in .ko (kernel object) files being placed in the kernel tree. These .ko files are the dynamic kernel modules.

$ make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- modules

Flashing U-Boot and Kernel images[edit]

Target configuration[edit]

Switch SW2 is used to select the boot modes. The following sections will note which boot mode to enter. Make sure that the Gateway's boot switch settings are set to the required boot mode and then power on the board.

SW2, Boot Mode Select
Boot Mode 1 2 3 4
UART0 OFF ON ON ON
NAND OFF ON ON OFF
SPI0 OFF OFF ON OFF

NOTE

Must power cycle the board to change boot modes. Reset button will only perform a warm reset.


U-Boot network configuration[edit]

In order to download images from the TFTP server, the network settings in U-Boot need to be configured.

When booting for the first time, U-Boot tries to fetch the MAC address from the env space. If it returns empty, it will look for MAC address from the eFuse registers in the Control module space and set the "ethaddr" variable in the env appropriately. The ethaddr can also be set using the setenv/saveenv commands. In such cases, the user-set MAC address will take effect on subsequent reboot only.

To set a different MAC address, use the following command

U-Boot# set ethaddr <MAC address, e.g. 08:11:23:32:12:77>

Dynamic IP[edit]

Run the dhcp command to obtain the IP address from the DHCP server on the network to which the Gateway is connected.

U-Boot# setenv serverip <tftp server in your network>
U-Boot# setenv autoload no
U-Boot# dhcp
U-Boot# saveenv

Static IP[edit]

If running on a network without a DHCP server, run the following commands to set the static IP.

U-Boot# setenv ipaddr <static IP>
U-Boot# saveenv


UART Boot[edit]

This section describes how to boot from UART using TeraTerm.

  1. Turn on Gateway with switch settings for UART boot
  2. When "CCCC" characters appear on TeraTerm window, from the File Menu select Transfer --> XMODEM --> Send (1K mode)
  3. Select "u-boot-spl.bin" for the transfer
  4. After image is successfully downloaded, the ROM will boot the SPL
  5. When "CCCC" characters appear on TeraTerm window, from the File Menu select Transfer --> YMODEM --> Send (1K mode)
  6. Select "u-boot.img" for the transfer
  7. After image is successfully downloaded, U-Boot will boot
  8. Hit <Enter> and get to U-Boot prompt "U-Boot#"


Flashing U-Boot and Kernel images to NAND using U-Boot commands[edit]

The NAND part on the Gateway has been configured in the following manner. The addresses mentioned here are used in the subsequent NAND related commands.

+------+-->0x00000000-> SPL start         (SPL copy on 1st block)
|      |
|      |-->0x0001FFFF-> SPL end
|      |-->0x00020000-> SPL.backup1 start (SPL copy on 2nd block)
|      |
|      |-->0x0003FFFF-> SPL.backup1 end
|      |-->0x00040000-> SPL.backup2 start (SPL copy on 3rd block)
|      |
|      |-->0x0005FFFF-> SPL.backup2 end
|      |-->0x00060000-> SPL.backup3 start (SPL copy on 4th block)
|      |
|      |-->0x0007FFFF-> SPL.backup3 end
|      |-->0x00080000-> U-Boot start
|      |
|      |-->0x0025FFFF-> U-Boot end
|      |-->0x00260000-> ENV start
|      |
|      |-->0x0027FFFF-> ENV end
|      |-->0x00280000-> Linux Kernel start
|      |
|      |
|      |
|      |
|      |-->0x0077FFFF-> Linux Kernel end
|      |-->0x00780000-> File system start
|      |
|      |
|      |
|      |
|      |
+------+-->0x10000000-> NAND end (Free end)


This section describes how to flash the NAND images using U-Boot.

  • Boot using UART boot mode. After the U-Boot prompt comes up, the images for the 1st and 2nd stage can be flashed to NAND for persistent storage.
  • Configure the U-Boot network settings for either static or dynamic IP
  • Set the TFTP server IP address
U-Boot# setenv serverip <TFTP server in your network>
  • Download SPL from TFTP server, erase and write image to NAND flash
U-Boot# tftp MLO
U-Boot# nand erase 0x0 0x20000
U-Boot# nand write ${loadaddr} 0x0 0x20000
  • Download U-Boot from TFTP server, erase and write image to NAND flash
U-Boot# tftp u-boot.img
U-Boot# nand erase 0x80000 0x200000
U-Boot# nand write ${loadaddr} 0x80000 0x200000
  • Download kernel image from TFTP server, erase and write image to NAND flash
U-Boot# tftp uImage
U-Boot# nand erase 0x280000 0x500000
U-Boot# nand write ${loadaddr} 0x280000 0x500000
  • Set boot switch settings for NAND boot and power cycle the board.
  • If no error messages are display and the U-Boot prompt comes up, NAND boot is successful
  • Modify U-Boot environment variable to boot kernel and filesystem from NAND flash
U-Boot# setenv bootcmd "run nandboot"
U-Boot# saveenv

Flashing U-Boot and Kernel images to SPI using U-Boot commands[edit]

The SPI part on the Gateway has been configured in the following manner. The addresses mentioned here are used in the subsequent SPI related commands.


+------+-->0x000000-> SPL start         (SPL copy on 1st block)
|      |
|      |-->0x01FFFF-> SPL end
|      |-->0x020000-> SPL.backup1 start (SPL copy on 2nd block)
|      |
|      |-->0x03FFFF-> SPL.backup1 end
|      |-->0x040000-> SPL.backup2 start (SPL copy on 3rd block)
|      |
|      |-->0x05FFFF-> SPL.backup2 end
|      |-->0x060000-> SPL.backup3 start (SPL copy on 4th block)
|      |
|      |-->0x07FFFF-> SPL.backup3 end
|      |-->0x080000-> U-Boot start
|      |
|      |-->0x0DFFFF-> U-Boot end
|      |-->0x0E0000-> ENV start
|      |
|      |-->0x0EFFFF-> ENV end
|      |-->0x0F0000-> Linux Kernel start
|      |
|      |
|      |
|      |
|      |-->0x44FFFF-> Linux Kernel end
|      |-->0x450000-> Userspace start
|      |
|      |
|      |
|      |
|      |
|      |
+------+-->0x800000-> Userspace end (Free end)


This section describes how to flash the SPI images from UART boot mode.

  • Boot using UART boot mode. After the U-Boot prompt comes up, the images for the 1st and 2nd stage can be flashed to SPI for persistent storage.
  • Configure the U-Boot network settings for either static or dynamic IP
  • Set the TFTP server
U-Boot# setenv serverip <TFTP server in your network>
  • Select the SPI flash
U-Boot# sf probe 0
  • Erase the SPI flash
U-Boot# sf erase 0 +F0000
  • Download SPL from TFTP server and write image to SPI flash
U-Boot# tftp MLO.byteswap
U-Boot# sf write ${loadaddr} 0 ${filesize}
  • Download U-Boot from TFTP server and write image to SPI flash
U-Boot# tftp u-boot.img
U-Boot# sf write ${loadaddr} 0x80000 ${filesize}
  • Download kernel image from TFTP server, erase and write image to SPI flash
U-Boot# tftp uImage
U-Boot# sf erase ${spisrcaddr} ${spiimgsize}
U-BOot# sf write ${loadaddr} ${spisrcaddr} ${filesize}
  • Set boot switch settings for SPI boot and power cycle the board.
  • If no error messages are display and the U-Boot prompt comes up, SPI boot is successful
  • Modify U-Boot environment variable to boot kernel from SPI flash. Note, since there is not enough room on the SPI flash, the filesystem will still reside on the NAND flash. 
U-Boot# setenv bootcmd "run spiboot"
U-Boot# saveenv


Additional U-Boot configuration[edit]

Depending on your Gateway, below are additional board configuration(s) that will need to be modified.

DDR memory size[edit]

By default, U-Boot sets the DDR memory size to 256MB. However, some Gateways have a higher DDR memory capacity. Modify the U-Boot parameter (as shown below) to reflect the correct DDR memory size.

For 256MB

U-Boot# setenv optargs mem=256M

For 512MB

U-Boot# setenv optargs mem=512M

Save the settings

U-Boot# saveenv


Filesystem[edit]

Below section explains the different methods to load the filesystem for the Gateway.

NAND[edit]

The following steps describe how to flash the UBI filesystem into NAND flash.

  • Locate the SDK6.0's UBI filesystem from the below folder location and copy to TFTP folder
<sdk install dir>/filesystem/arago-base-tisdk-image-am335x-evm.ubi
  • Run the following U-Boot commands to flash UBI filesystem into NAND flash
U-Boot# tftp arago-base-tisdk-image-am335x-evm.ubi
U-Boot# nand erase 0x780000 0xF880000
U-Boot# nand write ${loadaddr} 0x780000 ${filesize} 

NFS[edit]

The following steps describe how to configure U-Boot to run NFS. It assumes that a valid NFS and TFTP are currently running on your host machine.

  • Copy the kernel image (uImage) to your host machine's tftp directory.
  • Run the following U-Boot commands to boot the board from NFS
U-Boot# setenv serverip <host machine IP addr>
U-Boot# setenv bootfile uImage
U-Boot# setenv rootpath <NFS directory on host machine>
U-Boot# setenv bootcmd "run netboot"
U-Boot# saveenv

USB drive[edit]

The following steps describe how to setup the USB drive filesystem and configure U-Boot.

  • Plug in the USB drive to the host computer, where SDK 6.00 resides.
  • Go to the <SDK install>/bin folder
$ cd <sdk install dir>/bin
  • Run the create-sdcard script and follow the prompt to create a two-partition filesystem on the USB drive. This script will partition, format and populate the USB drive.
$ sudo ./create-sdcard.sh
  • Once script is completed, the USB drive has a working Linux root file system loaded and is ready for use.
  • Unplug and reinsert the USB drive onto the host computer. Transfer the kernel image (uImage) onto the boot partition of the USB drive
  • Unplug the USB drive from host computer and plug it into the Gateway board
  • Run the following U-Boot commands to boot the board from the USB drive
U-Boot# usb start
U-Boot# fatload usb 0:1 ${loadaddr} uImage
U-Boot# setenv bootargs "console=ttyO0,115200n8 root=/dev/sda2 noinitrd rootfstype=ext3 rootwait"
U-Boot# bootm


WiFi[edit]

This section describes how to build, verify and run the WiFi drivers on the Gateway. A WiFi pre-built binary package is included in the BSP. This pre-built can be extracted onto the top-level of the Gateway's filesystem to enable WiFi. For instructions on how to rebuild the WiFi drivers, see Building WiFi section. If you do not need to rebuild the WiFi drivers, proceed to Verifying WiFi and Running WiFi sections.

Building WiFi[edit]

Below is an abridged version of the instructions to compile WL18xx WiFi drivers (version R8.3 SP1) for the Gateway.  For full instructions on the WL18xx WiFi build process, please see http://processors.wiki.ti.com/index.php/WL18xx_WiFi_Build_Process.

  • Add Linaro toolchain to your PATH. Do not source the environment-setup file. The WiFi drivers build script will not build correctly if you do.
$ export PATH="<sdk install dir>/linux-devkit/sysroots/i686-arago-linux/usr/bin:$PATH"
  • Clone build script located in github
$ mkdir wl18xx_build
$ cd wl18xx_build
$ git clone git://github.com/TI-ECS/build-utilites.git
$ cd build-utilites
  • Set git tag to R8.3 SP1
$ git reset --hard ol_r8.a8.10_32
  • Configure build script's environment settings
  • Create a copy of setup-env.sample and name the file, setup-env
  • Edit setup-env. The main settings to modify are:
  • ROOTFS - path to target root filesystem
  • PATH - path to the Linaro toolchain
  • KLIB_PATH - path to the kernel sources
  • CROSS_COMPILE - beginning part of the cross compiler executable name
  • WORK_SPACE - work directory for download and build process
  • Typical user settings in setup-env file will look like the following
# User specific environment settings
export CROSS_COMPILE="arm-linux-gnueabihf-"
export PATH="$PATH:<sdk install dir>/linux-devkit/sysroots/i686-arago-linux/usr/bin"
export ROOTFS="/home/user/AM335x/RootFS"
export WORK_SPACE="/home/user/AM335x/work_space_R8_A8_10_32"
export KLIB_BUILD="<sdk install dir>/board-support/linux-3.2.0-psp04.06.00.11"
# MACHINE_TYPE - The target machine type. Can have one of the following values: "am1808" , "omap3evm" , "am335x"
# This is needed to build bluetooth components.
# This parameter is not relevant for ti814x board.
export MACHINE_TYPE="am335x"
export BUILD_VERSION="r8"
  • Build WiFi drivers using the build script
$ ./wl18xx_build.sh all
  • After the build has completed, WiFi drivers binaries are located in ROOTFS folder that was defined in setup-env file. Transfer all the binaries to the Gateway's filesystem.

Installing and configuring WiFi[edit]

Below is an abridged version of the instructions to install and configure the WiFi PHY for the Gateway. For full instructions, please see http://processors.wiki.ti.com/index.php/Open_Source_Wireless_Connectivity_wlconf.

  • Add the WiFi binaries to the Gateway's filesystem
  • Run the following commands to generate the WiFi PHY firmware file
root@am335x-evm:~# cd /usr/sbin/wlconf/official_inis
root@am335x-evm:~# cp WL8_System_parameters.ini  WL8_System_parameters_PG2_RDL_2_4_SP_MIMO.ini
root@am335x-evm:~# cd /home/root/scripts/wlconf
root@am335x-evm:~# ./wlconf-mimo.sh

root@am335x-evm:~# sync

  • After running the above steps, a newly generated WiFi PHY file, wl18xx-conf.bin, should be located in /lib/firmware/ti-connectivity folder on the Gateway filesystem
  • Reboot the Gateway and proceed to next section to verify that the WiFi drivers are loaded correctly

Verifying WiFi[edit]

Once the WiFi binaries have been added to the Gateway's filesystem, reboot the Gateway. The WiFi drivers will automatically load during boot. Below are some options to verify that the WiFi drivers have loaded correctly.

  • Verify that you see WiFi drivers loading during boot. You should see something similar to below during boot messages
[    6.565032] compat-drivers backport release: ol_r8.a8.04_32
[    6.570892] Backport based on wl18xx.git ol_r8.a8.10_32
[    6.576446] compat.git: wl18xx.git
[    8.910156] cfg80211: Calling CRDA to update world regulatory domain
[    9.324310] wlcore: wl18xx driver version: ol_r8.a8.04_32
[    9.774902] wlcore: wl18xx HW: 183x or 180x, PG 2.1 (ROM 0xe)
[    9.814117] wlcore: loaded
[    9.817016] wlcore: driver version: ol_r8.a8.04_32
[    9.822052] wlcore: compilation time: Thu Jul  3 11:51:12 2014
  • Verify that WiFi modules are loaded after boot.
root@am335x-evm:~# lsmod
Module                  Size  Used by
wl18xx                 75194  0
wlcore                179486  1 wl18xx
mac80211              351991  2 wlcore,wl18xx
cfg80211              201383  3 mac80211,wlcore,wl18xx
wlcore_sdio             4950  0
compat                 21281  5 wlcore_sdio,cfg80211,mac80211,wlcore,wl18xx
  • Verify wlan0 interface is available
root@am335x-evm:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr E0:C7:9D:34:4A:70
          BROADCAST MULTICAST  MTU:1500  Metric:1
          RX packets:0 errors:0 dropped:0 overruns:0 frame:0
          TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:0 (0.0 B)  TX bytes:0 (0.0 B)

Running WiFi[edit]

The WL8 module can operate in several modes, including station and AP mode. For complete instructions on how to configure the WL8 module in these different modes follow the steps in the Texas Instruments WiLink8 WLAN Demo wiki article. Below is an abridged version of the instructions.

Station mode[edit]

Below instructions will connect Gateway to an AP (e.g., router).

  • Modify config file, /etc/wpa_supplicant.conf, with the router's SSID.  Below are sample wpa_supplicant.conf files.
  • AP with no security
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        key_mgmt=NONE
        ssid="ECS"       #Replace with router's SSID
}
  • AP with WPA-PSK security
ctrl_interface=/var/run/wpa_supplicant
update_config=1

network={
        auth_alg=OPEN
        key_mgmt=WPA-PSK
        psk="12345678"   #Replace with WPA-PSK key
        mode=0
        ssid="ECS"       #Replace with router's SSID

}
  • Connect to AP. Connection is successful when you see "wlcore: association completed".
root@am335x-evm:~# wpa_supplicant -d -Dnl80211 -c /etc/wpa_supplicant.conf -iwlan0 -B
  • Obtain an IP address from AP's DHCP server
root@am335x-evm:~# udhcpc -i wlan0
  • Check ifconfig to verify that the Gateway received an IP address from the router's DHCP server
root@am335x-evm:~# ifconfig wlan0
wlan0     Link encap:Ethernet  HWaddr E0:C7:9D:34:4A:70
          inet addr:192.168.1.10  Bcast:0.0.0.0  Mask:255.255.252.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:25 errors:0 dropped:0 overruns:0 frame:0
          TX packets:15 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000
          RX bytes:5917 (5.7 KiB)  TX bytes:2310 (2.2 KiB)

AP mode
[edit]

Below instructions will configure Gateway to broadcast an SSID.  WiFi-enabled devices will be able to connect to the Gateway's SSID.

  • Modify config file, /etc/hostapd.conf, with the desired AP setting.  By default, the config file sets the SSID to "test" with no security. Below are key fields to modify in the config file.
    • hw_mode=g
    • preamble=1
    • ht_capab=[SHORT-GI-20]
    • ieee80211n=1
  • Create a new file, /etc/udhcpd.conf, to configure the DHCP server's setting.  Below is a sample udhcpd.conf file.
# Sample udhcpd configuration file (/etc/udhcpd.conf)
# The start and end of the IP lease block
start 		10.4.30.40	#default: 192.168.0.20
end		10.4.30.48	#default: 192.168.0.254
# The interface that udhcpd will use
interface   wlan0		#default: eth0
#Examles
opt	dns	8.8.8.8  8.8.4.4 # public google dns servers
option	subnet	255.255.255.0
opt	router	10.4.30.34
option	lease	864000		# 10 days of
  • Run in AP mode
root@am335x-evm:~# hostapd -B /etc/hostapd.conf -P /var/run/hostapd.pid
  • Assign IP address to the wlan0 port. Note that the IP address is the same as "opt router" that is defined in /etc/udhcpd.conf file
root@am335x-evm:~# ifconfig wlan0 10.4.30.34 netmask 255.255.255.0 up
  • Add NAT and DHCP server capability to the AP
root@am335x-evm:~# echo 1 > /proc/sys/net/ipv4/ip_forward
root@am335x-evm:~# udhcpd /etc/udhcpd.conf
root@am335x-evm:~# iptables -t nat -A POSTROUTING -o wlan0 -j MASQUERADE
  • Use a WiFi-enabled device and look for the Gateway's SSID that was defined in /etc/hostapd.conf. Connect and the device should receive an IP address from the Gateway's DHCP server.

Bluetooth[edit]

The Bluetooth stack is supported by Stonestreet One Bluetopia Bluetooth Protocol Stack and Platform Manager. For the Gateway, download the "LINUXEZSDK-WILINK8-BT-EVAL" Bluetooth package from here: http://www.ti.com/tool/linuxezsdk-am335x-wilink8.

For more information about the Stonestreet One Bluetooth overview, see http://processors.wiki.ti.com/index.php/StoneStreet_One_Bluetopia_Platform_Manager_Bluetooth_Stack_for_TI_WL18xx

Building Bluetooth[edit]

Below is an abridged version of the instructions to compile Stonestreet One Bluetooth stack (version 4.0.1.3) for the Gateway. For full instructions on the Stonestreet One build process, see http://processors.wiki.ti.com/index.php/Bluetooth:_Stonestreet_One_Build_Process

  • Download and install LINUXEZSDK-WILINK8-BT-EVAL package
  • Source the Linaro toolchain
$ source <sdk install dir>/linux-devkit/environment-setup
  • Navigate to the StoneStreet One device library
$ cd <sso_bt dir>/BluetopiaPM/Bluetopia/sample/SS1BTVEN/
  • Modify BTPSVEND.c file. If BTPSVEND.c already has the below setting correct, the rest of the build steps can be skipped. Proceed to Installing Bluetooth section.
    • BLUETOOTH_HCI_DEV_TTY_COM_PORT_NUMBER should be set to 1 for UART1
    • BLUETOOTH_CONTROLLER_POWER_CYCLE_DELAY should be set to 2000
  • Rebuild BTPSVEND for the Gateway
$ make -f BTPSVEND.mak
  • Copy library to the lib folder
$ cp libBTPSVEND.a ../../lib
  • Add Stonestreet One Bluetopia Platform Manager to the environment variables
$ export BLUETOPIA_PATH=<sso_bt dir>/BluetopiaPM/Bluetopia
$ export BLUETOPIA_ROOT_PATH=<sso_bt dir>/BluetopiaPM/Bluetopia
  • Navigate to PM Server (SS1BTPM)
$ cd <sso_bt dir>/Bluetopia/ss1btpm/server
  • Rebuilt SS1BTPM
$ make -f SS1BTPM.mak clean
$ make -f SS1BTPM.mak
  • Copy SS1BTPM to the binaries folder
$ cp SS1BTPM ../../bin/

Installing Bluetooth[edit]

Below are instructions on how to install the various Bluetooth software components into the Gateway's filesystem.

Stonestreet one binaries[edit]

  • Package the Stonestreet One binaries
$ cd <sso_bt dir>/Bluetopia/bin
$ tar -zcf sso_bt_4013.tar.gz *
  • Transfer the Stonestreet One tarball to the Gateway
  • Create a new folder and extract the tarball
root@am335x-evm:~# cd
root@am335x-evm:~# mkdir sso_bt
root@am335x-evm:~# cd sso_bt
root@am335x-evm:~# tar -zxf sso_bt_4013.tar.gz
root@am335x-evm:~# chmod +x *

Bluetooth firmware[edit]

/lib/firmware

Bluetooth enable kernel module[edit]

  • Navigate to bt-enable-1.0 folder
$ cd <sdk install dir>/board-support/extra-drivers/bt-enable-1.0
  • Build the kernel module
$ make
  • Copy gpio_en.ko to the below location of the filesystem
/lib/modules/3.2.0/kernel/drivers/bt_enable

Running Bluetooth[edit]

For full instructions on how to run the various Stonestreet One sample applications, see http://processors.wiki.ti.com/index.php/WL18xx_Bluetopia_Platform_Manager_Demo_Guide. Below is an example on how to communicate with a TI SensorTag, http://www.ti.com/ww/en/wireless_connectivity/sensortag/index.shtml.

  • Run the Stonestreet One GATM Demo Application
root@am335x-evm:~# cd /home/root/sso_bt
root@am335x-evm:~# ./SS1BTPM &
root@am335x-evm:~# ./LinuxGATM_CLT
GATM> Initialize 1
GATM> SetDevicePower 1
  • Discover SensorTag
GATM> StartDeviceDiscovery 1 60
[Press SensorTag side key]

Below is an example SensorTag discovery. The rest of the instructions will use "9059AF0B84AD" as the Bluetooth address. Replace it with your SensorTag's BD_ADDR value.

Remote Device Found.
BD_ADDR:             9059AF0B84AD
Address Type:        Public
Device Name:         SensorTag
LE Type:             Single Mode
Device Flags:        0x40080001
LE RSSI:             -73
LE Trans. Power:     0
LE Paired State :    FALSE
LE Connect State:    FALSE
LE Encrypt State:    FALSE
GATT Services Known: FALSE
  • Pair with SensorTag
GATM> RegisterAuthentication
GATM> PairWithRemoteDevice 9059AF0B84AD 1
GATM> UserConfirmationResponse 1
  • Connect with SensorTag
GATM> RegisterGATTCallback
GATM> ConnectWithRemoteDevice 9059AF0B84AD 1
  • Enable Temperature Reading. The raw temperature data will be displayed every one second.
GATM> WriteValue 9059AF0B84AD 38 1 0100       // Enable notification
GATM> WriteValue 9059AF0B84AD 41 1 01         // Start sensor and measurements
  • Enable Key Press Notifications. The button value will be printed whenever the state of the button changes.
GATM> ReadValue 9059AF0B84AD 97 0 1 1         // Read user description
GATM> WriteValue 9059AF0B84AD 96 1 0100       // Enable key press notification

NFC[edit]

This section describes how to build and run the RF430CL330H example code.

NOTE

A Texas Instruments RF430CL330H daughtercard is needed to run this example. The daughtercard must have the following modifications: 1. short pin 6 and 14 on connector RF1 and, 2. remove resistor R8. For more information on the RF430CL330H daughtercard, please see this site: http://www.ti.com/tool/rf430cl330htb

Building NFC[edit]

  • Add SDK6.0's Linaro toolchain into the PATH
$ export PATH="<sdk install dir>/linux-devkit/sysroots/i686-arago-linux/usr/bin:$PATH"
  • Extract nfcTest_sdk6_linaro_gateway.tar.gz that is found in the BSP
$ tar -zxf nfcTest_sdk6_linaro_gateway.tar.gz
  • Navigate into the source folder
$ cd nfc/nfcTestGw_source
  • Compile the source
$ make
  • Generated binary is called "rf430_example"

Running NFC[edit]

  • Attach the RF430CL330H daughtercard to the EM headers (P4 and P5) on the Gateway
  • Run the NFC binary
root@am335x-evm:~# nfc/rf430_example
  • Place an NFC-enable device (e.g. Android phone) close to the Gateway.
  • The NFC-enbled device will read the tag "Hello World!" from the Gateway.
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 Smart Home and Energy Gateway Software Manual 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 Smart Home and Energy Gateway Software Manual here.

C2000=For technical support on the C2000 please post your questions on The C2000 Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. DaVinci=For technical support on DaVincoplease post your questions on The DaVinci Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. MSP430=For technical support on MSP430 please post your questions on The MSP430 Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. OMAP35x=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. OMAPL1=For technical support on OMAP please post your questions on The OMAP Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. MAVRK=For technical support on MAVRK please post your questions on The MAVRK Toolbox Forum. Please post only comments about the article Smart Home and Energy Gateway Software Manual here. For technical support please post your questions at http://e2e.ti.com. Please post only comments about the article Smart Home and Energy Gateway Software Manual 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