Hi, I've identified the cause of the problem though I don't quite understand why it occurs. All that was needed to resolve the 'bug' was to change the order in which the components were declared in the App.nc. The key thing is that the sensor components need to be declared after the ActiveMessageC component.
Is there an implicit declaration order that is imposed ? Note that this affects only the Mica2 implementation in TinyOS-2.x. The Micaz does not have this requirement. Diff of the RadioSenseToLeds file follows: *** RadioSenseToLedsAppC.nc.old 2008-07-27 12:17:51.000000000 -0700 --- RadioSenseToLedsAppC.nc 2008-07-27 12:19:01.000000000 -0700 *************** *** 44,51 **** configuration RadioSenseToLedsAppC {} implementation { ! components MainC, RadioSenseToLedsC as App, LedsC, new DemoSensorC(); components ActiveMessageC; components new AMSenderC(AM_RADIO_SENSE_MSG); components new AMReceiverC(AM_RADIO_SENSE_MSG); components new TimerMilliC(); --- 44,52 ---- configuration RadioSenseToLedsAppC {} implementation { ! components MainC, RadioSenseToLedsC as App, LedsC; components ActiveMessageC; + components new DemoSensorC(); components new AMSenderC(AM_RADIO_SENSE_MSG); components new AMReceiverC(AM_RADIO_SENSE_MSG); components new TimerMilliC(); Regards, Zainul. On Sat, Jul 26, 2008 at 10:08 PM, Zainul M Charbiwala <[EMAIL PROTECTED]> wrote: > Hi everyone, > > I'm puzzled over some behavior I noticed when using Avrora with > TinyOS2.x. I'd really appreciate if someone could reproduce the > behavior, which may possibly be a bug in the Mica implementation. I'm > using the RadioCountToLeds application in T2.0.2. I've checked > CntToLedsAndRfm in TinyOS1.x and it works fine. > > To reproduce the bug, all you need to do is add the DemoSensorC > component (or any other component that uses the ADC and MTS300). Then, > I use the following to compile: SENSORBOARD=mts300 make mica2 > > The behavior I'm seeing is that the counter value shown in the radio > packet is the higher order byte (of the 16-bit counter) twice. > The lower order byte never appears in the packet. The length of the > packet seems correct and the CRC seems to have been computed on the > correct packet, so the receiving side then just drops the packet. > > Could someone please confirm this. > > Thanks and Regards, > > Zainul. > > ------------------------------------------------------------ > > Here is the diff of RadioCountToLedsAppC: > > *************** > > implementation { > ! components MainC, RadioCountToLedsC as App, LedsC; > components new AMSenderC(AM_RADIO_COUNT_MSG); > > --- xx,xx ---- > > implementation { > ! components MainC, RadioCountToLedsC as App, LedsC, new > DemoSensorC() as Sensor; > components new AMSenderC(AM_RADIO_COUNT_MSG); > ----------- > > Note that there no other changes to RadioCountToLedsAppC.nc or to > RadioCountToLedsC.nc. > > I'm using a CVS snapshot of Avrora which builds as Beta 1.7.105. The > command line for avrora is: > java avrora.Main -platform=mica2 -simulation=sensor-network > -seconds=1000 -report-seconds -monitors=real-time,leds,packet > -nodecount=1 build/mica2/RadioCountToLeds.elf > > The results with and without the change are as follows: > > ------------------------------------------------------------------------------ > Avrora [Beta 1.7.105] - (c) 2003-2007 UCLA Compilers Group > > Loading build/mica2/RadioCountToLeds.elf...[OK: 0.115 seconds] > =={ Simulation events }======================= > Node Time Event > ------------------------------------------------------------------------------ > 0 0:00:01.086128 off off on > 0 0:00:01.086129 off on on > 0 0:00:01.086129 on on on > 0 0:00:01.086129 on on off > 0 0:00:01.086129 on off off > 0 0:00:01.086130 off off off > 0 0:00:01.089966 ----> 00 0.416 ms > 0 0:00:01.347410 ----> > 00.00.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.01.56.24.24 > 9.583 ms > 0 0:00:01.592827 ----> > 24.24.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.02.35.14.14 > 9.583 ms > 0 0:00:01.837410 ----> > 14.14.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.03.14.04.04 > 9.583 ms > 0 0:00:02.072827 ----> > 04.04.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.04.F3.74.74 > 9.583 ms > 0 0:00:02.310327 ----> > 74.74.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.05.D2.64.64 > 9.583 ms > 0 0:00:02.554077 ----> > 64.64.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.06.B1.54.54 > 9.583 ms > 0 0:00:02.801993 ----> > 54.54.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.07.90.44.44 > 9.583 ms > 0 0:00:03.045327 ----> > 44.44.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.08.7F.B5.B5 > 9.583 ms > 0 0:00:03.275327 ----> > B5.B5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.09.5E.A5.A5 > 9.583 ms > 0 0:00:03.520743 ----> > A5.A5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0A.3D.95.95 > 9.583 ms > 0 0:00:03.766577 ----> > 95.95.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0B.1C.85.85 > 9.583 ms > 0 0:00:04.006577 ----> > 85.85.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0C.FB.F5.F5 > 9.583 ms > 0 0:00:04.244077 ----> > F5.F5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0D.DA.E5.E5 > 9.583 ms > 0 0:00:04.481160 ----> > E5.E5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0E.B9.D5.D5 > 9.583 ms > 0 0:00:04.729910 ----> > D5.D5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.0F.98.C5.C5 > 9.583 ms > 0 0:00:04.965743 ----> > C5.C5.AA.AA.AA.AA.AA.AA.AA.33.CC.FF.FF.00.00.02.22.06.00.10.46.26.26 > 9.583 ms > =================================== > Simulated time: 36864000 cycles > Time for simulation: 5.150 seconds > Total throughput: 7.158058 mhz > =={ Packet monitor results }================== > Node sent (b/p) recv (b/p) corrupted (b) > ------------------------------------------------------------------------------ > 0 369 / 17 0 / 0 0 > ------------------------------------------------------------------------------ > > Now, with the change: > > ------------------------------------------------------------------------------ > Avrora [Beta 1.7.105] - (c) 2003-2007 UCLA Compilers Group > > Loading build/mica2/RadioCountToLeds.elf...[OK: 0.120 seconds] > =={ Simulation events }======================================================= > Node Time Event > ------------------------------------------------------------------------------ > 0 0:00:01.086159 off off on > 0 0:00:01.086159 off on on > 0 0:00:01.086159 on on on > 0 0:00:01.086160 on on off > 0 0:00:01.086160 on off off > 0 0:00:01.086160 off off off > 0 0:00:01.089984 ----> 00 0.416 ms > 0 0:00:01.347030 ----> > 00.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.56.56.24.24 > 9.583 ms > 0 0:00:01.592447 ----> > 24.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.35.35.14.14 > 9.583 ms > 0 0:00:01.837030 ----> > 14.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.14.14.04.04 > 9.583 ms > 0 0:00:02.072030 ----> > 04.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.F3.F3.74.74 > 9.583 ms > 0 0:00:02.309947 ----> > 74.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.D2.D2.64.64 > 9.583 ms > 0 0:00:02.553697 ----> > 64.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.B1.B1.54.54 > 9.583 ms > 0 0:00:02.801613 ----> > 54.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.90.90.44.44 > 9.583 ms > 0 0:00:03.045780 ----> > 44.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.7F.7F.B5.B5 > 9.583 ms > 0 0:00:03.275363 ----> > B5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.5E.5E.A5.A5 > 9.583 ms > 0 0:00:03.520780 ----> > A5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.3D.3D.95.95 > 9.583 ms > 0 0:00:03.766613 ----> > 95.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.1C.1C.85.85 > 9.583 ms > 0 0:00:04.006197 ----> > 85.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.FB.FB.F5.F5 > 9.583 ms > 0 0:00:04.243697 ----> > F5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.DA.DA.E5.E5 > 9.583 ms > 0 0:00:04.480780 ----> > E5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.B9.B9.D5.D5 > 9.583 ms > 0 0:00:04.729113 ----> > D5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.98.98.C5.C5 > 9.583 ms > 0 0:00:04.965363 ----> > C5.AA.AA.AA.AA.AA.AA.AA.AA.CC.CC.FF.FF.00.00.22.22.00.00.46.46.26.26 > 9.583 ms > ============================================================================== > Simulated time: 36864000 cycles > Time for simulation: 5.151 seconds > Total throughput: 7.1566687 mhz > =={ Packet monitor results }================================================== > Node sent (b/p) recv (b/p) corrupted (b) > ------------------------------------------------------------------------------ > 0 369 / 17 0 / 0 0 > ------------------------------------------------------------------------------ > _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help