Hello, sir:
In tossim, I found an error that the node received the wrong radio
packet from one-hop neighbor node.
By test RadioCountToLeds application in the folder
/opt/tinyos-2.x/apps/RadioCountToLeds, this error may be found.
step1, modify radio_count_msg_t struct in the file RadioCountToLeds.h,
and change TOSH_DATA_LENGTH to 100:
#define TOSH_DATA_LENGTH 100
#ifndef VISIT_ROUTE
#define VISIT_ROUTE 20
#endif
typedef nx_struct radio_count_msg {
nx_uint16_t counter;
nx_uint16_t path[VISIT_ROUTE];
} radio_count_msg_t;
step2, assign the values to path[VISIT_ROUTE] in the event
function event void MilliTimer.fired(), in the file RadioCountToLedsC.nc
for (i=0; i<VISIT_ROUTE; i++)
rcm->path[i] = TOS_NODE_ID + i;
step3, print the received data in the function: event message_t*
Receive.receive(message_t* bufPtr, void* payload, uint8_t len)
radio_count_msg_t* rcm = (radio_count_msg_t*)payload;
dbg("RadioCountToLedsC", "receiver: ");
for(i=0; i<VISIT_ROUTE; i++)
dbg_clear("RadioCountToLedsC", "%u----",rcm->path[i]);
dbg_clear("RadioCountToLedsC","\n");
But the received data is wrong, the log is below, please note that the
wrong data item begin at 15th item:
DEBUG (1): RadioCountToLedsC: timer fired, counter is 1.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (1): sender:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----
DEBUG (2): RadioCountToLedsC: timer fired, counter is 1.
DEBUG (2): RadioCountToLedsC: packet sent.
DEBUG (2): sender:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21----
DEBUG (1): Received packet of length 42.
DEBUG (1): receiver:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----
51456----17----0----0----0----0----
DEBUG (2): Received packet of length 42.
DEBUG (2): receiver:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----
51712----16----0----0----0----0----
DEBUG (1): RadioCountToLedsC: timer fired, counter is 2.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (1): sender:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----
DEBUG (2): RadioCountToLedsC: timer fired, counter is 2.
DEBUG (2): RadioCountToLedsC: packet sent.
DEBUG (2): sender:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21----
DEBUG (1): Received packet of length 42.
DEBUG (1): receiver:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----
51456----17----65535----1----10752----1536----
DEBUG (2): Received packet of length 42.
DEBUG (2): receiver:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----
51712----16----0----0----0----0----
DEBUG (1): RadioCountToLedsC: timer fired, counter is 3.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (1): sender:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----
DEBUG (2): RadioCountToLedsC: timer fired, counter is 3.
DEBUG (2): RadioCountToLedsC: packet sent.
DEBUG (2): sender:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21----
DEBUG (1): Received packet of length 42.
DEBUG (1): receiver:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----
51456----17----65535----1----10752----1536----
DEBUG (2): Received packet of length 42.
DEBUG (2): receiver:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----
51712----16----0----0----0----0----
DEBUG (1): RadioCountToLedsC: timer fired, counter is 4.
DEBUG (1): RadioCountToLedsC: packet sent.
DEBUG (1): sender:
1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----
DEBUG (2): RadioCountToLedsC: timer fired, counter is 4.
DEBUG (2): RadioCountToLedsC: packet sent.
DEBUG (2): sender:
2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21----
The source code is attached. Please refer to the attached.
Why? If there is the bug in Tossim?
Thx
Alex
1 2 -54.0 2 1 -55.0
/*
* "Copyright (c) 2004-2005 The Regents of the University of California.
* All rights reserved.
*
* Permission to use, copy, modify, and distribute this software and its
* documentation for any purpose, without fee, and without written agreement is
* hereby granted, provided that the above copyright notice, the following
* two paragraphs and the author appear in all copies of this software.
*
* IN NO EVENT SHALL THE UNIVERSITY OF CALIFORNIA BE LIABLE TO ANY PARTY FOR
* DIRECT, INDIRECT, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT
* OF THE USE OF THIS SOFTWARE AND ITS DOCUMENTATION, EVEN IF THE UNIVERSITY OF
* CALIFORNIA HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* THE UNIVERSITY OF CALIFORNIA SPECIFICALLY DISCLAIMS ANY WARRANTIES,
* INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY
* AND FITNESS FOR A PARTICULAR PURPOSE. THE SOFTWARE PROVIDED HEREUNDER IS
* ON AN "AS IS" BASIS, AND THE UNIVERSITY OF CALIFORNIA HAS NO OBLIGATION TO
* PROVIDE MAINTENANCE, SUPPORT, UPDATES, ENHANCEMENTS, OR MODIFICATIONS."
*
* Copyright (c) 2002-2003 Intel Corporation
* All rights reserved.
*
* This file is distributed under the terms in the attached INTEL-LICENSE
* file. If you do not find these files, copies can be found by writing to
* Intel Research Berkeley, 2150 Shattuck Avenue, Suite 1300, Berkeley, CA,
* 94704. Attention: Intel License Inquiry.
*/
#ifndef RADIO_COUNT_TO_LEDS_H
#define RADIO_COUNT_TO_LEDS_H
#define TOSH_DATA_LENGTH 100
#ifndef VISIT_ROUTE
#define VISIT_ROUTE 20
#endif
typedef nx_struct radio_count_msg {
nx_uint16_t counter;
nx_uint16_t path[VISIT_ROUTE];
} radio_count_msg_t;
enum {
AM_RADIO_COUNT_MSG = 6,
};
#endif
RadioCountToLedsAppC.nc
Description: Cdf file
RadioCountToLedsC.nc
Description: Cdf file
test3.py
Description: Binary data
DEBUG (1): RadioCountToLedsC: timer fired, counter is 1. DEBUG (1): RadioCountToLedsC: packet sent. DEBUG (1): sender: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20---- DEBUG (2): RadioCountToLedsC: timer fired, counter is 1. DEBUG (2): RadioCountToLedsC: packet sent. DEBUG (2): sender: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21---- DEBUG (1): Received packet of length 42. DEBUG (1): receiver: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----51456----17----0----0----0----0---- DEBUG (2): Received packet of length 42. DEBUG (2): receiver: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----51712----16----0----0----0----0---- DEBUG (1): RadioCountToLedsC: timer fired, counter is 2. DEBUG (1): RadioCountToLedsC: packet sent. DEBUG (1): sender: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20---- DEBUG (2): RadioCountToLedsC: timer fired, counter is 2. DEBUG (2): RadioCountToLedsC: packet sent. DEBUG (2): sender: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21---- DEBUG (1): Received packet of length 42. DEBUG (1): receiver: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----51456----17----65535----1----10752----1536---- DEBUG (2): Received packet of length 42. DEBUG (2): receiver: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----51712----16----0----0----0----0---- DEBUG (1): RadioCountToLedsC: timer fired, counter is 3. DEBUG (1): RadioCountToLedsC: packet sent. DEBUG (1): sender: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20---- DEBUG (2): RadioCountToLedsC: timer fired, counter is 3. DEBUG (2): RadioCountToLedsC: packet sent. DEBUG (2): sender: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21---- DEBUG (1): Received packet of length 42. DEBUG (1): receiver: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----51456----17----65535----1----10752----1536---- DEBUG (2): Received packet of length 42. DEBUG (2): receiver: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----51712----16----0----0----0----0---- DEBUG (1): RadioCountToLedsC: timer fired, counter is 4. DEBUG (1): RadioCountToLedsC: packet sent. DEBUG (1): sender: 1----2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20---- DEBUG (2): RadioCountToLedsC: timer fired, counter is 4. DEBUG (2): RadioCountToLedsC: packet sent. DEBUG (2): sender: 2----3----4----5----6----7----8----9----10----11----12----13----14----15----16----17----18----19----20----21----
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
