Skip to content
Yasuyuki Tanaka edited this page May 8, 2019 · 28 revisions

The same Mercator firmware runs on each mote during an experiment.

       serial  +------+
          +----| mote |-<
+------+  |    +------+
|      |--+       .
|  PC  |          .    wireless
|      |--+       .
+------+  |    +------+
          +----| mote |-<
       serial  +------+

The PC running the experiment drives each mote through its serial port:

  • The PC can tell a mote to transmit.
  • The PC can tell a mote to listen. The mote then reports all received packets over its serial port.

Getting the Firmware

You can download the firmware in the code/ directory of this repository.

Alternatively, since it is part of the standard OpenWSN release, you can rebuild it: Build the Firmware

The file you can load onto the IoT-LAB testbed is at \openwsn-fw\firmware\openos\projects\common\01bsp_mercator_prog.ihex.

Serial Protocol

The Serial protocol is used by the PC to drive the mote, and by the mote to notify the PC when it receives a packet or when if it done sending.

Encoding

All serial frames are framed using HDLC (RFC1662). The format of an HDLC-framed frame is:

flag payload crc flag
1B variable 2B 1B

All multi-byte fields are encoded big-endian.

Serial Frame Format

Each serial frame starts with a type byte, which can have the following value

value name direction description
1 TYPE_REQ_ST PC->mote what is your status
2 TYPE_RESP_ST mote->PC this is my status
3 TYPE_REQ_IDLE PC->mote switch off radio
4 TYPE_REQ_TX PC->mote start transmitting
5 TYPE_IND_TXDONE mote->PC I am done transmitting packets
6 TYPE_REQ_RX PC->mote start receiving
7 TYPE_IND_RX mote->PC I received a packet
8 TYPE_IND_UP mote->PC I am up, ready to work
Format of a TYPE_REQ_ST frame
type
1B (TYPE_REQ_ST)
Format of a TYPE_RESP_ST frame
type status numnotifications mac
1B (TYPE_RESP_ST) 1B 2B 8B

The status can take one of the following values:

value name description
1 ST_IDLE radio off
2 ST_TX actively busy transmitting
3 ST_TXDONE done transmitting
4 ST_RX radio listening or receiving

numnotifications is a counter which indicates how many TYPE_IND_TXDONE and TYPE_IND_RX were sent by the mote. This counter is reset when the mote receives a TYPE_REQ_TX or TYPE_REQ_RX request.

Format of a TYPE_REQ_IDLE frame
type
1B (TYPE_REQ_IDLE)
Format of a TYPE_REQ_TX frame
type frequency txpower transctr txnumpk txifdur txlength txfillbyte
1B (TYPE_REQ_TX) 1B 1B (signed) 2B 2B 2B 1B 1B
Format of a TYPE_IND_TXDONE frame
type
1B (TYPE_IND_TXDONE)
Format of a TYPE_REQ_RX frame
type frequency srcmac transctr txlength txfillbyte
1B (TYPE_REQ_RX) 1B 8B 2B 1B 1B
Format of a TYPE_IND_RX frame
type length rssi flags pkctr
1B (TYPE_IND_RX) 1B 1B 1B 2B

Where flags is a bitmap of the following flags

position name decription
0 FLG_CRC set iff the CRC passes
1 FLG_MINE set iff this is an expected packet

Wireless Packet Format

mac transctr pkctr payload
8B 1B 2B txlength-11 repetitions of the txfillbyte byte

LED conventions

  • error led on when actively transmitting
  • radio led on when radio on listening/receiving
  • sync led on when in UART ISR
Clone this wiki locally