I think the sync bytes are covered in the octavetech doc.
Each message is preceeded and succeeded (bracketed) by a
0x7E byte so the receiving code can figure out where it
is in the stream. All other 7E's in the message are
"escaped", which at least triples the complicatedness
of the system. But it seems to work.
If you are sending a raw stream out of the PC without
benefit of any TOS code (like Packetizer.java) you need
to add the 7E's, or not delete them.
MS
Inderjit Singh wrote:
Thanks for the suggestions lad. Very appreciated. Most of them I have
already thought of. The code was only written to test that the
communication is working. That's it. But It's good to be confirmed on
the issue. Thanks.
However, Michael, what do you mean by "you need to leave the 7E's alone
as well" ? I don't understand. And what is this "bracketed with the sync
byte"? Could you give an example please?
Inderjit
On 4/18/07, *Michael Schippling* < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
I think you need to leave the 7E's alone as well.
If it's going to GenericComm, the full message
should be bracketed with the sync bytes. If that
doesn't work it may be due to having to swap a
source address or something...
Structure alignment shouldn't be a problem if you
are dealing with a char array that was structured
correctly to start with. You might check that your
pc serial driver is not trying to "help" by adding
line-feeds or something...it should be raw I/O.
Hopefully you've seen the octavetech doc:
http://www.octavetech.com/pubs/TB5-01%20Deciphering%20TinyOS%20Serial%20Packets.pdf
<http://www.octavetech.com/pubs/TB5-01%20Deciphering%20TinyOS%20Serial%20Packets.pdf>
MS
Inderjit Singh wrote:
> Thanks Ben,
>
> I tried something very simple:
>
> 1. I get the byte stream from usb sent from the TMote like:
> 7e 42 xx xx xx xx 7e
>
> 2. I remove the 7e from the stream and send it back as it is (42 xx xx
> xx xx). But I still don't get it. C/C++ should be able to handle this
> no?
>
> Is there any doc on how the serial communication should be
> established. I have gone through the java code for sending but still
> it would help with a doc.
>
> Indy
>
>
> On 4/11/07, Ben Buckner < [EMAIL PROTECTED]
<mailto:[EMAIL PROTECTED]>> wrote:
> > > Hi,
> > >
> > > I have trouble sending msg from laptop (using c++) code to tmote.
> > All the
> > > code is at the bottom. I have no problem reading the data from the
> > serial
> > > but sending it back dooesn't seam to work. Anyone knows why?
Thanks.
> > >
> > > Indy
> > [...]
> > > memcpy(output_buffer, &msgOUT, sizeof(msgOUT));
> >
> > Out of the dozens of things that could be wrong, it might be worth
> > pointing
> > out that C does not guarantee that structures can be serialized by
> > copying
> > bytewise out of memory like that. It can work, but you never
know. The
> > most
> > usual reason why that would fail is if the compiler tries to
align the
> > members of the structure and inserts padding (which it almost
always does
> > with odd-sized byte fields). At any rate, it would be a good idea
to make
> > sure that the code really generates the byte stream that you
think it's
> > generating.
> >
> > Ben B.
> >
> >
> >
> > _______________________________________________
> > Tinyos-help mailing list
> > [email protected]
<mailto:[email protected]>
> >
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> >
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
<mailto:[email protected]>
>
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
<https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help>
------------------------------------------------------------------------
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help