From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

Multifunction DAQ

cancel
Showing results for 
Search instead for 
Did you mean: 

DSA measurement buffer clear

Hi,

I'm using an PCI-4551 with the NI-DSA C++ API to run a swept sine frequency test and getting the magnitude and phase data to calculate natural frequency and resonant rise.  

I've just upgraded one of my computers and am seeing a couple of weird problems. 
I have a number of other testers running the same code and do not have the same problems.

1) The NIDSA_check_new_measurement() function returns 1, indicating a new measurement is available.  But NIDSA_get_number_of_measurements() seems to be returning 0.  It seems like the flag is incorrectly set.

2) After running a few tests, instead of a new set of measurements, the exact data set from the previous test is returned.   The entire frequency sweep is skipped, and the data set is immediately returned.  If I re-test the part, the test will run correctly.

It seems like the measurement buffer isn't getting cleared.  I looked through the NI Dynamic Signal Analyzer Help and couldn't figure out which function explicitly clears the measurement buffer that is used by NIDSA_read_measurement(), NIDSA_check_new_measurement(), and NIDSA_get_number_of_measurements().

Since I run many tests, I do not call NIDSA_close(). 

For each test, I call the following code :

    // configure mode for swept sine
    if (!rc) rc = NI4551_ConfigureMode(SWPSINE_MODE);

    // configure source
    if (!rc) rc = NI4551_ConfigureSweptSineSource(GetAmplitude(), GetAutoLevelEnable(), GetAutoLevelChannel(),
                                                  GetIdealRef(),  GetRefLowerDeviationdB(), GetRefUpperDeviationdB(),
                                                  GetMaxLevel(), GetRampingEnable(), GetRampingRate());

    if (!rc) rc = NI4551_ConfigureSweptSineCustom();
   
    // configure swept sine for custom frequency sweep
    if (!rc) rc = NI4551_ConfigureSweptSine(GetStartFrequency(), GetStopFrequency(), GetNumberOfSteps(),
                                            GetRepeat(), GetLinLog(), 2,
                                            GetAutoMaxStep(), GetFastThresholddB(), GetSlowThresholddB());

    rc = NIDSA_controlsweptsine(DSAsession, sweepControl);

Previously it seemed like this was good enough to clear the necessary IO buffers.

Do I need to clear the measurement buffer and how do I do it?

Thanks!

0 Kudos
Message 1 of 2
(2,479 Views)

Hello NF1,

From your problem description, two possibilities come to mind.  The first is that this problem is caused by something with your upgrade.  This is because it appears the behavior did not start until you upgraded, and the same code works on other computers.  The driver you are using is relatively old, and upgrading could cause issues.  For example, NI DSA is not supported on the Windows Vista operating system, so if you upgraded to Vista, odd behaviors like these could arise.

The other option that comes to mind is a hardware issue.  If you hardware is not working correctly for some reason, then that could cause they types of behavior you are seeing.  I would suggest swapping out your PCI-4551 with a different one to see if you still see the behavior.

Since the buffer on the card is a FIFO, the way to clear it would be just to read all available samples out of the buffer.  It appears that you are already doing this, so no additional programming should be necessary.

I hope this gives you a starting point for your troubleshooting. If you still cannot figure out what is happening, please post back with more information such as how/what you upgraded or what troubleshooting steps you have tried.

Neal M.
Applications Engineering       National Instruments        www.ni.com/support
0 Kudos
Message 2 of 2
(2,463 Views)