Wednesday, May 10, 2017

How to generate Zigbee Host application code for EFR32 from Simplicity Studio

You can generate Zigbee Host application code for EFR32 from Simplicity Studio by doing the following steps:

1. Go to Simplicity Studio->New->New Project and select "Silicon Labs AppBuilder Project"

2. Select "ZCL Application Framework V2" and press Next button.

3. Select "EmberZnet GA Host" and press Next button.

4. Select "HaGatewayReference" and press Next button.

5. Use default project name or input yours. Then, press Next button and Finish button.

6. Go to HAL configuration in HaGatewayReferenceHost.isc. Select EFR32-EZSP as Wireless Chip and your Host type in Platform configuration. Then, press "Generate" button to generate HaGatewayReferenceHost example code.

7. Put the generated HaGatewayReferenceHost example code to your target platform and build to run it.

Thursday, April 27, 2017

Running 6lbr on Raspberry Pi with WiFi enable

The following steps show you how to run 6lbr on Raspberry Pi with WiFi enable. I use Wi-Pi WiFi dongle in my test.

1. Run "sudo iwlist wlan0 scan" to scan WiFi AP

2. Edit wpa_supplicant.conf to add your WiFi AP SSID, password, and settings by running "sudo vi /etc/wpa_supplicant/wpa_supplicant.conf"

3. Run "sudo ifdown wlan0" and "sudo ifup wlan0" to restart wlan0.

4. Kill existing wpa_supplicant process by running "sudo kill -9 $(ps -ef | grep wpa | awk '{print $2}')" and run "sudo wpa_supplicant -B -i wlan0 -c /etc/wpa_supplicant/wpa_supplicant.conf" to start it again with new settings in wpa_supplicant.conf.

5. Run "sudo dhclient" to get DHCP client IP and run "ifconfig wlan0" to check if you get correct client IP.

6. Restart Raspberry Pi and ssh to it using wlan0 DHCP client IP get in step 5.

7. Edit /etc/6lbr/6lbr.conf to use wlan0 as ETH interface.

8. Start 6lbr and you can test it with wlan0 now.

For details of running 6lbr with CC2531EMK on Raspberry Pi, you can refer to "Setup 6lbr to run 6LowPAN with CC2531 USB dongle on Raspberry Pi 2B."

Wednesday, March 29, 2017

Build TI Z-Stack Linux Home Gateway reference design for x86 Linux

The following steps show you hot to build TI Z-Stack Linux Home Gateway reference design for x86 Linux.

1. Download from

2. Setup a 32 bit Ubuntu and run to extract Z-Stack Linux Gateway source code to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src

3. Revise the build script package_builder_bbb (in red) under “your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\scripts\”

#Target platform:
    export TARGET_PLATFORM="x86"

    cd $NPI_SOURCE/Projects/tools/LinuxHost
    make clean
    make create_output
    #make arch-all-armBeagleBone CC_armBeagleBone=$COMPILER |& tee -a $MAKE_LOG_FILE
    make $BUILD_TYPE |& tee -a $MAKE_LOG_FILE

# *** Copy resources ***********************************************************************************

#cp $NPI_SOURCE/Projects/tools/LinuxHost/out/NPI_lnx_armBeagleBone_server $BINARIES_SERVERS_DIR/NPI_lnx_${PLATFORM_SUBSTRING}_server

4. Install protobuf by doing the following two apt-get install

       sudo apt-get install protobuf-c-compiler
       sudo apt-get install protobuf-compiler

5. Switch to your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ and run ./build_all

6. The output will be at "your Linux Home folder\Z-Stack_Linux_Gateway-1.0.1-src\Source\ERROR_out\z-stack_linux_gateway_x86_binaries.tar". The build error is due to the lack of comparison file but the output binaries still work on x86 environment.

7. Copy and untar “z-stack_linux_gateway_x86_binaries.tar” to your working directory on x86 (called ). Please follow the (Z-Stack Linux Gateway User Guide.pdf, Chap 6.3) to start the application. Please note you have to specify x86 when you run zigbeeHAgw like "./zigbeeHAgw x86"

8. If you run it successfully, you will see the results like the following screen shot.

Thursday, March 9, 2017

SPI connection between LAUNCHXL-CC1310/LAUNCHXL-CC2650 and ENC28J60 to run 6lbr

You can do the following SPI connection between ENC28J60 and LAUNCHXL-CC1310/LAUNCHXL-CC2650 to run 6lbr
  • SCLK : LaunchPad DIO10
  • MOSI : LaunchPad DIO9
  • MISO : LaunchPad DIO8
  • CS : LaunchPad DIO14
  • GND :  LaunchPad GND
  • VCC : LaunchPad 3V3

6lbr SW can be built by following steps in . After run 6lbr on LAUNCHXL-CC1310/LAUNCHXL-CC2650, you can see the following UART output.

Friday, March 3, 2017

How to run Contiki udp-server/udp-client on LAUNCHXL-CC2650.

The following steps show you how to run Contiki udp-server/udp-client on LAUNCHXL-CC2650.

1. Do "make TARGET=srf06-cc26xx BOARD=launchpad/cc2650 udp-server.bin" under /contiki/examples/ipv6/rpl-udp to build udp-server.bin and download it to one of LAUNCHXL-CC2650 using Flash Programmer 2.

2. Do "make TARGET=srf06-cc26xx BOARD=launchpad/cc2650 udp-client.bin" under /contiki/examples/ipv6/rpl-udp to build udp-client.bin and download it to another LAUNCHXL-CC2650 using Flash Programmer 2.

3. Start 6lbr on Raspberry Pi or BeagleBone and power on udp-server and udp-client on two different LAUNCHXL-CC2650. You will see two LAUNCHXL-CC2650 show on sensor list of 6lbr web page.

4. On UART output of two LAUNCHXL-CC2650, you can see udp-client sends Hello messages to udp-server.

Wednesday, February 15, 2017

How to do settings to allow access 6lbr from Internet

The following steps show you how to do settings to allow access 6lbr from Internet. Let's say we have a Internet router (mine is Asus RT-N12HP_B1) and the LAN address is

1. Access to 6lbr web page (http://[bbbb::100]) inside LAN and go to configuration page of 6lbr. Select IP64: on, DHCP: off, input a IPv4 address (this might be different if you don't use as LAN address on your Internet router and you can use other IP such as if you like it more.), and set Gateway as (this might be also different if you don't use as LAN address on your Internet router). Then, press "Submit" to restart 6lbr.

2.  After restarting, you can check IP64 Address is now on 6lbr Info page.

3. Next, let's check settings on Internet router (mine is Asus RT-N12HP_B1). We can see the external IP of this router is

4.I add a port forwarding rule (assign http service port to 6lbr IPv4 address to this Internet router and restart it.

5. Now, I can access 6lbr from another desktop from elsewhere on Internet by

Conversion between RSSI and LQI in Z-Stack

Z-Stack uses the following formula to convert RSSI and LQI.

LinkQuality = [255* (RSSI-MIN_ED)]/[MAX_ED-MIN_ED]

Therefore with simple algebra

RSSI = MIN_ED+LinkQuality*( MAX_ED-MIN_ED)/255

Default values for MIN_ED and MAX_ED are -87 and 10 respectively.

Then, maybe you can convert RSSI to distance...