Mote-PC Serial Communication
The receivers receive packets from senders and pass them on to the serial port. Tinyos provides two java tools ( "Listen" and "MsgReader" ) to print the messages on the PC console.
node1-2:~# java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
The Listen tool receives the packets and prints the raw packets to the PC console. Output should look something like this:
node1-2:/opt/tinyos-2.1.0/apps/BaseStation# java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb serial@/dev/ttyUSB0:115200: resynchronising 00 FF FF 00 01 04 00 06 00 01 00 4E 00 FF FF 00 01 04 00 06 00 01 00 4F 00 FF FF 00 01 04 00 06 00 01 00 50 00 FF FF 00 01 04 00 06 00 01 00 51 00 FF FF 00 01 04 00 06 00 01 00 52 00 FF FF 00 01 04 00 06 00 01 00 53 00 FF FF 00 01 04 00 06 00 01 00 54 00 FF FF 00 01 04 00 06 00 01 00 55 00 FF FF 00 01 04 00 06 00 01 00 56 00 FF FF 00 01 04 00 06 00 01 00 57 00 FF FF 00 01 04 00 06 00 01 00 58 00 FF FF 00 01 04 00 06 00 01 00 59 00 FF FF 00 01 04 00 06 00 01 00 5A 00 FF FF 00 01 04 00 06 00 01 00 5B
MsgReader is a better alternative to Listen. The MsgReader class takes a java message class (provided by the user) as an argument. It prints the packet structure defined by the java message class on the console.
node1-2:~# java net.tinyos.tools.MsgReader -comm serial@/dev/ttyUSB0:telosb BlinkToRadioMsg
We see the output like this:
1152232617609: Message [nodeid=0x2] [counter=0x1049] 1152232617609: Message [nodeid=0x2] [counter=0x104a] 1152232617609: Message [nodeid=0x2] [counter=0x104b] 1152232617621: Message [nodeid=0x2] [counter=0x104c]
Last modified
16 years ago
Last modified on Dec 24, 2008, 1:19:24 AM
Note:
See TracWiki
for help on using the wiki.