"Randomness" of time taken to broadcast is a feature rather than a bug.
Most of the indeterminate delay is due to MAC backoff and free channel
testing. If someone else is transmitting you have to wait until they're
done. Search this list for a lot of discussion on radio timing.

A workaround would be to use some kind of time sync and stamping
in your messages.

MS

Abhishek Anand wrote:
> Hi,
>  
> I'm facing a similar problem!
> My protocol requires a strict time control on when the the packets are 
> actually transmitted from the base station.
> I have programmed by base-station-mote with the BaseStation app in 
> /$TOSROOT/apps/ folder.
> On the PC, my java program uses a the MoteIF class to send the packets
> But unfortunately, it takes randomly a value b/w 8 to 25ms for the 
> packets to be ultimately broadcasted thru radio.
> I mean the call to
>      MoteIF.send(MoteIF.TOS_BCAST_ADDR, smsg);
> in java takes anything b/w 8-25ms to return.
>  
> This is causing a lot of problem for me because my application requires 
> fine timing control
> I'm okay with a delay of 20ms but is there any way to remove the 
> randomness of the time taken?
> In other words, is it possible to do something so that there is a FIXED 
> gap of few ms b/w call to MoteIF.send
> and the the commencement of the radio transmission of the packet at the 
> Base-station mote?
>  
> Regards,
> Abhishek Anand
> IIT Guwahati
> 
> On Mon, Jun 16, 2008 at 9:00 PM, Andrey Gursky <[EMAIL PROTECTED] 
> <mailto:[EMAIL PROTECTED]>> wrote:
> 
>     Hi!
> 
>     Thanks Janos for your advices!
> 
>     I've changed the serial speed to 230400 (because of serial speed
>     declarations in GNU/Linux). It works :)
>     After simple test with printf() there is about 1 Kbyte/s :(
>     Than I've changed printf() test application. I supply printf() a
>     string with about 250 characters, then flush(). I could read about
>     8.5 Kbyte/s. It's really more than standard for IRIS 57600 Kbit/s,
>     but it is still less than standard for other platforms. I've used
>     PrintfClient to get the data.
> 
>     What do you think, is there a bottleneck easy to reprogram? I
>     haven't tested yet how much traffic I can transmit throw ZigBee. If
>     this will not more than 8.5 Kbyte/s then there is no sense to work
>     around serial communication.
> 
>     Best regards,
>     Andrey
> 
> 
>      > Andrey:
>      >
>      > I think the code change you're proposing should work.
>      >
>      > >So atm128 doesn't have speed enough to guarantee 256 KBit/s
>      > >data connection pc<->mote? If one want this, one should
>      > >implement a different platform with another microcontroller?
>      >
>      > There's a good chance that it works. Just give it a try. BTW, I
>     bet you'll never
>      >  be getting 250kbps worth of zigbee payload in through the radio...
>      >
>      > >By the way, MIB520 has also a microcontroller on board.
>      > >Is USART of Mote directly connected to FTDI chip or
>      > >throw this microcontroller?
>      >
>      > It's hooked up directly to the FTDI chip.
>      >
>      > >It seems to be not so easy even at the standard serial speed :(
>      > Obviously, 57600bps might not be sufficient to push through all
>     the incoming
>      >  radio traffic...
>      >
>      > Janos
>      >
>      > -----Original Message-----
>      > From: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     [mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>]
>      >  On Behalf Of Andrey Gursky
>      > Sent: Thursday, June 12, 2008 6:00 AM
>      > To: [email protected]
>     <mailto:[email protected]>
>      > Subject: Re: [Tinyos-help] Mote-PC serial speed increasing
>      >
>      > Thanks Janos!
>      >
>      > > On the iris, the ubrr0 register is set, at initialization time,
>     to a calibrated
>      > >  value for 57600bps. You can change the baud rate by writing
>     this register.
>      > >
>      >
>      > I've found in $TOSROOT/tos/chips/atm128 this code:
>      >
>      >   command error_t Init.init() {
>      >     if (PLATFORM_BAUDRATE == 19200UL)
>      >       m_byte_time = 200; // 1 TMicor ~= 2.12 us, one byte = 417us
>     ~= 200
>      >     else if (PLATFORM_BAUDRATE == 57600UL)
>      >       m_byte_time = 68;  // 1 TMicor ~= 2.12 us, one byte = 138us
>     ~= 65
>      >     return SUCCESS;
>      >   }
>      >
>      > I could add the line like this (or I should seek on to find ubrr0?)
>      > ..
>      >     else if (PLATFORM_BAUDRATE == 256000UL)
>      >       m_byte_time = ----->15<-----;  // 1 TMicor ~= 2.12 us, one byte
>      >  = ----->31us<----- ~= ----->15<-----
>      > ..
>      >
>      > >
>      > > This should work with a MIB520, but it is problematic with a
>     MIB510. Should
>      > >  you have the former programming board, the bottleneck will
>     probably be the
>      > >  interrupt load on the mote in the pc->mote direction. Note
>     that the serial
>      > >  stack doesn't buffer outgoing packets (mote->pc), so the app
>     must assume
>      > >  a lossy mote->pc link.
>      > >
>      >
>      > I have MIB520 (with usb) :)
>      > So atm128 doesn't have speed enough to guarantee 256 KBit/s data
>     connection
>      >  pc<->mote? If one want this, one should implement a different
>     platform
>      >  with another microcontroller?
>      >
>      > By the way, MIB520 has also a microcontroller on board. Is USART
>     of Mote directly
>      >  connected to FTDI chip or throw this microcontroller?
>      >
>      > There is one post seems to achieve similar goal: the highest speed :)
>      >
>     
> https://www.millennium.berkeley.edu/pipermail/tinyos-help/2008-June/034218.html
>      >
>      > It seems to be not so easy even at the standard serial speed :(
>      >
>      > Could someone point me to reference where I can read about what
>     the atm128x
>      >  has yet free to use as quick and reliable communication with PC
>     (SPI, I2C)?
>      >  Or the best idea were to use other small design to exchange
>     messages between
>      >  PC and ZigBee motes?
>      >
>      >
>      >
>      > >
>      > > -----Original Message-----
>      > > From: [EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>
>     [mailto:[EMAIL PROTECTED]
>     <mailto:[EMAIL PROTECTED]>]
>      > >  On Behalf Of Andrey Gursky
>      > > Sent: Tuesday, June 03, 2008 6:16 AM
>      > > To: [email protected]
>     <mailto:[email protected]>
>      > > Subject: [Tinyos-help] Mote-PC serial speed increasing
>      > >
>      > > Hi tinyOS-community!
>      > >
>      > > It seems possible (according datasheet) to use USART of
>     ATmega128x in >57600
>      > >  speed mode. Thus ZigBee functions of 250 Kbit/s it would be
>     nice to have this
>      > >  speed also between basestation and PC.
>      > > Does somebody know exactly, whether it would be as of some
>     other reasons not
>      > >  possible? Or have I to alter configuration in .../chip/atm1281
>     to get this
> 
>      > >  working?
>      > >
>      > >
>      > > Best regards,
>      > > Andrey
>      > >
>      > > P.S. Particularly I'm interesting in iris-motes.
>      > > _______________________________________________
>      > > Tinyos-help mailing list
>      > > [email protected]
>     <mailto:[email protected]>
>      > >
>     https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>      > >
>      > _______________________________________________
>      > Tinyos-help mailing list
>      > [email protected]
>     <mailto:[email protected]>
>      >
>     https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>      >
>     _______________________________________________
>     Tinyos-help mailing list
>     [email protected]
>     <mailto:[email protected]>
>     https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to