> Test 2: LISTEN JAVA (5 data frames are depicted)
>
> $ java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
>
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 01 23 02 23 03 23 04 23 06 EA

This packet is not an AM-packet, because the first byte is not zero
(c.f. 
http://docs.tinyos.net/tinywiki/index.php/Mote-PC_serial_communication_and_SerialForwarder).
You are using apps/tests/tkn154/packetsniffer, which doesn't use the
default serial stack, but wires to Serial802_15_4C (in
tos/lib/serial). Take a look
apps/tests/tkn154/packetsniffer/README.txt, it explains the packet
format and points you to a c-file that you can use to extract the
data.

If you want to send standard AM-Packets (and use java
net.tinyos.tools.Listen) wire to SerialActiveMessageC instead of
Serial802_15_4C (see example in apps/tests/TestSerial).

Jan

On Fri, Jul 27, 2012 at 12:10 PM, David Rodenas <[email protected]> wrote:
> Hi all
>
> Sorry for the length, but I thing that it was necessary to explain my
> concern. I've programmed a telosb acting as a transmitter that sends
> periodically a broadcast message to another telosb acting as a network
> coordinator (and also as a reciver). I am using the TKN154 libraries. The
> main network parameters are:
>
> RADIO CHANNEL is 26,
> PAN ID is 0x4927,
> COORDINATOR ADDRESS is 0x6287,
> DEVICE ADDRESS is 0x6245,
> TRANSMISSION is broadcast (daddr is 0xFFFF).
>
> The payload contains two fields: 1) the device address (0x6287) and 2) four
> uint16_t values as network data (0x2301 0x2302 0x2303 0x2304)
>
> The coordinator app is based on the packetsniffer app (apps/tests/tkn154)
> with some modifications. What I want is to send every data frame received by
> the coordinator through the serial port to my laptop. Thereby, here is the
> part of the code that conducts this issue:
>
> event message_t* MCPS_DATA.indication ( message_t* frame_ ){
>   call Leds.led1Toggle();
>   if (call Queue.enqueue(frame_) != SUCCESS) {
>     call Leds.led0On(); // overflow
>     return frame_;
>   } else {
>     post serialSendTask();
>     return call Pool.get();
>   }
> }
>
> task void serialSendTask()
> {
>   message_t* frame;
>   uint8_t headerLen;
>   uint8_t payloadLen;
>   uint8_t serialLen;
>   uint8_t *header;
>   uint8_t *payload;
>   uint8_t i;
>   if (call Queue.empty() || m_serialSendBusy)
>     return;
>
>   frame = call Queue.head();
>
>   headerLen = call Frame.getHeaderLength(frame);
>   payloadLen = call Frame.getPayloadLength(frame);
>   header = call Frame.getHeader(frame);
>   payload = call Frame.getPayload(frame);
>
>   /*
>   // Test 1: printf
>   printf("MHRLen: %d\n", headerLen);
>   printf("MHR: ");
>   for (i=0; i<headerLen; i++){
>     printf("0x%02X ", header[i]);
>   }
>   printf("\n");
>   printf("PayloadLen: %d\n", payloadLen);
>   printf("Payload: ");
>   for (i=0; i<payloadLen; i++){
>     printf("0x%02X ", payload[i]);
>   }
>   printf("\n\n");
>   */
>
>   // Test 2: java Listen
>   serialLen = headerLen + payloadLen;
>   m_serialSendBusy = TRUE;
>   if (call SerialSend.send(frame, serialLen) != SUCCESS)
>     report_received();   //call Leds.led2Toggle();
> }
>
> As you can see, I carry out two tests: 1) by using the printf libraries, I
> represent the content of the header and the payload fields; and 2) I use the
> Listen java app to see what I receive from the serial port. The results are
> the following:
>
> Test 1: PRINTF (only one data frame is depicted since the transmission
> conditions and network data are always the same)
>
> $ java net.tinyos.tools.PrintfClient -comm serial@/dev/ttyUSB0:telosb
>
> MHRLen: 9
> MHR: 0x41 0x88 0x90 0x27 0x49 0xFF 0xFF 0x45 0x62
> PayloadLen: 10
> Payload: 0x45 0x62 0x01 0x23 0x02 0x23 0x03 0x23 0x04 0x23
>
> I've not checked the header fields but, a priori, the result is what I
> expected.
>
>
> Test 2: LISTEN JAVA (5 data frames are depicted)
>
> $ java net.tinyos.tools.Listen -comm serial@/dev/ttyUSB0:telosb
>
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 01 23 02 23 03 23 04 23 06 EA
> 00 00 00 00 00 00 00
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 00 00 02 23 03 23 04 23 08 EB
> 00 00 00 00 00 00 00
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 00 00 02 23 03 23 04 23 0C E9
> 00 00 00 00 00 00 00
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 00 00 02 23 03 23 04 23 09 EA
> 00 00 00 00 00 00 00
> 02 00 00 00 00 00 00 00 00 00 00 00 00 45 62 00 00 02 23 03 23 04 23 0C EB
> 00 00 00 00 00 00 00
>
> I am aware of that the first byte is the AM type (0x02). In addition, the
> payload is successfully received (45 62 01 23 02 23 03 23 04 23). However,
> where is the header? And the latest zeros? and what do "06 EA", "08 EB", "0C
> E9", "09 EA", "0C EB" mean?
>
> I'd like to know what I am doing wrong. In this sense, all the help possible
> would be appreciated.
>
> Regards
>
> David
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to