Tuesday, October 16, 2018

How to build TI Z-Stack Linux Home Gateway for Beaglebone Black


The following steps show you how to build TI Z-Stack Linux Home Gateway from source codes for Beaglebone Black.

1.Setup and run Ubuntu 18.04.01 on VirtualBox

2. Install build-essential with the following command

    sudo apt-get install build-essential

3. Change to home directory (mine is /home/yk) and install cross compiler for building BBB binary.
    
    wget -c https://releases.linaro.org/components/toolchain/binaries/6.4-2018.05/arm-linux-gnueabihf/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz
    
    tar xf gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf.tar.xz

4. Add cross compiler path into PATH variable

     export PATH=$PATH:/home/yk/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/bin

5. Add TCLIB path by the following command

     export TCLIB=/home/yk/gcc-linaro-6.4.1-2018.05-x86_64_arm-linux-gnueabihf/lib

6. Download Z-STACK-LINUX-GATEWAY and install to home directory (mine is ~/Z-Stack_Linux_Gateway-1.0.1-src).

7. Change directory to ~/Z-Stack_Linux_Gateway-1.0.1-src/Source and run "./build_all"

8. Will see the following error after build finished and it doesn't matter. You can find z-stack_linux_gateway_arm_binaries_.tar under /home/yk/Z-Stack_Linux_Gateway-1.0.1-src/Source/ERROR__out and you can scp z-stack_linux_gateway_arm_binaries_.tar to BBB to run/test it.




Thursday, October 11, 2018

How to use serial bootloader mode to download binary to LAUNCHXL-CC1310/LAUNCHXL-CC2650 using Flash Programmer 2

The following steps show you how to use serial bootloader mode to download binary to LAUNCHXL-CC1310/LAUNCHXL-CC2650 using Flash Programmer 2.

1. Select XDS110 CC1310 connection to do mass erase.


2. Select CC1310 and connect it to XDS110 Class Application/User Uart.




3. Select binary to download and you should see "Sucess!" after download.


Sunday, July 29, 2018

660 Zigbee devices in the same Zigbee network!


660 Zigbee devices in the same Zigbee network now!!! This time, we have total 660 Zigbee devices, including 130 ZRs (Smart Plugs) and 530 ZEDs (PIR motion sensors, Door Contact sensors, and Smoke Detectors), joined to a single Zigbee network. The solution is based on TI CC2530.




Tuesday, April 24, 2018

How to setup Mosquitto on Raspberry Pi and make Contiki/Contiki-NG cc26xx-web-demo do mqtt publish to it.

The following steps show you how to setup Mosquitto on Raspberry Pi and make Contiki/Contiki-NG cc26xx-web-demo do mqtt publish to it.

1. Login to Raspberry Pi and do the following steps to install Mosquitto.
  • 1.1 Run "apt-get update" and "apt-get install mosquitto" to install Mosquitto server.
  • 2.2 Run "apt-get install mosquitto-clients" to install mosquitto_sub and mosquitto_pub.
2. Follow steps in How to configure 6lbr to make it can do ping6 to a CC26xx/CC13xx node from Raspberry Pi running 6lbr to setup 6lbr in bridge router mode.

3. Do "ifconfig" to get br0 IPv6 address. In my case, it's "bbbb::e786:9d85:9446:709".


4. Go to cc26xx-web-demo MQTT/IBM Cloud Config page and set "bbbb::e786:9d85:9446:709" as broker IP.


5. Open another ssh login to Raspberry pi and run "mosquitto_sub -h bbbb::e786:9d85:9446:709 -t iot-2/evt/status/fmt/json" to subscribe to ccx6xx-web-demo publish topic. You should be it receives cc26xx-web-demo published MQTT messages.


p.s. You can also use "mosquitto_pub -h bbbb::e786:9d85:9446:709 -p 1883 -t iot-2/evt/status/fmt/json -m "hello"" to test MQTT message publish from Raspberry Pi terminal.

6. The following steps show you how to toggle red led on LAUNCHXL-CC1310 or LAUNCHXL-CC2560 running cc26xx-web-demo.
  •  Use "test" as Org ID instead of "quickstart" and "123456" as Auth Token instead of empty.
  • Click "Submit" to make cc26xx-web-demo to reconnect to mqtt server.
  • Start a ssh login to raspberry pi. Use "mosquitto_pub -h bbbb::e786:9d85:9446:709 -m "1" -t iot-2/cmd/leds/fmt/json" to turn on red led, or "mosquitto_pub -h bbbb::e786:9d85:9446:709 -m "0" -t iot-2/cmd/leds/fmt/json" to turn off red led.



