Driver Development Kit (DDK)

cancel
Showing results for 
Search instead for 
Did you mean: 

6259 FIFO read/write performance

I have been doing some performance measurements on the code needed for a) writing samples to the DA FIFO and b) reading data from the AD FIFO on a 6259 board using the DDK samples and the VISA package.
The code in case a) is just a loop including sample conversion and register write. I case b) it is a check empty flag - read register - convert sample loop. In my application I need 16 input channels at 40 kS/s and 4 output channels at 40 kS/s. The data will be processed in chunks of 40 samples/channel every 1 ms.
 
The results are:
a) Writing 20 samples to the DA FIFO takes ~3.2 us = ~0.16 us/sample
b) Reading 100 samples from the AD FIFO (including check of FIFO empty flag) takes ~320 us = ~3.2 us/sample.
 
The results indicates that a register read takes  approx. 10 times longer than a register write. Since I will be reading 640 samples and writing 160 samples every 1 ms in my application, this isn't fast enough.
 
My questions are:
Is the read access to the board registers really this slow compared to writes or is there some wait-state settings that need some tweeking?
Whould I gain any performance using DMA?
 
The tests are performed on a Intel Xeon 3.8GHz machine.
0 Kudos
Message 1 of 6
(9,542 Views)

Hello!

We don't normally answer questions related to DDK but yes you would most likely get better performance using DMA since the CPU will get more time performing other things. I read a post that we will have DMA examples for M-series posted on our website soon. It might actually already be uploaded since they talked about February time frame.

 

 

Regards,
Jimmie Adolph
Systems Engineering Manager, National Instruments Northern European Region

0 Kudos
Message 2 of 6
(9,521 Views)
I looked at DDK download page and didn't find any DMA examples. Is there anyone out there who has more information on this topic?
0 Kudos
Message 3 of 6
(9,442 Views)
We are in the process of updating the MHDDK download page.  However, I have attached a zip file that contains the DMA library, an M Series example that uses the library, and the os interface that implements DMA memory methods using NI-VISA.  If you are not using VISA, then you will have to port those methods appropriately.  I hope this helps.
0 Kudos
Message 4 of 6
(9,417 Views)

I finally got some time the checkout the DMA-example and here are my findings:

- The tLinearDMABuffer has an off-by-one bug in the read and write functions. The last memcpy should copy end-current+1 bytes and the last line should be 'setLocation ( (end + 1) % _size );'.

- For some reason I only get 0 from the ADC if I unkomment the adcReset() line (which should be called for the 625x board according to the comment). In order to make the board work again I have to reset it using MAX. This isn't a problem when I run the non-DMA aiex2 from the original zip on the DDK page. And yes, I have fixed the adcReset() bug described in an other post on this list.

- Performance is excellent. Typically the processing time for one sample is 0.08 us on my machine using the VISA driver (770 us for 10000 samples). This should be compared with 3.2 us/sample using FIFO reads.

So the only annoying thing is the adcReset() issue descibed above. Is there anyone who knows something about this?

/Mathias

0 Kudos
Message 5 of 6
(9,254 Views)
Hi,

There's a bug in the adcReset() function, the values are reversed.  Check the second to last post of this thread.

I'll look into the DMA error.

Diego.
0 Kudos
Message 6 of 6
(9,219 Views)