Hi Daniel Jorge, 

In TEP113 explain very clear the packet format for tinyos 2.x:

More information in:  http://tinyos.net/tinyos-2.x/doc/txt/tep113.txt

Example:

3.6 Packet Format
--------------------------------------------------------------------

A data packet in the TinyOS 2.x serial stack has the following format
over the wire. Each protocol field is associated with a specific component:

::

     ____________________________________________
    | | | | |                               |  | |
    | | | | |                               |  | | 
    |_|_|_|_|_______________________________|__|_|
     F P S D         Payload                 CR F
   
  F       = Framing byte, denoting start of packet: HdlcTranslateC
  P       = Protocol byte: SerialP
  S       = Sequence number byte: SerialP
  D       = Packet format dispatch byte: SerialDispatcherC
  Payload = Data payload (stored in SerialDispatcherC): SerialDispatcherC
  CR      = Two-byte CRC over S to end of Payload: SerialP
  F       = Framing byte denoting end of packet: HdlcTranslateC

Payload is a contiguous packet that SerialDispatcherC reads in.  Note
that any data bytes (P - CR) equal to 0x7e or 0x7d will be escaped to
0x7d 0x5e or 0x7d 0x5d accordingly. For example, a platform
independent AM packet of type 6, group 0x7d, and length 5 to
destination 0xbeef with a payload of 1 2 3 4 5 would look like this:

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

Note that the group 0x7d is escaped to 0x7d 0x5d. The protocol field
(P) is 0x40 (64), corresponding to ``SERIAL_PROTO_ACK`` (in Serial.h).


Jorge H
http://isi.upc.es


> ------------------------------
> 
> Message: 5
> Date: Fri, 19 Dec 2008 12:05:37 +0000
> From: [email protected]
> Subject: Re: [Tinyos-help] Tinyos 1.x Java (TestSerial)
> packet format
> To: [email protected]
> Message-ID:
> <[email protected]>
> Content-Type:
> text/plain;   charset=ISO-8859-1;     format="flowed"
> 
> Hi Jorge
> In your example, the message has more than one escape byte
> in the end?
> If it was on tinyos 2.x, how would this message be?
> Thanks for this software tip, its gonna be useful.
> 
> Greetings,
> Daniel Jorge
> 
> > Dear Daniel,
> >
> > In tinyos 1.x  the packet include bytes for
> syncronization each frame 
> > (7E). I`m use  Dockligth hiperterminal for this task. 
> > http://www.docklight.de/
> >
> > Example:
> >
> >
> 7E    42      2C      01      08      00      FF      FF      FF      FF      
> 0F      9D      02      00      00      00      00      00      09      00    
>   00      00      00      07      03      01      F0      86      7E      7E  
>     00
> >
> > The crc is: F0 86
> >
> > the crc calcule only include:
> >
> >
> 42    2C      01      08      00      FF      FF      FF      FF      0F      
> 9D      02      00      00      00      00      00      09      00      00    
>   00      00      07      03      01
> >
> >
> > Jorge Higuera







      

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to