Monday, April 23, 2018

How to connect Contiki-NG cc26xx-web-demo to IBM Watson IoT Platform.

The following steps show you how to connect Contiki-NG cc26xx-web-demo (running on LAUNCHXL-1310 or LAUNCHXL-CC2650) to IBM Watson IoT Platform.

1. Setup IBM Watson IoT Platform.
  • 1.1 Login to IBM Watson IoT Platform and go to SECURITY tab of Device page to use "TLS Optional". This step is critical. If you don't do this, you need to use TLS for connection and default cc26xx-web-demo won't work.

  • 1.2 Go to Device Types tab of Device page to click "Add Device Type".
  • 1.3 Input device type name. I use cc26xx-web-demo in this demo.
  • 1.4 Follow all the steps to finish add device type.
  • 1.5 Switch to Browse tab of Device page to click "Add Device".
  • 1.6 Select "Select Existing Device Type" to cc26xx-web-demo and input Device ID which I use device MAC address.
  • 1.7 Input authentication token.
  • 1.8 Keep your device credentials carefully.
  • 1.9 Finish adding device and you would see it on Browse tab of device page.

2. Running 6lbr and wrapsix on Raspberry Pi first and connect your cc26xx-web-demo running on LAUNCHXL-CC1310 or LAUNCHXL-CC2650 to your 6lbr and configure cc26xx-web-demo.
  • 2.1 Open "MQTT/IBM Cloud Config" page.
  • 2.2 Configure cc26xx-web-demo for IBM Watson IoT platform according to device credentials in step 1.7.
  • 2.3 Run "ping uc6bmi.messaging.internetofthings.ibmcloud.com" to get its IPv4 address 169.45.2.20.
  • 2.4 Change broker IP to "0064:ff9b:0000:0000:0000:0000:a92d:0214" which is IPv6 address of "169.45.2.20".
  • 2.5 Click "Submit" on "MQTT/IBM Cloud Config" page to connect to IBM Watson IoT platform.

Thursday, April 19, 2018

How to build and run Contiki-NG cc26xx-web-demo running on LAUNCHXL-CC1310 and rpl-border-router on Raspberry Pi with slip radio running on LAUNCHXL-CC1310

The following steps show how to build and run Contiki-NG cc26xx-web-demo running on LAUNCHXL-CC1310 (or LAUNCHXL-CC2650) and rpl-border-router on Raspberry Pi with slip radio running on LAUNCHXL-CC1310 (or LAUNCHXL-CC2650) .

1. Do "git clone --recursive https://github.com/contiki-ng/contiki-ng" on your InstantContiki or Cygwin (you can build Cygwin develop environment according to here)

2. Build slip radio for LAUNCHXL-CC1310

  • 2.1 Change directory to contiki-ng/examples/slip-radio
  • 2.2 Add "#define IEEE802154_CONF_DEFAULT_CHANNEL 25" to project-conf.h
  • 2.3 Build slip-radio.bin by "make TARGET=srf06-cc26xx BOARD=launchpad/cc1310 slip-radio.bin"
  • 2.4 Download slip-radio.bin to one of LAUNCHXL-CC1310 to act as slip radio for usage of rpl-border-router.
3. Build cc26xx-web-demo for LAUNCHXL-CC1310

  • 3.1 Change directory to contiki-ng/examples/platform-specific/cc26xx/cc26xx-web-demo
  • 3.2 Make sure "#define IEEE802154_CONF_DEFAULT_CHANNEL 25" is defined in project-conf.h
  • 3.3 Build cc26xx-web-demo.bin by "make TARGET=srf06-cc26xx BOARD=launchpad/cc1310 cc26xx-web-demo.bin"
  • 3.4 Download cc26xx-web-demo.bin to another of LAUNCHXL-CC1310 to connect with rpl-border-router later.
4. Build and run rpl-border-router on Raspberry Pi
  • 4.1 Do "git clone --recursive https://github.com/contiki-ng/contiki-ng" on your Raspberry Pi.
  • 4.2 Change directory to contiki-ng/examples/rpl-border-router
  • 4.3 Build border-router.native by "make TARGET=native all"
  • 4.4 Connect LAUNCHXL-CC1310 (running slip radio) to Raspberry Pi and make sure it emulates ttyACM0.
  • 4.5 Run rpl-border-router by "sudo ./border-router -native fd00::1/64 -s /dev/ttyACM0"

