Jamie,
I'll try to help.
I have experimented with this a bit and I have found that:
For the PCI case, I get better performance with an interrupt condition of half-FIFO-full for the AI operation. DMAs gave me even better performance.
Setting the AI transfer condition to interrupt on every sample quickly generates an overflow error on my counter or on my AI operation. I also experimented with leaving the counter as a DMA-based transfer or have it use interrupts.
It does not seem to match the behavior you were seeing, but maybe we can brainstorm on this to see if we can get extra information that may help to clarify the issue. Some details that might help:
- There is not really a dedicated FIFO for the counter operations on MIO boards. In practice, you might say that it is 2 samples deep.
- The buffer size you are using for both operations (counters and AI) is really important, as well as the ratio to the number of samples you read per iteration in your application. The more samples you read at a time, the more efficient the operation becomes.
- In order to properly benchmark this you need to make sure you use a parallel loop architecture in your application. Same application running parallel loops inside of which it reads from the circular buffer.
- The current NI-DAQ driver is not a fully multithread driver. This means that at certain times the driver might temporarily lock up access to the hardware resource. I have seen this behavior before and it might be the cause of what you are seeing. We are coming out with a new driver that would improve multithreading performance.
- Additional information on the systems running the applications might help. Low processor speed or memory conditions might affect the way a transfer behaves. AI_Read and Buffer_CTR_Read functions normally poll for data, taking your CPU usage to 100%, this affects the ability of the CPU to respond to certain interrupts. One idea would be to introduce small delays within the reading loops to lower the CPU usage. The problem is that you would be limited to the Windows timer resolution:
#Number of Samples to read at a time / Sample Rate > 1 ms
I am not yet certain about what could be causing the behavior but maybe the comments above might help.
Let me know,
Alejandro