Please send your post to the list and try search the archives at http://www.tinyos.net/scoop/special/support#mailing-lists.
There are a lot of useful hints out there. If you have got some errors about the missing interfaces, use them and don't forget to do the wiring. According to the code, there are some errors that I can't explain to you via email. You should have a look at the timer. For example, what is the precision you expect? Ittipong 2009/4/23 sara so <[email protected]> > Hi, > Thanks for your help but I have tried to follow your small code ... it > is always complaining about no such interface CC2420TransmitC?? > uses interface RadioTimeStamping; also this interface is not avialable?? > This is my code in case you want to take a look? > > #include <Timer.h> > #include "CC2420.h" > #include "BlinkToRadio.h" > > module BlinkToRadioC{ > uses interface Boot; > uses interface Leds; > uses interface Timer<TMilli> as Timer0; > > uses interface Packet; > uses interface AMPacket; > uses interface AMSend; > uses interface Receive; > uses interface SplitControl as AMControl; > uses interface RadioTimeStamping; > implementation { > message_t pkt; > bool busy = FALSE; > uint32_t timertime; > uint32_t mytimebuf; > uint32_t transmittime; > uint8_t mytime[4]; > event void Boot.booted() { > call AMControl.start(); > } > > event void AMControl.startDone(error_t err) { > if (err == SUCCESS) { > call Timer0.startPeriodic(TIMER_PERIOD_MILLI); > } > else { > call AMControl.start(); > } > } > > event void AMControl.stopDone(error_t err) { > } > > event void Timer0.fired() { > > if (!busy) { > BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call > Packet.getPayload(&pkt, NULL)); > > if (call AMSend.send(2, &pkt, sizeof(BlinkToRadioMsg)) == SUCCESS) { > busy = TRUE; > } > } > } > > event void AMSend.sendDone(message_t* msg, error_t err) { > if (&pkt == msg) { > busy = FALSE; > } > } > > async event void RadioTimeStamping.transmittedSFD(uint16_t time, > message_t* p_msg){ > > //get the current time and replace the lower half-word with > SFD-captured timer content: > timertime= call Timer0.getNow(); //timeget(); is that ok ? > > mytimebuf=(((((timertime&0x0000FFFFUL)>((uint32_t)time&0x0000FFFFUL))?timertime:(timertime-0x00010000UL))&0xFFFF0000UL)|((uint32_t)time&0x0000FFFFUL)); > transmittime=mytimebuf; > //load the 32-bit timestamp to a uint8_t 4-elements' array: > for(v=0;v<4;v++){ > mytime[v]=(uint8_t)((mytimebuf>>((3-v)*8))&0x000000FFUL); > } > //write the timestamp to the CC2420 RAM: > call CC2420Transmit.modify( > offsetof(pkt,timeStamp)+sizeof(message_header_t), mytime, 4); > } > > async event void RadioTimeStamping.receivedSFD(uint16_t time, message_t* > p_msg){ > > } > } > > > > On Thu, Apr 23, 2009 at 10:47 AM, Ittipong Khemapech > <[email protected]> wrote: > > The ProtocolMsg is an example of user-defined message structure. You may > > declare your own message structure to store information and send it over > the > > network. > > > > I think you can't access the metadata directly. Please read message_t > TEP. > > > > Finally, I'm using TinyOS 2.0. I have no idea how it's different from the > > 2.1. > > > > Ittipong > > > > > > 2009/4/23 sara so <[email protected]> > >> > >> Hi, > >> Thanks for your help, but what is the ProtocolMsg? I need to include > >> the time befor the packet sent, can I just call the cc2420 metadata? > >> does tinyos 2.1 support that? > >> for example: > >> event message_t* Receive.receive( ){ > >> getting the payload and then read and attche the time in the packet > >> filed > >> mypkt->timeNow= ((cc2420_metadata_t*)msg->metadata)->time; > >> Thank you > >> On Wed, Apr 22, 2009 at 7:48 AM, Ittipong Khemapech > >> <[email protected]> wrote: > >> > > >> > > >> > ---------- Forwarded message ---------- > >> > From: Ittipong Khemapech <[email protected]> > >> > Date: 2009/2/24 > >> > Subject: Re: [Tinyos-help] Timestamp > >> > To: Anton <[email protected]> > >> > Cc: tinyos-help <[email protected]> > >> > > >> > > >> > Hi, > >> > > >> > It works now. Many thanks :-) > >> > > >> > Ittipong > >> > > >> > 2009/2/24 Anton <[email protected]> > >> >> > >> >> Hi, > >> >> > >> >> I do timestamps in this way: > >> >> > >> >> > >> >> async event void RadioTimeStamping.transmittedSFD(uint16_t time, > >> >> message_t* p_msg){ > >> >> > >> >> //get the current time and replace the lower half-word with > >> >> SFD-captured timer content: > >> >> timertime=timeget(); > >> >> > >> >> > >> >> > > mytimebuf=(((((timertime&0x0000FFFFUL)>((uint32_t)time&0x0000FFFFUL))?timertime:(timertime-0x00010000UL))&0xFFFF0000UL)|((uint32_t)time&0x0000FFFFUL)); > >> >> transmittime=mytimebuf; > >> >> //load the 32-bit timestamp to a uint8_t 4-elements' > array: > >> >> for(v=0;v<4;v++){ > >> >> mytime[v]=(uint8_t)((mytimebuf>>((3-v)*8))&0x000000FFUL); > >> >> } > >> >> //write the timestamp to the CC2420 RAM: > >> >> call CC2420Transmit.modify( > >> >> offsetof(ProtocolMsg,timeStamp)+sizeof(message_header_t), mytime, 4); > >> >> } > >> >> > >> >> > >> >> > >> >> This works. To use "message_header_t" it is necessary to include > >> >> "CC2420.h" in the program. "timeStamp" is a 4-byte field of my > packet, > >> >> which > >> >> I put the timestamp in. > >> >> > >> >> Anton. > >> >> > >> > > >> > > >> > > > > > >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
