Following is a detailed example that we used explain to undergrad students
here. Sorry for being too detailed.
1) start sf at the desired port number, for ex., ./sf 9001 /dev/ttyUSB0
telosb
9001 - SF port number
/dev/ttyUSB0 - device address
telosb - you can use name of the mote to specify baudrate
2) Once you start SF at 9001, you can use
a) "sfsend" to send commands to your mote: ./sfsend syncByte
destination source length AMType PAYLOAD
syncByte (1 byte): 0
destination (two bytes): 0 126
source (2 bytes): 0 0
length (1 byte): length of payload
group (1 Byte): 0
AMType (1 byte): AM type of your message
PAYLOAD: payload starts here
b) You can use "sflisten" to see what your program dumps from the mote
./sflisten hostAddr sfPort
e.x., ./sflisten 127.0.0.1 9001
Regards,
Manjunath D
Manjunath D
################################################################################################################
***************************************************************************************************************
On Tue, 29 Jun 2010, David Rodenas Herr?iz wrote:
Hi
I want to write a C++ program to send data from PC to a base station mote (app
BaseStation) , and this one, send the data received to another mote. I have
problems with the format packet I have to send (I connect to SerialForwarder
and receive data). I have the following code (to do it, I used:
http://www.tinyos.net/tinyos-2.x/doc/html/tep113.html):
____________________________________________________________________
char lenmsg = 13;
unsigned char buff[13];
int i = 0;
buff[i++]
= 0x7E; // Framing byte
buff[i++] = 0x40; // Protocol byte:
SerialP
buff[i++] = 0x09; // Sequence number?
buff[i++] = 0x00;
// Packet format dispatch byte
buff[i++] = 0xFF; // Message dest address
buff[i++]
= 0xFF; // Message dest address
buff[i++] = 0x01; // Packet size
buff[i++]
= 0x00; // Group ID
buff[i++] = 0x06; // Message Type
//buff[i++]
= 0x5D; // 0x06 isn't a scape, so I don't need it
buff[i++] = 0x56;
// Data
buff[i++] = 0x00; // CRC ?? I don't know how to calculate CRC
buff[i++] = 0x00; // CRC
buff[i++]
= 0x7E; // Framing byte */
send(fd, &lenmsg, 1, 0);
send(fd,
(char*)buff, lenmsg, 0);
____________________________________________________________________
I can see in the counter of packets written in the SerialForwarder (java
version) that the packet is send, but it doesn't reach the basestation. I don't
know if I'm using the right packet format to send data to SerialForwarder,
because I thing the code above is for serial communication, not to
SerialForwarder communication. I tested the following code (SerialAM message),
but I had the same result:
____________________________________________________________________
char lenmsg = 13;
unsigned char buff[13];
int i = 0;
buff[i++] = 0xFF; // Message dest address
buff[i++]
= 0xFF; // Message dest address
buff[i++] = 0x01; // Packet size
buff[i++]
= 0x00; // Group ID
buff[i++] = 0x06; // Message Type
buff[i++] = 0x56;
// Data
send(fd, &lenmsg, 1, 0);
send(fd,
(char*)buff, lenmsg, 0);
____________________________________________________________________
Any suggestion?
Thanks
David
_________________________________________________________________
S? el protagonista de GQ con Messenger y Vodafone Blackberry. ?Y gana premios!
http://serviciosmoviles.es.msn.com/messenger/vodafone.aspx
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help