Contiki RPL implements the IETF ROLL working group's RPL: IPv6 Routing Protocol for Low power and Lossy Networks. This routing standard enables you to set up a route-over 6LowPAN network.
This tutorial will show you how to run Contiki's RPL demos on Redwire Econotags.
See the mc1322x hardware for an incomplete, but growing list of mc1322x hardware.
We recommend a few Econotags to get started. In addition to the mc13224v, the Econotag also has the FT2232H USB dual port controller. One port is connected to UART1 and all the necessary pins to load, erase, and reset the mc13224v. The other port is connected to the JTAG pins for run-time debugging. No other programming hardware is necessary. Just your computer!
Instant Contiki 2.5-rc1 is a Ubuntu virtual machince that has many of the tools you need to develop Contiki already setup.
You will need to install the following toolchain from Codesourcery: Sourcery G++ Lite 2008q3-66 for ARM EABI
** This is not included in Instant Contiki 2.5-rc1 **
The mc1322x source is part of the main contiki branch. You can checkout the most current Contiki code by running:
git clone git://contiki.git.sourceforge.net/gitroot/contiki/contiki
The RPL demo consists of a "Border router" and at least one other RPL enabled node. For this tutorial, the border router creates a RPL DAG and is the ROOT. The other node will be a RPL udp-client. It joins the RPL network, acts as an RPL router, and sends a UDP datagram to a hardcoded IPV6 address. This tutorial only handles a two node network, but can be extended for any number of nodes.
The general command to make a Contiki binary for the Econotag is:
To build the border-router:
cd contiki/examples/ipv6/rpl-border-router make TARGET=redbee-econotag
This will produce the binary image 'border-router_redbee-econotag.bin', which you can load directly on to an mc1322x and execute.
To build the rpl-udp, do:
cd contiki/examples/ipv6/rpl-udp make TARGET=redbee-econotag
which will build 'udp-client_redbee-econotag.bin'.
After building border-router_redbee-econotag.bin, you load the code with mc1322x-load.pl:
mc1322x-load.pl -f border-router_redbee-econotag.bin -t /dev/ttyUSB1 -c 'bbmc -l redbee-econotag reset'
This script located in contiki/cpu/mc1322x/tools and also in libmc1322x/tools. Linux users may need to download and install Device-SerialPort and TermReadKey). See also Getting started with libmc1322x for more examples on how to load and run code on the mc13224v.
The econotag will flash itself with a random Redwire MAC address if you haven't programmed one in:
address in flash blank, setting to defined IAB with a random extention. flashing blank address Rime started with address 00:50:C2:FF:FE:A8:C2:66 CSMA sicslowmac, channel check rate 100 Hz, radio channel 26 Tentative link-local IPv6 address fe80:0000:0000:0000:0250:c2ff:fea8:c266 Tentative global IPv6 address aaaa:0000:0000:0000:0250:c2ff:fea8:c266
This mac address is used to derive its IPv6 address. In this example, it's aaaa::0250:c2ff:fea8:c266.
The border router connects to your computer over a SLIP tunnel formed
tunslip6 --- a tool included in Contiki.
To make tunslip6:
cd contiki/tools make tunslip6
You need to run tunslip6 to create this tunnel and SLIP connection:
tunslip6 -s /dev/ttyUSB1 aaaa::1/64
To erase the econotag (and the MAC address), first make sure you've built BBMC:
cd contiki/cpu/mc1322x/tool/ftditools make
If you have trouble, see the BBMC page for details. BBMC controls the FT2232H over USB through libftdi. It can reset or erase an mc13224v. To erase:
bbmc -l redbee-econotag erase
Then to flash just the MAC address you need to build flasher from libmc1322x. See:
Then to flash the MAC address you can do:
mc1322x-load.pl -e -f flasher_redbee-econotag.bin -z -t /dev/ttyUSB1 -c 'bbmc -l redbee-econotag reset' 0x1e000,0xABC25000,0x010000C0
The next time you run Contiki you'll get:
loading rime address from flash. Rime started with address 00:50:C2:AB:C0:00:00:01 CSMA sicslowmac, channel check rate 100 Hz, radio channel 26 Tentative link-local IPv6 address fe80:0000:0000:0000:0250:c2ab:c000:0001 Tentative global IPv6 address aaaa:0000:0000:0000:0250:c2ab:c000:0001
N.B. for all of the bbmc commands, you'll need to use -i if you have more than one econotag plugged in. On most systems the indexes are enumerated backwards from the terminals. E.g. if you have 23 nodes connected, then /dev/ttyUSB1 will be on ftdi index 22 and the load command would be:
mc1322x-load.pl -f foo.bin -t /dev/ttyUSB1 -c 'bbmc -l redbee-econotag -i 22 reset'
Use mc1322x-load.pl to run
udp-client_redbee-econotag.bin on the
mc1322x-load.pl -f udp-client_redbee-econotag.bin -t /dev/ttyUSB3 'bbmc -l redbee-econotag -i 0'
The RPL border-router serves a webpage that displays the known neighbors and the known routes to all the node on the DAG. In firefox, you can type in the following to go to a IPv6 address:
aaaa::250:c2ff:fea8:cbf4/128 (via fe80::250:c2ff:fea8:cbf4)
After a short time, once the DAG forms to a node, you should see a route appear on the border-router's status page. You can ping this node from the computer running 'tunslip6'
A successful ping shows that both a downward and upward route has formed.
Now go mesh and stuff.