> Hi,
>
> I have some questions regarding the calculation of the time offset in FTSP:
>
> "async event void PacketLastTouch.touch(message_t* msg)
> { [...]
> footer->time_offset = local->event_time - call
> PacketTimeStamp.get(msg);
> [...] }"
> local->event_time is the time of giving the Send-command in FTSP.
> PacketTimeStamp is the time at the end of the MAC-SYNC at sender. Am I
> right? Then, the calculation results in a negative value for an unsigned
> integer. And that wouldn't make sense to me.
>
> "command uint32_t TimeSyncEvent32khz.getTime(message_t* msg)
> { [...]
> return (uint32_t)(footer->time_offset) + call PacketTimeStamp.get(msg);
> }"
> footer->time_offset is the time calculated at sender (see question
> above). PacketTimeStamp is the time at the end of the MAC-SYNC at
> receiver. Why should I add these times?
synchronization event: arbitrary time which happened shortly before
timesync msg was transmitted (outgoingMsg->globalTime in task sendMsg()
in TimeSyncM.nc)
T1 = global time of synchronization event at sender
T1^ = local time of synchronization event at sender
T1' = local time of synchronization event at receiver
receiver can synchronize to the global time by precisely measuring
offset of its local clock and the global time (T1'-T1)
TimeSyncSend32khz interface allows you to 1) transmit data with a
timestamp which is assumed to be in the local time of the sender and 2)
converts this timestamp to the local time of the receiver. the code that
you mentioned does this conversion. in other words, it converts T1^ to
T1'. this is accomplished by timestamping transmission/reception of the
SFD byte in the MAC. PacketLastTouch interface is the transmitter story:
it has access to the SFD_tx timestamp; instead of transmitting T1^ and
T_SFD_tx separately, it transmits their offset T_offset=T1^-T_SFD_tx
(saving 4 bytes). TimeSyncEvent32khz is the receiver story: calculating
T1' as T_offset + T_SFD_rx.
T_offset = footer->time_offset
T_SFD_tx = PacketTimeStamp.get(msg) (at TX, called from PacketLastTouch)
T_SFD_rx = PacketTimeStamp.get(msg) (at RX, called from TimeSyncEvent)
brano
>
> Thank you!
>
> Regards, Marco
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help