Hello everyone,
I'm trying to use an external trigger to trigger an acquisition of 9 to max 16 channels.
I'm measuring a signal with a disturbance frequency on top of that. My reference signal I can control, the disturbance is what I'm intersted in. The reference signal I can give a spectral content to about 3000 Hz the disturbance is around 25kHz.
The used NI hardware is:
Chassis: PXIe-1082
Boards: 1x PXIe-8301 (Slot 1 thunderbolt connection to computer) , 4x PXIe-4464 (in slot 2 to 5), 1x PXIe-4463 (in slot 7 not used during this experiment)
The connections
External 10MHz clock on the back of the chassis
1 External trigger connected to the PFI0 connection of the PXIe-4464 boards. So each board gets the same trigger. (I suspect the issues I see arise from improper triggering)
All the analog input channels on the PXIe-4464 sample the reference signal + the disturbance.
Matlab code
---------------------------------------------------------------------------------------------------------------------------------------------
%clear variables and close figures
clear all
close all
apparatuur=daqlist;%see whats connected
session=daq('ni');%create an NI session
%create channels currently reading in 9 channels can be expanded to 16
addinput(session,'PXI1Slot2',{'ai0','ai1','ai2','ai3'},'Voltage');
addinput(session,'PXI1Slot3',{'ai0','ai1','ai2','ai3'},'Voltage');
addinput(session,'PXI1Slot4',{'ai0'},'Voltage');
session.Rate=204800; %set rate to the max the cards support
t(1)=addtrigger(session,'digital','StartTrigger','external','PXI1Slot2/PFI0' );
t(2)=addtrigger(session,'digital','StartTrigger','external','PXI1Slot3/PFI0' );
t(3)=addtrigger(session,'digital','StartTrigger','external','PXI1Slot4/PFI0' );
session.DigitalTriggerTimeout=600;
session.NumDigitalTriggersPerRun=1;
disp('ready for aq')
for i=1:100 %for tracking stability over time i run the same measurement 100 times
start(session,"NumScans",round(session.Rate*0.300)); % Start the measurement and make sure we can receive triggers
while ~session.NumDigitalTriggersRemaining==0 % this code makes sure that we don't go into retrieving the data unless the trigger has been given and the acquisition is done
pause(0.001)
end
scanData(:,:,i) = read(session,"all","OutputFormat","Matrix");%receive the data and create a 3d matrix where the dimensions are [Time,Channels,Repetition]
end
clearvars -except apparatuur scanData session %clear variable I no longer need
---------------------------------------------------------------------------------------------------------------------------------------------
So the idea behind routing the trigger to all 4 PFI0 lanes was simple. They share a clock via the backplane so they would sample the trigger at the same time because delay due to cable length would be less than 1 ns.
If all this would work I wouldn't be asking for support. The signal that I acquire on each channel I can fourier transform and look at the phase. This gives me an idea on how stable triggering is.
Over the 100 runs I see a deviation in the phase of the 220Hz signal of 0.3818 degree. This phase variation gives the indication of a timing jitter of 33us=1/(220*360*0.3818). Also the timing jitter is different per slot so the idea of running the external trigger to all the slots might not be a good idea.
So there are 2 problems I need to solve:
1) Get the trigger stable so that 100 acquisitions don't show a difference in phase of my reference signal.
2) Makes sure the different slots sample at the same time (constant phase difference over the 100 runs).
I'm pretty sure I'm messing up the triggering however how to correctly route the triggering in the chassis while using Matlab is unknown to me.
Hope this will "trigger" some responses.
Guus