- From: Jim Benson <jbenson_at_sextans.lowell.edu>
- Date: Mon, 13 Feb 2006 15:03:10 -0700 (MST)
On Mon, 13 Feb 2006, Daniel Nilsson wrote: > Hi Jim, > > On Mon, Feb 13, 2006 at 01:28:07PM -0700, Jim Benson wrote: > > On Mon, 13 Feb 2006, Daniel Nilsson wrote: > > > > > Based on the source for the kernel driver I come to the conclusion > > > that this is the FIFO buffer on the HW that is getting full. Since the > > > buffer is 512 bytes and I sample at 10kHz I calculated that the buffer > > > needs approximately 25.6ms to fill up (assuming 2 bytes per sample). I > > > seems like a long time to me taking into account that the HW will > > > interrupt the kernel to empty the buffer, which should take that long? > > > > With these cards, I think when one says sampling at 10kHz, > > it means you are doing a scan of all channels you are sampling > > at 10 kHz. So if you are sampling 4 channels _at_ 10 kHz I think you get: > > > > 10000 scans/sec * 4 channels/scan * 2 bytes/channel = 80000 bytes/sec > > So if your fifo is 512 bytes then: > > 80000 bytes/sec * 1 fifo/512 bytes = 156.25 fifo/sec > > or 1 sec/156.25 fifo = 0.00639 sec/fifo > > So there is only 6.3 ms to dump the fifo. > > Well, I was wondering about this as well... From looking at the > command though, the command is actually adjusted so that the > scan_begin timer is set to 400000ns (400us). Sampling at 10kHz gives a > 100us interval between each sample and since I'm sampling 4 channels > the command is adjusted so that a new scan starts every 400us. Just to > convince myself I instrumented scope.c to measure how often a chunk of > 20000 bytes was received and the answer is every second. That makes > since since 10kHz sampling gives 20000 bytes per second. So I'm pretty > sure my initial number of a full FIFO every 25ms is correct, do you agree? I think we are just using a different definition for when we say sampling at X/sec. I was using something I remember from the ni docs, comedi may use a different definition. As you describe it above, I would have called that sampling at 2.5 KHz, rather than 10 KHz...but thats may only be me. I agree with your number of 25ms for sampling channels at 2500 Hz > > > > > Should I expect to be able to sample at 10kHz using this card? How can > > > I figure out why the FIFO is not emptied? > > > > > > > I don't know...though a few years ago I was running a > > NI AT-MIO-16E-1 (yup the 16E-1) with a 450 MHz machine, > > with RTAI. My scan rate was 200 kHz with 4 channels. The > > 16E-1 however has a 8196 byte fifo. When I switched to > > the PCI version of the card, which does only have > > a 512 byte fifo, my 3 GHz machine with RTAI > > was not fast enough, until I went to DMA. > > Hmm, discouraging... I need a faster machine then, or sample slower > (which is actually a possibility for me). New HW is a little too > expensive though for this little project of mine... > > Thanks > Please wait for advice from the real comedi experts before getting discouraged. If you haven't tried already, you might try slowing it down and/or try sampling fewer channels and see if the problem goes away. Cheers, Jim
Received on 2006-02-13Z22:03:10