5. You can type "help" on rpl-border-router console to know more available commands.



6. You can login to Raspberry Pi using another terminal and do "ping6 fd00::212:4b00:e00:cc00" to see reply from rpl-border-router.


6. Power on cc26xx-web-demo on another LAUNCHXL-CC1310. The green led on LAUNCHXL-CC1310 should blink fast in the beginning. When you see green led blinking slows down, it means cc26xx-web-demo joins rpl-border-router.

7. You can type "ip-nbr" on rpl-border-router console to know reachable nodes.



8. Now, you can do "ping6 fd00::212:4b00:a27:f319" (fd00::212:4b00:a27:f319 is the IPv6 address of cc26xx-web-demo) and see reply from cc26xx-web-demo.




Build and run 6lbr/Contiki-NG cc26xx-web-demo on Rasperry Pi with LAUNCHXL-CC1310/LAUNCHXL-CC2650

The following steps show how to build and run 6lbr/Contiki-NG cc26xx-web-demo on Rasperry Pi with LAUNCHXL-CC1310/LAUNCHXL-CC2650:

1. Build Contiki-NG slip radio for LAUNCHXL-CC1310 on InstantContiki 3.0 or Cygwin (you can refer here to setup Cygwin build environment)
  • 1.1 Do "git clone --recursive https://github.com/contiki-ng/contiki-ng" and switch to directory contiki-ng/examples/slip-radio
  • 1.2 Since 6lbr/Contiki-NG only supports RPL-CLASSIC now, we use "make TARGET=srf06-cc26xx BOARD=launchpad/cc1310 MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC  slip-radio.bin" to build slip radio for LAUNCHXL-CC1310.
  • 1.3 Download slip-radio.bin to one LAUNCHXL-CC1310 to act as slip radio for Raspberry Pi later.

2. Build Contiki-NG slip radio for LAUNCHXL-CC1310 on InstantContiki 3.0 or Cygwin
  • 2.1 Apply Fixing cc26xx 6lbr client example patch first.
  • 2.2 Switch to directory contiki-ng/examples/platform-specific/cc26xx/cc26xx-web-demo
  • 2.3 Since 6lbr/Contiki-NG only supports RPL-CLASSIC now, we use "make TARGET=srf06-cc26xx BOARD=launchpad/cc1310 MAKE_ROUTING=MAKE_ROUTING_RPL_CLASSIC  cc26xx-web-demo.bin" to build cc26xx-web-demo for LAUNCHXL-CC1310.
  • 2.4 Download cc26xx-web-demo.bin to another LAUNCHXL-CC1310 to join Raspberry Pi 6lbr later.

3. Build 6lbr/Contiki-NG on Rasperry Pi
  • 3.1 SSH login to Raspberry Pi.
  • 3.2 Change directory to home folder and git clone --recursive https://github.com/cetic/6lbr.git
  • 3.3 Change directory to 6lbr folder and git checkout contiki-ng
  • 3.4 Change directory to home folder and git clone --recursive https://github.com/cetic/contiki-ng.git
  • 3.5 Change directory to contiki-ng folder and git checkout sixlbr
  • 3.6 Change directory to 6lbr/examples/6lbr folder and run the following build command
    "make WITH_CONTIKI=0 CONTIKI=../../../contiki-ng all"
  • 3.6  After build successfully, do "sudo make install". You will see "install: cannot stat ‘tools/nvm_tool’: No such file or directory" issue since nvm_tool doens't make properly for current version. It might be fixed later but you can use nvm_tool built by previous 6lbr to do the following steps.
  • 3.7 Run "sudo /usr/lib/6lbr/bin/nvm_tool --update --channel 25 /etc/6lbr/nvm.dat" to change 6lbr/Contiki-NG to use channel 25.
  • 3.8 Run "/usr/lib/6lbr/bin/nvm_tool --print /etc/6lbr/nvm.dat" to make sure it switches to channel 25.
  • 3.9 Connect LAUNCHXL-CC1310 running slip radio to Raspberry Pi.
  • 3.10 Run "sudo service 6lbr start" to start 6lbr/Contiki-NG and you can use Firefox to access to [bbbb::100]


 4. Power on LAUNCHXL-CC1310 running cc26xx-web-demo and you will see it pops on sensors tab of 6lbr web page. You can test http or coap function on cc26xx-web-demo now.