//Added to last post
CC2420TransmitP.nc has the following code:
/**
* The CaptureSFD event is actually an interrupt from the capture pin
* which is connected to timing circuitry and timer modules. This
* type of interrupt allows us to see what time (being some relative
value)
* the event occurred, and lets us accurately timestamp our packets. This
* allows higher levels in our system to synchronize with other nodes.
*
* Because the SFD events can occur so quickly, and the interrupts go
* in both directions, we set up the interrupt but check the SFD pin to
* determine if that interrupt condition has already been met - meaning,
* we should fall through and continue executing code where that interrupt
* would have picked up and executed had our microcontroller been fast
enough.
*/
async event void CaptureSFD.captured( uint16_t time ) {
uint32_t time32 = time16to32(time, call BackoffTimer.getNow());
atomic {
switch( m_state ) {
case S_SFD:
m_state = S_EFD;
sfdHigh = TRUE;
call CaptureSFD.captureFallingEdge();
call PacketTimeStamp.set(m_msg, time32);
if (call PacketTimeSyncOffset.isSet(m_msg)) {
nx_uint8_t *taddr = m_msg->data + (call
PacketTimeSyncOffset.get(m_msg) - sizeof(cc2420_header_t));
timesync_radio_t *timesync = (timesync_radio_t*)taddr;
// set timesync event time as the offset between the event time
and the SFD interrupt time (TEP 133)
*timesync -= time32;
call CSN.clr();
call TXFIFO_RAM.write( call PacketTimeSyncOffset.get(m_msg),
(uint8_t*)timesync, sizeof(timesync_radio_t) );
call CSN.set();
}
Is the code saying that when the CaptureSFD event is signaled, this line of
code "call PacketTimeStamp.set(m_msg, time32);" sets the actual send time
into the packet? So is it possible that I replace the parameter time32 with
the time returned by the interface Counter<TMicro, uint16_t>.get() I'm
using, thus get microsecond timestamp?
Thank you,
Sean
On Thu, May 26, 2011 at 4:47 PM, Xiaowei <[email protected]> wrote:
> Hi all,
>
> In tinyos 2.1.0, is there any way to know when packets are actually
> transmitted into the air at the sender side, and when they are received at
> the receiver side? There are T32khz radio timestamp, but I need microsecond
> timestamp. I'm using interface Counter<TMicro, uint16_t> to get microsecond
> time, but I don't know when to use it.
>
> I looked into components like HplCC2420InterruptsC, GpioInterrupt,
> CC2420TransmitP, CC2420ReceiveP to find a way to get the transmission and
> reception time of SFD, didn't get it. Anyone has any clue on this, please?
>
> Thank you,
> Sean
>
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help