Hi,

Sorry  for the inconvenience due to a lengthy mail. Requesting you to
kindly spend 2 minutes on this.
I am facing some issues regarding timestamping in tinyOS 2.1.2 using telosb
motes.

I have a transmitter mote(TOS_NODE_ID = 0x08), a receiver mote (TOS_NODE_ID
= 0x09)

The transmitter mote is programmed to send periodic messages to the
receiver mote, whenever a timer fires (BcastTimer.startPeriodic(2048) which
is wired to TimerMilliC()).

The receiver mote puts the timestamp (t1) when it receives any message in
the receive event in the variable “tspr->ReceiveTime” and sends back to
the respective sender of the message. While sending, it also puts the
transmission timestamp (t2) in the Senddone event in the variable
“tspr->SendTime” ( as given in the below pseudo code).

----------------------------------------------------------------------------
typedef nx_struct TimeStampPollReport
{
              nx_uint32_t ReceiveTime;
              nx_uint32_t SendTime;
}TimeStampPollReport;
---------------------------------------------------------------------------------------------
module TestPacketTimeStampP
{
           -----------------------
            interface AMSend as ReportSend;
            interface Receive as PollReceive;
            interface PacketTimeStamp<T32khz, uint32_t>;
}
implementation
{

/* -----receives the message and puts the received time stamp (t1) and
sends back to the same address. The packet is also time stamped while
sending(t2). If the time stamp is invalid the times stamp will be
zero....... */

event message_t* PollReceive.receive(message_t* p, void* payload, uint8_t
len)
{
      atomic
      {
         TimeStampPoll *tsp = (TimeStampPoll *)payload;
         TimeStampPollReport *tspr = call
ReportSend.getPayload(&msgReport,sizeof(TimeStampPollReport));
         addr = call RadioAMPacket.source(p);
         if (tsp->previousSendTime!=0 && call PacketTimeStamp.isValid(p))
               tspr->ReceiveTime = call PacketTimeStamp.timestamp(p);
         else
               tspr->ReceiveTime = 0;
         call ReportSend.send(addr, &msgReport,sizeof(TimeStampPollReport));
         return p;
      }
}
/* -----This portion puts the timestamp while sending(t2). If the time
stamp is invalid the times stamp will be zero....... */

event void ReportSend.sendDone(message_t* p, error_t success)
{
      atomic
      {
           TimeStampPollReport *tspr = call
ReportSend.getPayload(&msgReport,sizeof(TimeStampPollReport));
           if (call PacketTimeStamp.isValid(p))
               tspr->SendTime = call PacketTimeStamp.timestamp(p);
           else
               tspr->SendTime = 0;
       }
}
/*--------------------------------------------------------------------------------------------------------------------------*/
I expect t1<t2 (assuming no overflow). But the result shows the reverse
(packets received by the basestation mote using “Listen tool” shown below.)

00 00 08 00 09 08 22 BA (00 02 23 9F) (00 01 25 65)

00 00 08 00 09 08 22 BA (00 03 23 D9) (00 02 25 6A)

-----format of AM packet ---(t1)----(t2)

wiring: PacketTimeStamp -> ActiveMessageC


The difference between t1 in two consecutive packets = (00 03 23 D9) - (00
02 23 9F) = 65594 (in decimal), almost close to the expected value (65536)

Please help me to find out the reason behind why t1>t2 in the above packets?

Thanks for your valuable time

Regards
Jobish John
Research Scholar
Department of Electrical Engineering
IIT Bombay.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to