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
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]> 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]
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