Real Time looses when acquiring
mantegazza at aero.polimi.it
Tue Nov 27 11:47:50 CET 2007
Jordi Blanch Carles wrote:
> Hello everyone.
> We have developed an application that runs a 10KHz task in RTAI. In
> this task we acquire the cpu time with rt_get_time_ns(), and after that
> we acquire 2 analog inputs from a NI 6220 and one counter from a NI
> 6201. Sometimes, during analog and counter acquisition the RTAI task
> looses the real time and next cycle occurs 3 times later that it should
> have happened, that is, if time difference between two samples should be
> 0,1 ms, when rtai looses real time this difference is 0,3 ms. This leads
> to erroneous calculus because we use the counter input with the time
> acquisition to measure speed. Each time the task acquires the counter
> value, the increments between two acquisitions is almost the same, but
> sometimes this increment is three times the mean value, when this occurs
> the next cycle runs three times later than it should have run, so there
> has been a problem during acquisition at the last cycle, this
> acquisition has made the system "freeze" during a long time.
> comedi_acquire(counter); <--- Sometimes this value increment is three
> times the last one, then at the next cycle, the difference between time
> results also three times the last one.
What is comedi_acquire? I do not see it within the list of those
supported in rtai_comedi.h.
> Time (ms) Counter
> 0,0 0
> 0,1 10
> 0,2 20
> 0,3 50 <---- Counter value has an increment three times
> greater than the last one (but the speed of the object doesn't really
> have this increment)
> 0,6 60 <---- Time value has an increment three times
> greater than the last one (the cycle period), there has been some
> problem with real time.
> 0,7 70
> We have created the real time task as a LXRT hard real time task in
> one shot timer mode.
> So the question is, could comedi instructions make RTAI real time
> tasks loose real time? How can we prevent this behaviour? Has anyone
> seen something like this and has solved the problem?
> Thanks in advance.
> Jordi Blanch Carles
> Unidad de Ensayo y Control
> ENCOPIM S.L.
> C/. del Parc, 5 (nave 13)
> P.I. Els Pinetons
> E-08291 RIPOLLET (Barcelona)
> Tel: (+34) 935 94 23 47
> Fax: (+34) 935 94 64 15
> La información contenida en la presente transmisión es confidencial y su
> uso únicamente está permitido a su(s) destinatario(s). Si Ud. no es la
> persona destinataria de la presente transmisión, rogamos nos lo
> comunique de manera inmediata por teléfono (+34 935 942 347) y destruya
> cualquier copia de la misma (tanto digitales como en papel).
> The information contained in this transmission is confidential and is
> intended only for the use of the addressee(s). If you are not the
> designated recipient of this transmission, please advise us immediately
> by telephone (+34 935 942 347) and destroy any copies (digital and
More information about the Rtai