Error -1074115985 When Using NI-FGEN Function Calls

Updated May 21, 2024

Reported In

Driver

  • NI-FGEN

Issue Details

I am receiving Error -1074115985 with Status Code: -200584 or -200400: Requested waveform length is invalid, because the number of samples is not an integer multiple of the waveform increment. What is this increment?

Solution

All NI-FGEN devices have a specification for waveform quantum, which dictates that when generating more than one waveform, the total number of waveforms being generated must be a multiple of the waveform quantum for that device. There is a similar specification that is not documented called the Write Quantum. This is the increment referred to in the error message. The write quantum is 64 samples for all PCI and PXI FGEN devices. This specification dictates that the total number of samples you are generating (or writing to the onboard memory) must be a multiple of 64 samples, or that the remainder after subtracting the highest multiple of 64 that is less than the total number of samples, be a multiple of the waveform quantum.

For example:
Let's suppose we are using the NI PXI-5441 which has a waveform quantum of 4 and a write quantum of 64. If we attempt to generate 75 samples, we will get Error -200584 or -200400. This is not because 75 is not a multiple of 64. It is because the remainder of the total number of samples divided by the write quantum is not a multiple of the waveform quantum, ie 75 / 64 =/= n*4. If we attempt to generate 76 samples, we will not get an error. First we generate 64 samples, then the remainder, 12, is a multiple of the waveform quantum (3*4), so this is an acceptable number of samples to generate. Similarly, we can generate 260 samples because we can subtract 64*4 = 256 to get 4 samples, and 4 is a multiple of the waveform quantum.

One method to find if the number of samples in your waveform signal is acceptable is to divide the size of your waveform data array by 64 using the Quotient & Remainder function. You will then divide the output from the remainder terminal by the waveform quantum number (this would be 4 from the above example) using the Quotient & Remainder function again. If the output from the remainder function is equal to 0, then you should not receive an error for the waveform size. If the remainder output is any number greater than 0, that will tell you how many samples you need to add to your waveform data set. An example of adding samples to the data set would be to add 0's to the end of the original data set based on the output from the remainder. An example of this is shown in the image below.

Waveform Quantum Remainder.png
Note: This image is a LabVIEW snippet, which includes LabVIEW code that you can reuse in your project. To use a snippet, right-click the image, save it to your computer and drag the file onto your LabVIEW diagram. This snippet was made with LabVIEW 2022Q3 (64-bit).

Additional Information

Minimum Waveform Size and Quantum

The memory architecture of the NI signal generators imposes certain requirements on the waveform size and quantum. If these requirements are not met, NI-FGEN returns an error. The specific values for minimum waveform size and quantum depend on the specific NI signal generator being used.

Minimum Waveform Size

Every waveform downloaded to the device memory must be at least a minimum size in terms of the number of samples.

Quantum

The size in samples of the waveform downloaded to the device memory must be an integer multiple of a certain number or quantum.

For example, if the minimum waveform size for a particular signal generator is 256 samples, the quantum is eight samples, and you request to load a waveform of 255 samples, NI-FGEN returns an error because the waveform size is too small. If you request to load a waveform of 257 samples, NI-FGEN also returns an error because even though the size is larger than the minimum waveform size, the waveform is not an integer multiple of the quantum size (8).

Waveform sizes that meet the restrictions for this example include 256, 264, 272, and 280 samples, and so on—up to the actual device memory size.