Re: Very fast DIO synchronously

Calin,

I would also like to do this - I have another card supported by comedi which 
is similarly restricted in its speed.  The message from the list was "this is 
how long it takes".

Outside of comedi I wrote a driver for a different DIO card ages ago and I was 
recently converting the driver to kernel 2.6. 

Originally my driver used read / write methods but during the update and 
solely motivated by laziness I elected to use ioctl()s instead.  At this 
point the speed dropped by at least ten fold.  I have subsequently 
reimplemented the read / write methods and restored the speed.  

With this driver the ioctl() method achieves around 150k read/writes /second 
with the read / write methods I got around 3M read/s and 6M writes/s (memory 
caching influences the userland<->kernel space transfers and favours writes).  
Even doing very small read / writes (single word) the speed was increase ten 
fold.

This really surprised me.

Furthermore I can achieve hardware limited rates (9Mr/w) if I give up the 
userland->kernel transfers and just have the driver hassle the card (ie if I 
just want to generate a complex clock signal and program the kernel driver to 
do this - obviously if the process is interupted you get a timing delay / 
glitch but this doesn't matter to me). 

I do not know if this is directly related to the comedi performance but I 
think this means that it is definitely possible to go much faster if you use 
read/write instead of ioctl and faster still if you do the work in kernel 
space.

SA 



On Wednesday 31 Aug 2005 23:59, Calin A. Culianu wrote:
> I'm trying to see if it's possible to do very fast digital I/O from a
> real-time loop synchronously (I might want to do control from within the
> loop, which is why synch. I/O is the way to go for me).
>
> On my current hardware it seems a read/write to all 24 channels of my NI
> DaqCard DIO 24 takes 10 microseconds or so.  That would mean I can't very
> well achieve rates above 100KHz.
>
> Any ideas if the 10us time for the comedi_insn is a limit of the PCI bus
> somehow or more likely a limit of the speed of the I/O card?
>
> BTW: A look at the 8255 driver seems to indicate writing to all 24
> channels takes 6 outb instructions which presumably become 6 separate PCI
> Write operations -- each of which takes 4 PCI cycles minimum so that would
> mean 24 PCI cycles per DIO read/write... that should mean I could easily
> get over 1MHz transfer rates... but instead 1KHz is my limit...
>
> Any thoughts would be appreciated..
>
> -Calin
>
>
>
>
> _______________________________________________
> comedi mailing list
> comedi_at_comedi.org
> https://cvs.comedi.org/cgi-bin/mailman/listinfo/comedi

Received on 2005-09-01Z07:29:23