Hi,

I've some problems using RadioTimeStamping.transmittedSFD() to timestamp
when the SFD is captured.

My message structure declaration is as follows:

typedef nx_struct MyMsg {
  nx_uint8_t base_id;
  nx_uint8_t src_id;
  nx_uint16_t cycle_no;
  nx_uint32_t b_send;
  nx_uint32_t s_recv;
  nx_uint32_t s_send;
  nx_uint32_t b_recv;
  nx_uint32_t rtt;
} MyMsg;

I need the time when the source sends to be stored in b_send. As
RadioTimeStamping.transmittedSFD() gives 16-bit time, I convert the 16-bit
time to 32-bit value as provided in CC2420TransmitP.nc. The current time is
obtained by calling Alarm.getNow().

Accoring to the CC2420Transmit.nc, I need to only call
CC2420Transmit.modify() to put the time into the message.

I have:

   async event void RadioTimeStamping.transmittedSFD(uint16_t time,
message_t* p_msg) {
       atomic {
           MyMsg* myMsg = (MyMsg*)(call Packet.getPayload(&mpkt, NULL));
           if (&mpkt == p_msg) {
               snd_time_32 = time16to32(time, call DataSendAlarm.getNow());
               call CC2420Transmit.modify(sizeof(myMsg) - 12, (uint8_t*)
&snd_time_32, 4);
           }
       }
   }

I also need the s_send to be displyed on screen. The BaseStation is modified
for this.

The problem is I always get zero (0) for the s_send.

I've try adding:

myMsg->s_send = snd_time_32;

It doesn't work as the first value is always zero (0). For example:

BaseID    SourceID     CycleNo    BSend   SRecv   SSend   BRecv   RTT
         0               1                1        xxx       xxx
0       xxx    xxx
         0               1                2        xxx       xxx
xxx       xxx    xxx

I've been working on this for days. Please give me some hints.

Thanks,
Ittipong
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to