Hi all, I'm investigating the FTSP to apply into my protocol and experiencing the same problem as Marcin described above. For understanding how to implement FTSP in tinyos, I also read the Tep 133 (http://www.tinyos.net/tinyos-2.x/doc/html/tep133.html) and then I performed some tests to troubleshoot the problem. Below is my understanding of FTSP implementation: - we need to calculate offsetTime = globalTime - localTime, this value should not change much for each packet. So, we need to get globalTime (the time packet is sent) and localTime (the time packet is received) exactly. TinyOS uses TimeSyncAMSend and TimeSyncPacket to send and receive SYNC message. - The transmitter callls TimeSyncAMSend.send to sends SYNC message which includes globalTime (the time when TimeSyncAMSend.send is called). It uses CSMA mechanism to send packet (it needs to wait backoff time before sending), it means that this globalTime is not the real time when the packet is sent over the medium. So it signals SFD interrupt event to get the actual time when the packet starts being transmitted over the communication medium. ( call signal TimeStamp.transmittedSFD( time, m_msg ) in CC2420TransmitP.nc). This value should write back to globalTime and receiver can get the actual time when the packet is transmitted. - At receiver side, it uses TimeSyncPacket to get the actual time when the packet is received (call signal TimeStamp.receivedSFD( time )) -I run some test and realize that the globalTime value in the SYN message received at the receiver side is the same as the globalTime value is set at transmitter when TimeSyncAMSend.send is called. This is so strange. Doing more, I see that the SFD interrupt event modifies localTime value instead of globalTime value in the SYNC msg.
typedef nx_struct TimeSyncMsg { nx_uint16_t rootID; // the node id of the synchronization root nx_uint16_t nodeID; // the node if of the sender nx_uint8_t seqNum; // sequence number for the root /* This field is initially set to the offset between global time and local * time. The TimeStamping component will add the current local time when the * message is actually transmitted. Thus the receiver will receive the * global time of the sender when the message is actually sent. */ nx_uint32_t globalTime; //just for convenience nx_uint32_t localTime; } TimeSyncMsg; -So, I modify the struct of SYNC msg but the receiver still gets the incorrect globalTime value. I investigate more and realize that it is the type variable issue. We use 4 bytes of globalTime, but the time is supported by SFD interrupt event is only 2 Byte (see CaptureSFD.captured( uint16_t time ) in CC2420TransmitP.nc). I think that we got the issue because the receiver got the incorrect globalTime value in SYNC message. Unfortunately, I don't know how to fix it. By the way, do you know the process when it sends SYNC msg? Which function/components are called to send SYNC msg in FTSP application? I need to know it for easy troubleshooting the problem. Thank in advance, Han Bin -- View this message in context: http://old.nabble.com/FTSP-fails-apps-tests-TestFtsp-Ftsp-%28both-2.1.2-and-2.x%29-tp34470187p34472562.html Sent from the TinyOS - Help mailing list archive at Nabble.com. _______________________________________________ Tinyos-help mailing list Tinyos-help@millennium.berkeley.edu https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help