For your particular benchmarks, use setPeriodic. Timers fire through a task, which must wait to be executed in the task queue. With setOneShot, you are accumulating error. setPeriodic sets the alarms at periodic times from the previous alarm, giving only jitter with no accumulation.
But for fast sampling, you should use hardware timers, which will fire through hardware interrupts and not tasks. Make sure you're not using an already allocated timer. Search the archives, I've posted it before. Or, use Moteiv Boomerang, where you can allocate a unique, individual timer with the instantiation of a generic component. Cory On 5/17/06, jagan nath <[EMAIL PROTECTED]> wrote:
I have removed the counter from ADC.dataready and put it in the TimerJiffy.fired(). Although the performance is not good but it has certainly improved. This is what I got with TimerJiffy.setoneshot(1) - 2590 samples/sec ( cant actually call them samples, it is actually these many times the timer has fired) with TimerJiffy.setOneshot(10) - 1920 samples/sec with TimerJiffy.setOneshot(20) - 1255 samp/sec with TimerJiffy.setOneshot(40) - 705 samp/sec (closest to accurate, 40 corresponds to 800 samples/sec) This shows that the ADC conversion is also adding to the delay of the timer being fired. All though i'm using ADC.setsamplingrate(). It doesnt look like the sampling time has actually reduced. -jagan PS.I dont know how accurate is TimerJiffyAsync( this is used in CC2420 for initial/congestion backoff). i even tried to use this. I connected this to a copy of TimerJiffyAsyncC(timer changed to B2/B0) but this is not working the timer doesnt fire.Maybe i have done something wrong.Not Sure......... On 5/18/06, jagan nath <[EMAIL PROTECTED]> wrote: > ok.. > Now I have tried with TimerMilli with a setOneshot(1) and I was > getting a max of 660 samples/sec.Maybe I think I will increment the > Samplecounter in the fired() event itself (as against incrementing it > in the ADC.dataready(). just to see if ADC conversion is the > bottleneck. > > jagan > > On 5/18/06, Michael Schippling <[EMAIL PROTECTED]> wrote: > > Well, you should definitely call it AFTER all the component and > > module inits and starts, otherwise the default will get reset. > > And, as I said, I don't have any concrete knowledge that it actually > > works the way it should. Maybe I should try it myself... > > > > MS > > > > jagan nath wrote: > > > ---------- Forwarded message ---------- > > > From: jagan nath <[EMAIL PROTECTED]> > > > Date: May 18, 2006 9:30 AM > > > Subject: Re: [Tinyos-help] Maximum samplingrate with TimerJiffy.nc > > > To: Michael Schippling <[EMAIL PROTECTED]> > > > > > > > > > I didnt miss that, i have set the ADCControl.setSamplingRate(7500ns), > > > only thing i m not sure is whether this command shud be called in > > > stdcontrl.init/start, > > > i have called it in stdcontrol.start(maybe i shud try it in init also) > > > > > > jagan > > > > > > > > > > > > > > > On 5/18/06, Michael Schippling <[EMAIL PROTECTED]> wrote: > > >> Everyone seems to be going on about this recently and I forget > > >> to whom I have already responded with dubious advice... > > >> > > >> You need to set the ADC pre-scaler to something other than the > > >> maximum, which is the default. ADCControl.setSamplingRate() is > > >> supposed to do this, see tos/interfaces/ADCControl.nc for details. > > >> However I've only heard of negative results so far. > > >> > > >> Have any of you lurkers actually used setSamplingRate() successfully? > > >> > > >> MS > > >> > > >> > > >> > > >> jagan nath wrote: > > >> > Hello all, > > >> > I'm using TimerJiffy.nc to sample the ADC0 pin for my application.I > > >> > actually wanted to sample at 3Khz but the highest sampling rate i > > >> > could achieve is not more than 1200 samples/sec. > > >> > > > >> > I'm calling TimerJiffy.setPeriodic(11); here 11 corresponds to > > >> > 3Ksamples/sec(apprx). > > >> > whenever the timer fires I'm call ADC.getdata() and in the event > > >> > ADC.dataready() I'm incrementing a counter > > >> > Now I'm using a normal timer which is set to fire at intervals of > > >> > 10/20 secs and when this timer fires Im sending this counter value > > >> > over the radio and receiving it with TOSBase. > > >> > > > >> > I then further reduced the value of Timerjiffy.setperiodic(5) .with > > >> > this also i'm getting a max of 1200 samples/sec. > > >> > > > >> > Am I checking it correctly or is there any other method to achieve the > > >> > 3Khz sampling rate. > > >> > > > >> > TIA > > >> > Jagan > > >> > > > >> > _______________________________________________ > > >> > Tinyos-help mailing list > > >> > Tinyos-help@Millennium.Berkeley.EDU > > >> > > > >> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > >> > > > > > > _______________________________________________ > > > Tinyos-help mailing list > > > Tinyos-help@Millennium.Berkeley.EDU > > > https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help > > > _______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
_______________________________________________ Tinyos-help mailing list Tinyos-help@Millennium.Berkeley.EDU https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help