There are two levels of packet formatting.
First is related to 'Serial.h', and second is related to delimiting
and escaping.
Serial.h has been modified (2.0.0->2.0.2->2.HEAD)...
so you might have problems if you have different versions of code...
or TEPS might not have been updated.
Regarding the delimiting and escaping stuff, you can forget about them
if you use the c code in support/sdk/c/sf/*...
use 'write_serial_packet' to send packets, or look at the the examples
in that directory.
If you have the cvs head, then this is how you might want to structure
the packet (in your C# code) before you sending it down to the
'write_serial_packet' or 'write_sf_packet' function in support/sdk/c/sf/*;
typedef struct message_t {
uint8_t pad; // must set this to zero
uint16_t addr;
uint16_t src;
uint8_t length;
uint8_t group;
uint8_t type;
uint8_t data[TOSH_DATA_LENGTH];
} __attribute((packed)) message_t;
Thanks
- jpaek
On Thu, Apr 10, 2008 at 1:10 AM, Li Jianfeng <[EMAIL PROTECTED]> wrote:
> Dear Greg,
>
> Thanks for your information, that's really helpful. But I found out that the
> example illustrated in TEP 113 section 3.6 was incompatible with the java
> code and the structure defined in Serial.h. I think there should be two
> bytes between the destination address (be ef) and the data length byte (05).
> I will verify it in my code.
>
> Thank you!
>
> Jennifer
>
>
>
> On Thu, Apr 10, 2008 at 12:19 PM, Greg Hackmann <[EMAIL PROTECTED]> wrote:
>
> >
> > Li Jianfeng wrote:
> >
> > > And then I send a package "00 FF FF 00 00 01 00 09 05" from UART, but
> nothing happened, even the red light that indicates having receive a message
> from UART did not on at all. I modified the package as the the format of
> UART receiving message from mote, that is "7E 45 00 FF FF 00 00 01 00 09 05
> DD 1D 7E", the mote still did not work.
> > >
> >
> > You should read TEP 113
> (http://www.tinyos.net/tinyos-2.x/doc/html/tep113.html). It gives the
> format of serial messages and describes the rules for delimiting and
> escaping packets.
> >
> >
> >
> > > I have also tried to find how the java application send the data
> package, but what I found in AbstractSource.java is a function that always
> return TRUE ( writeSourcePacket(byte[] packet) ). So I did not know what
> happened during the sending process.
> > >
> >
> > The code for sending packets in the TinyOS serial format is in
> net.tinyos.packet.Packetizer.
> >
> > Greg Hackmann
> >
> >
>
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
>
--
Jeongyeup Paek
Ph.D. student
Embedded Networks Laboratory
Department of Computer Science
University of Southern California
http://enl.usc.edu/~jpaek
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help