Serial-line communication in TinyOS-1.1

Last updated 03 Sep 2003


Description

Protocol:

The protocol used by TinyOS-1.1 is loosely based on the PPP in HDLC-like framing described in RFC-1662. It uses the same framing and escape sequences and a 16-bit CRC. The protocol always assumes Address-and-Control field compression. The implementation understands the Protocol IDs in Table 1. All other protocols are rejected.

Id Value Description
PROTO_ACK 64 (0x40) An acknowledgement packet. Typically sent by the TinyOS device back to the host backend.  The packet consists of a one byte payload which is the token of the corresponding packet being acknowledged.
PROTO_PACKET_ACK 65 (0x41) A data packet that expects a subsequent ACK packet.  The first byte of the payload contains the token that must be returned in the ACK.
PROTO_PACKET_NOACK 66 (0x42) A data packet that does not require a subsequent ACK packet.
PROTO_UNKNOWN 255 (0xFF) A packet sent by a receiver when it receives a packet of an unknown/unsupported protocol

Table 1: Known framer protocol types.

Components:

The following components implement the framing protocol on the TinyOS device:

FramerM: The TinyOS module that provides the core framing protocol. It provides the BareSendMsg, ReceiveMsg and TokenReceiveMsg interfaces. The TokenReceiveMsg interface is used when handling packets that require acknowledgements. The interface extends the ReceiveMsg interface by including a field for the token on the receiver and a new command, ReflectToken(), that triggers the ACK process. The use of acknowledgements is intended as a simple flow control scheme to prevent exceeding buffering capacities on a TinyOS device.

FramerAckM: A generic module that implements ACK processing for inbound packets. It is intended to be used in lieu of applications that specifically handle ACKs.

UARTFramedPacket: A configuration component that incorporates both FramerM and FramerAckM. It exports the same interface as UARTNoCRCPacket and can be used interchangeably with that component. The default UART communication provider for GenericComm in TinyOS-1.1 is UARTFramedPacket.

Applications:

The following applications are provided for simple interfacing to a TinyOS network:

TOSBase (apps/TOSBase): An application that acts as a simple bridge between the serial and wireless channel. It is similar to the older GenericBase, but incorporates FramerM. TOSBase does not use FramerAckM, but implements it's own ACK handling. Specifically, TOSBase will only ACK a packet received from the serial channel once it has been transmitted over the radio. TOSBase will only bridge those packets whose group id matches the value of the TOS_AM_GROUP value compiled into the application.

TransparentBase (apps/TransparentBase): A bridge identical to TOSBase, except that it does not filter packets based on group id.

GenericBase (apps/GenericBase): The legacy bridging application that does not provide for framing or flow control.

Host Tools:

There are a variety of java-based tools that can be used to simplify serial communication using the new protocol. They include classes and a simple application, SerialForwarder. A key point with these tools is that they understand how to communicate with multiple types of packet sources.  These include directly attached serial links, network links and simulated links using either the framed or legacy protocols. See the Usage section for more information on the specific types of packet sources.

net.tinyos.packet.PacketSource (Interface): This class provides a series of standards methods to communicate with a TinyOS node on a per-packet basis. It provides the basic semantics of open, close, readPacket and writePacket. Refer to tools/java/net/tinyos/packet/PacketSource.java for more information.

net.tinyos.packet.PhoenixSource (Class): This class provides some additional functionality above the standard PacketSource. PhoenixSource spawns a thread that will initiate an upcall whenever a new packet arrives from a serial channel. In the case of network based links, it will attempt to reconnect to the channel if connectivity is lost.  Refer to toos/java/net/tinyos/packet/PhoenixSource.java for more information.

net.tinyos.sf.SerialForwarder (Application): The SerialForwarder acts as a relay point between any packet source and network packet source. It's intended use is to provide TCP/IP connectivity to a locally connected TinyOS device. The SerialForwarder provides the capability of multiplexing multiple network connections into a single connection. That is, multiple remote applications can connect to a TinyOS node via the SerialForwarder (no deterministic serialization is provided, however).