User Tools

Site Tools



Blip 2.0

The new version of blip currently resides in /branches/blip-rpl-devel of the tinyos svn repository.

Using the new version is structurally similar to Blip 1.0. There is one node that acts as a router between the 102.15.4 network and a serial connection to a server. Other nodes send packets that are received by the router. The default basestation/router application is called PppRouter.

Blip 2.0 applications should be compiled with msp430-gcc version 4.4.5 (or later) when using the epic platform.

Installing PppRouter

PppRouter acts like IPBasestation does for the old Blip. Basic installation is very straightforward:

$ cd $TOSROOT/apps/PppRouter
$ make epic blip install.1 miniprog bsl,/dev/ttyUSB0

Notes: There are a few issues that you want to be aware of.

Dynamic Addressing

Blip 2.0 supports assigning the edge nodes dynamic addresses, however, compiling that in with PppRouter makes the image to large to fit on the epic chips. To disable the feature and prevent the code from being included, make sure this line is in the PppRouter makefile:

PFLAGS += -DIN6_PREFIX=\"fec0::\"

I chose to use a more interesting and real prefix:

PFLAGS += -DIN6_PREFIX=\"2607:f018:8000:bbba\"

This is part of the University of Michigan's address space, and maybe at some point I can get them to actually allocate it to me.

UDP Shell And Routing Table

Motes running Blip 2.0 are able to run a simple shell and print out their current routing table. However, this seems to be commented out by default (this may change). To include this feature edit and uncomment these two lines:

components UDPShellC;
components RouteCmdC;

If it is still too big to fit try editing $TOSROOT/tos/lib/net/blip/shell/ and commenting out the body of the echo function.

How to use these are explained below.

Connecting to the PppRouter

Blip 2.0 uses ppp to connect to the 102.15.4 network instead of the custom blip driver. This is useful because it allows for more than one network to be bridged to the same computer. With Blip 1.0, only one instance of the driver could run on any computer and therefore one computer couldn't connect to more than one sensor network.

To initiate the connection run this command:

