Thanks so much. Is it valid to assume the transmission of the SFD byte at the sender and the reception of it at the receiver happen at the same time (or within very small time window like less than 1 ms) if sender and receiver are close so that propagation delay is negligible? I'm working on some real-time protocols, so timing is really critical.
BTW, I'm using FTSP to sync all the nodes. After I add FTSP, my packets somehow get corrupted, including routing beacon and actual data packets. I checked FTSP (not thoroughly) and find FTSP is using TimeSyncMessageC as ActiveMessageC, not the default ActiveMessageC. However, my protocol uses the default ActiveMessageC for communication (AMSenderC and AMReceiverC which in turn uses ActiveMessageC, to be exact). So packets from FTSP and my protocol can overwrite each other in the shared lower-layer CC2420ActiveMessageC. Is this the cause? Has someone met the same problem using FTSP? I'm using different AM types with FTSP and TelosB motes. On Tue, Feb 1, 2011 at 6:10 PM, Janos Sallai <[email protected]>wrote: > You can do that using the LocalTime and the PacketTimestamp > interfaces. In the sendDone event, you can figure out the time delay > between transmitting the SFD byte and invoking the sendDone event as > follows: > > event void AMSend.sendDone(message_t* bufPtr, error_t error) { > uint32_t txSfdTime; > uint32_t sendDoneEventTime; > > sendDoneEventTime = call LocalTime.get(); > > if(call PacketTimeStamp.isValid(bufPtr)) { > txSfdTime = call PacketTimeStamp.timestamp(bufPtr); > dt = sendDoneEventTime - txSfdTime; > > // use dt here however you wish (printf, diagmsg, etc.) > > } > } > > > Similarly, on the receiver side, you can figure out the time delay > between receiving the SFD byte and the invocation of the receive > event. > > event message_t* Receive.receive(message_t* bufPtr, > void* payload, uint8_t len) { > uint32_t rxSfdTime; > uint32_t receiveEventTime; > > receiveEventTime = call LocalTime.get(); > > if(call PacketTimeStamp.isValid(bufPtr)) { > rxSfdTime = call PacketTimeStamp.timestamp(bufPtr); > dt = receiveEventTime - rxSfdTime; > > // use dt here however you wish (printf, diagmsg, etc.) > > } > > return bufPtr; > } > > The sum of the two delays (the one on the transmitter's side and the > one on the receiver) will give you the time between the sendDone and > the receive events. > > Janos > > On Tue, Feb 1, 2011 at 4:24 PM, ranal fernando <[email protected]> > wrote: > > my belief is that it is hard to sync time between mote to capture a very > > little time between the Send.sendDone() and Receive.receive(). > > > > you can get the Send.sendDone() separately (without trying to send it > using > > the same packet) & calculate (get the Receive.receive() time > separately). > > > > i'm really not sure whether this will give the exact answer. (because at > the > > destination, packet processing also will take some time before > > signalingReceive.receive() ) > > > > > > ranal fernando > > > > ________________________________ > > Date: Sat, 29 Jan 2011 22:28:26 -0500 > > From: [email protected] > > To: [email protected] > > Subject: [Tinyos-help] how to measure interval btw Send.sendDone() and > > Receive.receive()? > > > > Hi everyone, > > Assuming sender and receiver are synchronous, I want to measure the time > > interval between two events: namely, Send.sendDone() event of a packet at > > the sender and Receive.receive() event of the packet at the receiver. > > Initially I decided to put timestamp of Send.sendDone() event in the > packet > > and timestamp Receive.receive() event at the receiver, the interval could > be > > obtained by the difference of the two timestamps. However, packet payload > is > > loaded prior to calling Send.send() thus before Send.sendDone(), it is > > impossible to timestamp Send.sendDone() event and place the timestamp in > the > > packet. Can anyone give me some suggestion on how this may be achieved? > > Thanks very much. > > > > -- > > -Xiaohui Liu > > > > _______________________________________________ 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 > > > -- -Xiaohui Liu
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
