Serial-To-Mote

As can be seen on its schematic, the TelosB mote is equipped with an FT232BM FTDI chip, converting low-level UART frames used by the MSP430 into something your computer can understand. When plugged into a USB port, your operating system sees your TelosB as a serial port.

Note: OpenWSN does not use the Java-based encapsulation tools typically used in TinyOS.

Different types of traffic transit over that serial link, in both directions:

  • from the mote to the OpenLBR/computer:
    • status messages to refresh the OpenVisualizer;
    • error messages to be displayed in the low-left portion of the OpenVisualizer;
    • IPv6/6LoWPAN data packets ;
    • signaling messages to request data from the OpenLBR/computer
  • from the OpenLBR/computer to the mote:
    • IPv6/6LoWPAN data packets previously compacted by 6LoWPAN on the OpenLBR/computer;
    • commands triggered by buttons pressed on the OpenVisualizer;

Frame format

From the mote to the OpenLBR/computer:

^^^<command byte><payload bytes>$$$

The format is borrowed from regular expressions, where !!!^ and $$$ are used to indicate to beginning/end of a frame, resp. The first byte indicates the type of payload that is following:

  • S for status messages
  • E for error messages
  • D for data messages
  • R for requesting data from the OpenLBR/computer

The format of the payload depends on the type of message.

The status message format is:

  • 1B S to indicate a status message;
  • 2B 16b address of the node. This is obtained from the IDManager component;
  • 1B statusElement identifying the type of element which is following. These are listed in openwsn.h;
  • a variable-length payload.

The error message format is:

  • 1B E to indicate an error message;
  • 2B 16b address of the node. This is obtained from the IDManager component;
  • 1B the identifier of the calling component. These are listed in openwsn.h;
  • 1B The error code. These are listed in openwsn.h;
  • 2B arg1, which can take any value;
  • 2B arg2, which can take any value.

The request message format is:

  • 1B R to indicate a request message;
  • 1B a number indicating the number of free bytes in the input buffer (takes 255 if more than 255 bytes are available)

From the OpenLBR/computer to the mote:

<command byte><argument byte><payload bytes>

The OpenLBR/computer sends bytes to the mote only after receiving a request (a R command byte). The first byte it sends is a command byte, indicating the type of command issued (in which case there is no payload), or the type of data payload that is following:

  • Commands:
    • R to select whether the node is a DAG root
    • B to select whether the node is a bridge node
    • E to trigger the sending of an ICMPv6 echo request
    • T to trigger the sending of an TCP packet
    • U to trigger the sending of an UDP packet
  • Data:
    • D to indicate application data payload is following

The meaning of the argument bytes depends on the type of message.

  • for select messages (RB)
    • a command byte Y means yes
    • a command byte N means no
    • a command byte T means toggle
  • for trigger messages (ETU)
    • the command byte is not used; a dummy byte should still be sent.

Buffering in OpenSerial

The OpenSerial component contains two circular buffers, output_buffer and input_buffer.

If everything works, go on to OpenOsTricks.