$ sudo pppd debug passive noauth nodetach 115200 /dev/ttyUSB0 nocrtscts nocdtrcts lcp-echo-interval 0 noccp noip ipv6 ::23,::24
  • Using Digi and Epic Testbed: There is a bug somewhere in the digi driver that prevents the stop pppd from working. It hangs trying to open the serial port. The workaround I found is to use a hacked version of pppd.
    $ git clone git://
    $ cd ppp
    $ patch -p1 < ppp_with_quanto.patch
    $ ./configure
    $ sudo make DESTDIR=/usr/bin/pppd-hack all install
    $ /usr/bin/pppd-hack/sbin/pppd <options>


    diff --git a/pppd/Makefile.linux b/pppd/Makefile.linux
    index 060db6a..fd71454 100644
    --- a/pppd/Makefile.linux
    +++ b/pppd/Makefile.linux
    @@ -62,7 +62,7 @@ USE_TDB=y
     # Enable plugins
    diff --git a/pppd/tty.c b/pppd/tty.c
    index d571b11..a66c7a4 100644
    --- a/pppd/tty.c
    +++ b/pppd/tty.c
    @@ -723,7 +723,7 @@ int connect_tty()
    	if (connector == NULL && modem && devnam[0] != 0) {
    		int i;
    		for (;;) {
    -			if ((i = open(devnam, O_RDWR)) >= 0)
    +			if ((i = open(devnam, O_RDWR | O_NONBLOCK)) >= 0)
    			if (errno != EINTR) {
    				error("Failed to reopen %s: %m", devnam);

You should see something like this:

using channel 45
Using interface ppp0
Connect: ppp0 <--> /dev/ttyUSB0
rcvd [LCP ConfReq id=0x1 <mru 1280> <asyncmap 0x0> <accomp>]
sent [LCP ConfReq id=0x2 <asyncmap 0x0> <magic 0x81aaad7b> <pcomp> <accomp>]
sent [LCP ConfAck id=0x1 <mru 1280> <asyncmap 0x0> <accomp>]
rcvd [LCP ConfRej id=0x2 <magic 0x81aaad7b> <pcomp>]
sent [LCP ConfReq id=0x3 <asyncmap 0x0> <accomp>]
rcvd [LCP ConfAck id=0x3 <asyncmap 0x0> <accomp>]
sent [IPV6CP ConfReq id=0x1 <addr fe80::0000:0000:0000:0023>]
rcvd [IPV6CP ConfReq id=0x1 <addr fe80::0000:0000:0000:0000>]
sent [IPV6CP ConfNak id=0x1 <addr fe80::0000:0000:0000:0024>]
rcvd [IPV6CP ConfAck id=0x1 <addr fe80::0000:0000:0000:0023>]
rcvd [IPV6CP ConfReq id=0x2 <addr fe80::0000:0000:0000:0000>]
sent [IPV6CP ConfNak id=0x2 <addr fe80::90b7:4c1c:77f4:3857>]
rcvd [IPV6CP ConfReq id=0x3 <addr fe80::0000:0000:0000:0024>]
sent [IPV6CP ConfAck id=0x3 <addr fe80::0000:0000:0000:0024>]
local  LL address fe80::0000:0000:0000:0023
remote LL address fe80::0000:0000:0000:0024
Script /etc/ppp/ipv6-up started (pid 22331)
Script /etc/ppp/ipv6-up finished (pid 22331), status = 0x0

In another terminal run the following command to give your computer an ipv6 address on the same prefix:

$ sudo ifconfig ppp0 add fec0::100/64

Insert the correct prefix that you chose in the Makefile. For instance I use:

$ sudo ifconfig ppp0 add 2607:f018:8000:bbba::1/64

You can now view the routing table that PppRouter has come up with. Type route\n after entering the following command.

$ nc6 -u fec0::1 2000

This should show you something like:

destination		gateway		iface
ff02::1:2/128		::		ppp
::/0			::		ppp

There are other commands that UDPShell supports. Type help to see them:

$ nc6 -u fec0::1 2000
sdsh-0.9		builtins: [help, echo, ping6, uptime, ident]

Installing UDPEcho

UDPEcho is a (somewhat) simple application that uses Blip 2.0. As expected it will echo anything sent to it on port 7, but it will also send blip statistics to an address of your choosing.

  1. The Makefile needs to be edited in order to get the app working. First, uncomment these lines:
    PFLAGS += -DIN6_PREFIX=\"fec0::\"

    We also want it to send out the statistics debugging information, so add this line:

    CFLAGS += -DREPORT_DEST=\"fec0::100\"

    The prefix and destination need to change if you have been using a different prefix with PppRouter and the ifconfig command.

  2. Now install UDPEcho:
    $ make epic blip install.2 bsl,/dev/ttyUSB1
  3. Check that the PppRouter has identified the new node on the network. Running route on the router should look like:
    $ nc6 -u fec0::1 2000
    destination		gateway		iface
    ff02::1:2/128		::		ppp
    fec0::2/128		fe80::2		pan
    ::/0			::		ppp
  4. You should be able to connect to the UDPEcho node since it is also running UDPShellC.
    $ nc6 -u fec0::2 2000
    destination		gateway		iface
    ::/0			fe80::1		pan

    Good, the node has found a route through the PppRouter.

  5. There is a python script for dumping the statistics the UDPEcho nodes are sending out included with the UDPEcho app.
    $ cd $TOSROOT/apps/UDPEcho/util
    $ python

    Make sure that $TOSROOT/support/sdk/python is in your $PYTHONPATH.
    Sidenote: a listener like this is very easy to make using mig which comes with tinyos.

Changing the Addressing Scheme

I prefer to use the epic chips EUI for all addressing with Blip.

Link local addresses (the addresses nodes use to talk to each other) are formed by default using the EUI of the epic chip. However, because we were including this line in the Makefile:


Blip was using the TOS_NODE_ID we specified at install time. I find this to be a pain because every time you want to reprogram the node you have to make sure to include the correct install.<ID> to keep track of which node is which. To make unique link local addresses just comment out that like in the Makefile.


The global address is either assigned with DHCP or by using the TOS_NODE_ID. Well since the DHCP modules don't fit, epic motes are given addresses by the user at install time. As stated, I don't care to deal with this. So I edited the NoDHCP code to assign the lower 64 bits of the global address with the EUI.

Here is my modified $TOSROOT/tos/lib/net/blip/dhcp/

#include <lib6lowpan/ip.h>
module NoDhcpC {
  uses {
    interface Boot;
    interface IPAddress;
    interface Ieee154Address as Eui;
} implementation {
  event void Boot.booted() {
    ieee154_laddr_t	eui_id;
    struct in6_addr	addr;
    int	i;
    // get the Eui in the proper format
    eui_id = call Eui.getExtAddr();
    // clear out the ip6 address and copy in the prefix
    memset(&addr, 0, sizeof(addr));
    inet_pton6(IN6_PREFIX, &addr);
    // copy in the eui
    for (i=0; i<8; i++) {
        addr.s6_addr[i+8] =[7-i];
    call IPAddress.setAddress(&addr);
  event void IPAddress.changed(bool valid) {}
  event void Eui.changed() {}

I also had to change $TOSROOT/tos/lib/net/blip/ in order to include the Ieee154Address component:

#if defined(IN6_PREFIX)
  components MainC, NoDhcpC, Ieee154AddressC;
  NoDhcpC.Boot -> MainC;
  NoDhcpC.IPAddress -> IPAddressC;
  NoDhcpC.Eui -> Ieee154AddressC;
#elif ! defined(IN6_NO_GLOBAL)
  components Dhcp6RelayC;
  components Dhcp6ClientC;

Using Blip 2.0 in Other Apps

There are a few differences between using Blip 1.0 and Blip 2.0.

Include Components (configuration file)

You need to have this in your file:

components IPStackC;
components IPDispatchC;
  components RPLRoutingC;
components new UdpSocketC();
AppP.RadioControl -> IPStackC;
AppP.UDP -> UdpSocketC;


In your file be sure to have these includes:

#include <IPDispatch.h>
#include <lib6lowpan/lib6lowpan.h>
#include <lib6lowpan/ip.h>

Commands and Functions

void send () {
  inet_pton6(RECEIVER_ADDR, &dest.sin6_addr);
  dest.sin6_port = htons(RECEIVER_PORT);       // <-- line has changed
  call UDPService.sendto(&dest, &payload_thl, sizeof(nx_struct udp_thlm_t));
event void UDPService.recvfrom (struct sockaddr_in6 *from, void *data, uint16_t len, struct ip6_metadata *meta) { }    // <-- has changed
tinyos_blip_2.txt · Last modified: 2013/02/10 01:12 by bradjc