0

how can i build the serialforwarder or use it to forward the received data to another program to make some process?

how to parse the data and use it as input data to another program such as Matlab or c# or java application. which protocol used to parse the recieved data ?

last question: it is just for motes which is base station mote ? can i build one for any mote ?

Hana90
  • 943
  • 5
  • 17
  • 37

1 Answers1

0

You have to read thoroughly the serial stack...its not very easy but its do able.

You can directly read from serial port. You don't need serial forwarder in this case. There are few things to take care of.

For example if you want to read a serial message that is being send to serial port of your PC (usb sensorboards just work like serial, since they are using usb to serial converters lik FTDI chip).

in C# (same for Java, etc...) you can read byte streams that are coming in the serial port. You can parse this byte streams to extract a standard serial message of tinyos.

This is somehow explained in TEP #113 although it has some problems, but you should be able to find those problems and make your program work.

As it stated in TEP 113, a standard serial packet is something like:

7e 40 09 00 be ef 05 7d 5d 06 01 02 03 04 05 7e

That means, a packet starts with hex 7E ( I believe its 126 or 127) and ends also with 7E. The last 2 bytes are CRC of the packet. So you can in your c# program start reading from serial port when you encounter 7E and stop reading when you reach the next 7E in the stream. Everything in between will be your packet.

You have to be careful of escaping that is if a 7E is part of your packet content, to be not be confused with start and end dilimeters, it will be escaped to something else...that's also is explained in that TEP 113.

I believe there were some C++ code fro calculating the CRC that you can easily convert it to C# or Java code.

Also check the source code of Serial.h which contains some details about how a serial packet is being formed in TinyOS.

Dumbo
  • 13,555
  • 54
  • 184
  • 288