BLIP v2.0, RPL, CoAP and the IPv6 stack for the Z1 mote in TinyOS
Due to the Z1 memory limitations (8Kb ram) compared against the (actual) memory requirements of blip 2.0 (PppRouter is close to 9.2Kb), we are working on getting a reduced version of the stack without losing its functionalities.
- January 31 2012:
After a first round of testing we have managed to squeeze Blip and RPL support into the Z1 mote, by reducing the network capabilities in terms of number of parents allowed and the size of the routing table.
#define MAX_PARENT 1 #define ROUTE_TABLE_SZ 3
This reduction added to commenting out the UDP shell and printroute component in PppRouter allowed us to reduce the memory size to 8170 bytes.
// UDP shell on port 2000 // components UDPShellC; // prints the routing table // components RouteCmdC;
This is test code not committed to trunk (not will ever be), when we manage to get a final solution that makes us feel comfortable and gets accepted by the core we will bring these changes to main trunk, at the moment all the testing can be found referenced here, and soon at My GitHub in a test branch. The applied changes works, we got ping6 response from the motes, we have seen IPv6 traffic and resources like LEDS are working in CoAP.
PppRouter and UDPEcho
The instructions can be found in the official TinyOS BLIP 2.0 tutorial, all the steps are the same except nc6 support is not available since we have disabled UPD shell in the above section. First compile and upload the PppRouter at /apps/PppRouter:
$ make z1 blip install,1 $ sudo pppd debug passive noauth nodetach 115200 /dev/ttyUSB0 nocrtscts nocdtrcts lcp-echo-interval 0 noccp noip ipv6 ::23,::24
In another window add the interface:
$ sudo ifconfig ppp0 add fec0::100/64
Test connectivity to the border router (you should see the red light toggle and the green led answering back).
$ ping6 fec0::1
Program another mote with the UDPEcho application at /apps/UDPEcho (the bsl argument specifies the port of the Z1 mote), for fun enable the debug support by uncommenting in the Makefile:
PFLAGS += -DNEW_PRINTF_SEMANTICS -DPRINTFUART_ENABLED
$ make z1 blip install,2 bsl,/dev/ttyUSB1
Test connectivity to the UDPEcho mote:
$ ping6 fec0::2
Connect to the mote 2 through the serial port to see the debug output, using a program like putty or such (the baud rate is 115200), the output should be similar to:
fragment length: 82 offset: 104 fragment length: 0 offset: 104 sendDone: iface: 1 key: 0x1d70 RPL: linkResult: fe80::22:ff:fe00:1 2  2 IPProtocols - deliver -- off: 0 ICMP: type: 128 rx_cksum: 0xe481 my_cksum: 0xe481 IP Protocol send - nxt_hdr: 58 iov_len: 64 plen: 64 Forwarding -- got from routing table IPNeighborDiscovery - send - next: fe80::22:ff:fe00:1 - ll source: fe80::22:ff:fe00:2 l2 source: 02 00 00 00 72 2e 00 10 l2 dest: 01 00 00 00 2e b5 00 00
- Watch how it works in Youtube
CoAP and Blip 2.0
The instructions can be found in the official TinyOS CoAP tutorial, all the steps are the same. As learned in the tutorial first comment out the following line in the Makefile of /apps/PppRouter:
# PFLAGS += -DBLIP_DERIVE_SHORTADDRS
Compile and reprogram a mote with the PppRouter application, connect the PppRouter and create the network interface (see above section)
Take another mote and make sure this is enabled in /apps/CoapBlip:
CFLAGS += -DNUM_URIS=1 #CFLAGS += -DCOAP_RESOURCE_TEMP #CFLAGS += -DCOAP_RESOURCE_HUM #CFLAGS += -DCOAP_RESOURCE_VOLT #CFLAGS += -DCOAP_RESOURCE_ALL #TEMP + HUM + VOLT #CFLAGS += -DCOAP_RESOURCE_KEY CFLAGS += -DCOAP_RESOURCE_LED
Make sure CoAP support is properly build:
WARNING: Due to dynamic memory allocation problems, do not enable any printf debug options, this may cause a failure
cd $TOSROOT/support/sdk/c/coap autoconf ./configure make
Then compile and program a mote with CoapBlip:
make z1 blip coap install,3
Test connectivity to the CoAP mote:
$ ping6 fec0::3
Then watch the green led light up:
cd $TOSROOT/support/sdk/c/coap/examples echo -e -n \\x02 | ./coap-client -m put coap://[fec0::3]:61616/l -T 3a -t binary -f -
The output should be similar to this:
z1@zolertia:~/local/src/tinyos-2.x/support/sdk/c/coap/examples$ echo -e -n \\x02 | ./coap-client -m put coap://[fec0::3]:61616/l -T 3a -t binary -f - \x43\x03\xDF\xDA\x11\x2A\x81\x6C\x22\x33\x61\x02 send to [fec0::3]:61616: pdu (12 bytes) v:1 t:0 oc:3 c:3 id:57306 o: 1:'*' 9:'l' 11:'3a' data:'\x02' Jan 31 17:24:44 ** received from [fec0::3]:61616: pdu (7 bytes) v:1 t:2 oc:1 c:80 id:57306 o: 11:'3a' Jan 31 17:24:44 *** removed transaction 57306 ** process pdu: pdu (7 bytes) v:1 t:2 oc:1 c:80 id:57306 o: 11:'3a' ** LEDs set
- Watch how it works in Youtube