User Tools

Site Tools


tinyos_epic_testbed

~~REDIRECT>ref:tinyos:epictestbed:start~~

Using the Epic Testbed

The Epic Testbed contains an Epic chip and an Ethernet to serial bridge. It can be setup to create a link that makes the Epic connect to a serial port on your computer as if it was connected by a USB cable.

There is a good but slightly outdated guide to this from NESL at UCLA. Thomas also has a guide here. The steps here are an updated version of those.

The driver for the ethernet adapter on the testbed is super out of date. This makes it pretty much impossible (we haven't found a way to do it) to run it on new versions of Ubuntu. At this point you need a virtual machine and an old version of ubuntu. To make this easier we have a .iso file in shed-big.

Using the digi.iso file

This iso has the necessary software installed.

TinyOS is located at `\tinyos-main`

Thomas's NMI is located at `\git\mni`

  1. Install ubuntu in a virtual machine with the ubuntu.
  2. Add
    export PATH=/usr/local/msp430/bin:$PATH
    export TOSROOT=/tinyos-main
    export TOSDIR=$TOSROOT/tos
    export MAKERULES=$TOSROOT/support/make/Makerules

    to your .bashrc file and reopen the terminal.

  3. Update TinyOS.
    cd /tinyos-main
    svn up
  4. Setup the digi connection to your node.
    • Use the GUI:
      1. sudo dgrp_gui

        This allows you to setup connections to each of the testbeds you have.

      2. Click “Add” and fill in the correct information.
        RealPort ID: Labeled on the testbed ethernet ports. Goes ra, rb, rc...sa, etc
        IP Address: (whatever the address of the node is)
        Number of Ports: 1
        rest as defaults
      3. Now there should be a serial port /dev/tty[realport id]00 that is connected to the testbed.
      4. You should verify the permissions on /dev/tty[realport id]00 to make sure you have access:
        $ ls -l /dev/ttyrs00 
        crw-rw---- 1 root dialout 249, 0 2012-08-07 15:03 /dev/ttyrs00
            ^^^           ^^^^^^^
            |||           |||||||
        group permissions group owner (your user should be a member of the dialout group)
    • This need not be done with the GUI client. The GUI is a wrapper for commands that can be easily run without the GUI.
      1. To connect to a testbed:
        sudo /usr/bin/dgrp/config/dgrp_cfg_node init  -v -v -e never ra <ip address> 1
  5. Install blink on the node.
    cd /tinyos-main/apps/Blink
    /git/mni/scripts/install_quanto.py config.ini

Do it the old way

The first step is to make the testbed connect to a serial port on your computer.

  1. To do this we need to install the Digi Connect ME driver. The packages from Digi are outdated but a .deb that works with at least Ubuntu 10.04 is available here and here. That will install the necessary drivers on your machine.
    • Installing From Source
      1. Get the .tar.gz file here.
      2. Get the sources and some prerequisites:
        sudo apt-get install libssl-dev ncurses-dev
        wget ftp://ftp1.digi.com/support/beta/linux/dgrp/dgrp-1.9.tgz
        tar -xf dgrp-1.9.tar.gz
        cd dgrp-1.9
        • ASIDE: For Ubuntu 12.04:
          1. In the configure file, starting at line 4308, there are a bunch of if tests to set KERNEL_HEADERS. Erase them and put in KERNEL_HEADERS=/usr/src/linux-headers-`uname -r`
          2. Install some needed packages
            $ sudo apt-get install libssl-dev libncurses5-dev 
      3. Finish building / installing the digi driver:
        $ ./configure
        $ make
        $ sudo make install
        $ sudo make postinstall
      4. IMPORTANT: Their installer breaks the permissions on /tmp. Your system will not boot if you forget to fix this. Fix /tmp permissions after install:
        $ sudo chmod a+w /tmp
      5. If you do forget to do this, hit ctrl + alt + f1 on the login screen to go to console, then fix the /tmp permissions and reboot.
      6. The supplied udev rules leave the owner and group of the created serial port as root, to fix that we modify their udev rules
        # We add GROUP="dialout" to each rule so that the created devices belong to the dialout group
        $ sudo vi /etc/udev/rules.d/10-dgrp.rules
        KERNEL=="tty_dgrp*", PROGRAM="/usr/bin/dgrp_udev %k", NAME="%c", GROUP="dialout"
        KERNEL=="cu_dgrp*", PROGRAM="/usr/bin/dgrp_udev %k", NAME="%c", GROUP="dialout"
        KERNEL=="pr_dgrp*", PROGRAM="/usr/bin/dgrp_udev %k", NAME="%c", GROUP="dialout"
        $ sudo service udev restart
  2. Now run the dgrp gui interface
    • To run the dgrp gui, you'll need TK installed:
      $ sudo apt-get install tk8.5
      $ sudo dgrp_gui

      This allows you to setup connections to each of the testbeds you have.

  3. Click “Add” and fill in the correct information.
    RealPort ID: Labeled on the testbed ethernet ports. Goes ra, rb, rc...sa, etc
    IP Address: (whatever the address of the node is)
    Number of Ports: 1
    rest as defaults
  4. Now there should be a serial port /dev/tty[realport id]00 that is connected to the testbed.
  5. You should verify the permissions on /dev/tty[realport id]00 to make sure you have access:
$ ls -l /dev/ttyrs00 
crw-rw---- 1 root dialout 249, 0 2012-08-07 15:03 /dev/ttyrs00
    ^^^           ^^^^^^^
    |||           |||||||
group permissions group owner (your user should be a member of the dialout group)

This need not be done with the GUI client. The GUI is a wrapper for commands that can be easily run without the GUI. To connect to a testbed:

$ sudo /usr/bin/dgrp/config/dgrp_cfg_node init  -v -v -e never ra <ip address> 1

Install TinyOS Apps on the Node

You can now install TinyOS apps on the remote nodes using the serial port. However, this becomes cumbersome with a lot of remote nodes. There is also a issue with the Digi RTS lines. From the NESL wiki:

Note that the Digi Connect have some nasty problem with the RTS lines. If you connect to their serial port, then the RTS line gets pulled down. This will result in the epic module on the Quanto Testbed Mote to go into RESET, and thus stops running. The only solution to solve this problem so far is to force the RTS line to stay high, by reconfiguring the Digi module, and then reconfiguring it before programming.

A nice way to take care of both of these issues is to use Thomas Schmid's Managed No[t|d]e Interface. This makes it much easier to handle the issue of the RTS lines and of programming multiple nodes.

  1. Download the code and install the MNI package:
    $ tar -xzf tschmid-mni-c79c4fb.tar.gz
    $ cd tschmid-mni-c79c4fb
    $ sudo python setup.py install

    MNI requires the NumPy library if you don't have it:

    $ sudo apt-get install python-numpy
  2. You probably want to add the mni/scripts folder to your path.
    $ export PATH=$PATH:/path/to/mni/scripts
  3. Edit scripts/config.ini to contain the necessary information to program all of your nodes. This is what my config.ini file looks like. I use it to program two testbeds with the IPBaseStation app.
    [Nodes]
    numNodes: 2
    type: QuantoTestbedMote
    makeCmd: make epic blip
    
    [Node1]
    id: 100
    ip: 141.212.110.127
    serial: /dev/ttyra00
    installCmd: make epic reinstall,$id digi bsl,$serial
    timeoffset: 0
    
    [Node2]
    id: 101
    ip: 141.212.110.128
    serial: /dev/ttyrb00
    installCmd: make epic reinstall,$id digi bsl,$serial
    timeoffset: 0

    Now copy your config.ini to the folder of the TinyOS app. If you don't need a different config.ini for each application, try modifying install_quanto.py by changing the option parsing and MNI instantiation section to

    parser = optparse.OptionParser()
    parser.add_option("-c", "--calibrate",
            action="store_true", dest="calibrate", default=False,
            help="calibrate the nodes using the CalibrateQuanto applications, before installing.")
    parser.add_option("-f", "--config",
            action="store", type="string", dest="config", default="config.ini",
            help="the config file to use.")
    (options, args) = parser.parse_args()
     
    m = quanto.QuantoMNI(options.config)
    m.compile()

    Now you can specify a config file like so:

    $ install_quanto.py -f /path/to/config.ini
  4. Now install your desired TinyOS app on the nodes.
    $ cd $TOSROOT/apps/IPBaseStation
    $ install_quanto.py
    Installing application on nodes: 100,141.212.110.127
    Installing application on nodes: 101,141.212.110.128
  5. To login to the testbeds, login: root, password: dbps
tinyos_epic_testbed.txt · Last modified: 2013/02/10 01:11 by bradjc