[Tinyos-devel] serial communication in TinyOS2
Razvan Musaloiu-E.
razvanm at cs.jhu.edu
Mon Jun 5 17:38:59 PDT 2006
Hi!
I'm trying to use the serial communication from TinyOS2 and I encounter
some difficulties.
First: even the description of sfsend in README says:
- sfsend: send a packet (specified on the command line) to a serial forwarder
the code doesn't really do this. It tries to send some packets but they
are composed manually. The way it is done is like this:
26 unsigned char packet[100];
27
28 packet[i++] = 0xff; // addr low byte
29 packet[i++] = 0xff; // addr high byte
30 packet[i++] = 0x04; // AM id
31 packet[i++] = 0xbc; // group id
32 lenp = i++; // length
33 packet[i++] = j; // payload
34 packet[i++] = 0xbe; // payload
35 packet[i++] = 0xef; // payload
36
37 packet[lenp] = i-5; // length, don't include header
This doesn't seem to follow the format described in
tinyos-2.x/tos/lib/serial/Serial.h which is:
112 typedef nx_struct serial_header {
113 nx_am_addr_t addr;
114 nx_uint8_t length;
115 nx_am_group_t group;
116 nx_am_id_t type;
117 } serial_header_t;
Could someone provide some guidance here? :-)
Second: I find very tempting to use Python to talk to a serial forwarder
but the code from tinyos-2.x/support/sdk/python doesn't have any
utilization instructions. :-) I manage find how I can connect to a serial
forwarder (sending "U ") and what is the format of the received data
(one byte size follow by the packet) but I still don't know how to
use the Message class in a useful way. Could someone make a little light
here? :-)
Thank you!
Razvan ME
More information about the Tinyos-devel
mailing list