Measurement Studio for .NET Languages

cancel
Showing results for 
Search instead for 
Did you mean: 

How to configure PXIe 6124 (ADC) to use PXIe chassis 10MHz reference

Solved!
Go to solution

Problem Description :
I get the ADC to work, ie, getting the correct time domain signal from both
channels (ch0 and ch1). But the period of the signal (or the frequency) is
always slightly off. I am programming it to use the PXIe chassis 10MHz signal
which is locked to other RF siggen in my setup, so the signal period/frequency
should be dead on, but it is not, it is off by few kHz such as reading peak
signal at 1.58MHz when I do the fft of the time domain signal, when it should
be dead on 1.6MHz. The RF signal is supplied by RF signal generator locked to
the PXIe chassis 10MHz reference. Example: ADC captures time domain signal, then code does fft to the time domain array, I am expecting to get an exactly 1.6MHz peak signal, but I get instead 1.58MHz. If I vary the Fs (sample freq) by a little bit, sometimes I can get exactly 1.6MHz from fft. The problem is not with the fft code, as I have checked the same ADC using two different programs written by two different engineers and they both give the same erroneous frequency. The two programs have been vetted many times prior on other ADC systems, and report correct frequency. 

I am suspecting the ADC sampling clock is not set correctly, or the actual sampling frequency is not achievable because of the fixed or limited divider ratio in the counter/divider inside the ADC card. But, I would expect the API to throw an error if the hardware cannot support the Fs with the given reference 10MHz clock, and not be mum about it. The NI Manual for the ADC is super hard to read, since it encompasses hundreds of ADC cards that NI makes.


Here are my c# code ...


myTask = new NationalInstruments.DAQmx.Task();
AIChannel myChannel;
myChannel = myTask.AIChannels.CreateVoltageChannel("PXI2Slot11/ai0:1", "",
NationalInstruments.DAQmx.AITerminalConfiguration.Differential, -10, 10,
AIVoltageUnits.Volts);
myTask.Timing.SampleClockTimebaseSource = "PXI_CLK10";
myTask.Timing.SampleClockTimebaseRate = 10e6;
sampleFreq);
myTask.Timing.ConfigureSampleClock("ai/SampleClockTimebase", sampleFreq,
SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, numSamples);
myTask.Start();
AnalogMultiChannelReader reader = new AnalogMultiChannelReader(myTask.Stream);
data = reader.ReadMultiSample(numSamples);
myTask.Stop();
myTask.Dispose();

NI Software :  How to properly set the sampling clock on PXIe-6124 to use PXI
chassis 10MHz Ref 
NI Hardware :  PXIe-6124 device
Driver Version :  
OS :  Windows 7
Customer Information :

Juswanto Wardojo
Peregrine Semiconductor Corp
US
jwardojo@psemi.com
Ph: (760) 795-0146

0 Kudos
Message 1 of 4
(2,286 Views)

Hi juswanto,

 

In your code what are you setting sampleFreq to be 1.6 MHz? Is the RF signal that you are referring to phase locked to the 10MHz clock on the chassis? If you vary the sample rate, does the fundamental frequency on your FFT always off by around the same amount (20 kHz)?

Adena L.
Technical Support Engineer
National Instruments
0 Kudos
Message 2 of 4
(2,258 Views)

Hi,

 

have you tried:

myTask.Timing.ConfigureSampleClock("", sampleFreq, 
SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, numSamples);

instead of:

myTask.Timing.ConfigureSampleClock("ai/SampleClockTimebase", sampleFreq, 
SampleClockActiveEdge.Rising, SampleQuantityMode.FiniteSamples, numSamples);

Anyhow, as far as I know the 6124 is capable of PLL to the 10 MHz Backplane.

Please take a look at:

 

https://forums.ni.com/t5/Example-Programs/PLL-PXIe-6124-to-PXI-10MHz-Backplane-Clock-Using-LabVIEW-w...

 

You just have to translate the example to C#.

 

Best wishes

Jo

0 Kudos
Message 3 of 4
(2,225 Views)
Solution
Accepted by topic author juswanto

Hello to all that responded to my post and thank you.

I think my title of my post was a little bit off in hind-sight.

I did not have a problem with the ADC locking to the 10MHZ PXI reference (but I was not so sure back then). The problem I had was the fft told me the RF signal frequency is off by a little bit as compared to the RF siggen frequency. RF siggen is locked to the same 10MHZ PXI reference so I was expecting the fft of the ADC timed samples to give exact frequency reading, but it was not. 

I have found out the cause of my problem (why RF freq is a little off).. through my own debugging and some help from NI application support. I have found, a lot of times, when I properly document the problem to report to anapp engineer, I realized what is causing my problem.

The NI PXIe-6124 has limited PLL engine, in the sense that the PLL counter/divider is a fixed integer N and with limited number of bits (what the actual counter resolution is, is still a mystery to me because it is very hard to read the NI PXIe-6124 datasheet since NI uses a single document to documents 50+ ADC models!). The limited PLL counter/divider puts a constraint on the sample rate that the ADC can be set, i.e. you may not get exactly the ADC sample frequency that you want. So when I asked the ADC to give me 1.6MHz, it was not giving me exactly 1.6MHz because of the limited PLL divider/counter resolution. I got something close to 1.6MHz (I forget the exact number), which is not a problem as long as I know what that sample rate. So the key is, you may not get the sample rate you asked for (because of PLL resolution), but you have to know what the actual sample rate is, so that the fft will give you correct frequency reading of the RF signal digitized by the ADC. An improvement to the ADC API could be that it gives you a warning (return code other than 0, that gives the user some indication that what is asked for of the ADC is not exactly what the user will get.).

Sometimes the ADC does give you exactly the sample rate that you ask for, forexample, when I ask for 1MHz sample rate, I get exactly 1MHz... this is because the divide number is a nice even 10 (10MHz reference/1MHz sample rate), so the ADC PLL can do this without problem. 

Message 4 of 4
(2,203 Views)