NI PCI 6733 DAC Conversion Speed Insufficient

Skip to first unread message

Matthew Peters

Jan 19, 2022, 2:18:30 PMJan 19
to the labscript suite
Hi all,

My group is needing to ramp our laser powers with a high resolution using the analog outputs on the NI PCI 6733. We are attempting to use a sample rate of 1e5 for a linear ramp on an analog output, however, we get the following error:

2022-01-19 13:48:42,155 ERROR BLACS.ni_6733B_main_worker.worker: Exception in job: 

Traceback (most recent call last): 

File "c:\users\roydaq\documents\labscript_python_38\custom_lib\labscript-devices\labscript_devices\NI_DAQmx\", line 373, in transition_to_manual 


File "c:\users\roydaq\documents\labscript_python_38\custom_lib\labscript-devices\labscript_devices\NI_DAQmx\", line 366, in transition_to_manual 


File "<string>", line 3, in WaitUntilTaskDone 

File "<string>", line 2, in function 

File "c:\users\roydaq\documents\labscript_python_38\lib\site-packages\PyDAQmx\", line 62, in mafunction 

raise exception_class(errBuff.value.decode("utf-8"), f.__name__) 

PyDAQmx.DAQmxFunctions.DACUnderflowError: DAC conversion attempted before data to be converted was available. 


Decrease the output frequency to increase the period between DAC conversions, or reduce the size of your output buffer in order to write data more often. If you are using an external clock, check your signal for the presence of noise or glitches. 

Task Name: _unnamedTask<2> 


Status Code: -200018 

in function DAQmxWaitUntilTaskDone 

The same code executes fine when the sample rate for our ramp is set to 1e4

It appears that this error may be related to the fact that we have a separate housing for 8 PCI cards that is wired to our computer running blacs with a single PCIe connection. In other words, many bytes are being written to many cards over the same PCIe connection and it appears there is a bottleneck. 

After looking at this issue online, it appears using the DAQmx command SetAOUseOnlyOnBrdMem/UseOnlyOnBrdMem  could solve this issue for us, however, I have not been successful in trying to use this Task() method with PyDAQmx library. I can't find PyDAQmx documentation for this method and every combination of trying to use it has so far in the blacs_worker class failed.

Does someone with more NI card/PyDAQmx experience have a suggestion for a solution to this problem?

Thank you,

Lars Pause

Jan 20, 2022, 3:08:40 AMJan 20
to the labscript suite
Hi Matthew,
I cannot help you with the problem of using SetAOUseOnlyOnBrdMem/UseOnlyOnBrdMem but regarding the external PCI-Extension box: We had the same problem, that it would have been the bottleneck in our experiment. And looking into the thesis of the student who tested it, it also says that using the AnalogOut-Cards in the expansion box, there was some error thrown (error message is not specified in the thesis).
From this point on we did two things: 1) Look for PCs/motherboards with several PCI-Slots; 2) Use the remote server utility from labscript
We currently use two PC's with 6 (4+2) PCI-cards.


Jan 20, 2022, 3:19:17 PMJan 20
to the labscript suite

I ultimately agree with Lars. If you are having data streaming issues, you probably just want to use a remote BLACS server to divide up responsibilities.

If you want/need to pursue customizing the DAQmx task, I can help a little with that.

As you've noticed, the PyDAQmx documentation basically contains no API documentation. There is a good reason for this. If you look at the source, PyDAQmx actually works by wrapping all of the DAQmx function headers (basically on the fly). So you actually have to read the DAQmx C documentation to get details about how to invoke the function calls. These docs come bundled with your installation as 'NI-DAQmx C Reference Help'. After a bit of work, the function you are trying to use has the following call:

cint32 __CFUNC DAQmxSetAOUseOnlyOnBrdMem(TaskHandle taskHandle, const char channel[], bool32 data);

Assuming I'm not too rusty, that converts to a python call as:

task.DAQmxSetAOUseOnlyOnBrdMem('ao0, ao1', True)

Which basically assumes your AO task is only using the first two channels.

I believe it is also possible to use the call as

When it comes to converting the docs, I find it helpful to find a PyDAQmx function that you know already works, then look up its C documentation to see how the conversion works. Note that C functions that get values are especially tricky, since you often have to pre-allocate the variable and pass it like an argument, even in PyDAQmx.


Matthew Peters

Jan 20, 2022, 5:36:16 PMJan 20
to the labscript suite
I see, thank you both very much, this is extremely helpful! I had no idea there was a RemoteBLACs server, that sounds like it'll be the simplest solution.


Reply all
Reply to author
0 new messages