Worklog 5761 Sync
Worklog 5761 Sync
RH on SFDC
https://natinst.my.salesforce.com/a1A31000006dOJC
Previous Request
Resource locations
Internal root directory for this RH
1. Define Task Scope and Environment
1.1. Write Overview
In this work, two sets of 5761+7975R are synchronized at their start of streaming
acquisition, lasting one second.
3.1. Set up HW
REQ_3_1_HW_DIAGRAM
Two sets of 5761 + 7975R are used to be tested for synchronization capability.
As a signal source, 5450 is used, because it can generate same signals at same
timing from two different channels. Signal connections are as follows. If
one signal source is split into two directions for a purpose of sourcing the same
signal to two 5761s, it does not work as expected, because 5761s are designed
to have some bias voltages at its signal inputs. (Refer to documents linked
at NI 5761 Offset Issue)
5450 Generates Analog Waveform from its CH0+
At 1st sample of generated Waveform, 5450 exports data marker0 from its
PXI Trigger 1 and marker1 from PFI 0. (At the same sample index of 0,
marker0 and marker1 are generated to route same event to two different
output ports.)
Marker 1 from PFI 0 is connected to AI0 of Master or Slave of 5761
Analog signal from CH0+ is connected to AI0 of the other 5761
3.2. Reuse Example for 5450 Signal Gen
REQ_3_2_5450_CODE
Almost just copied an example of Arbitrary Waveform of FGEN driver. The
copied code is located under project, nasmed “Test Signal From 5450.vi”.
Below is an image of two waveforms acquired on both AI0 (5761 Master) and
AI0 (5761 Slave). As shown in the image, rising edge of trigger signal (maker
event) and generated square waveform are matched.
REQ_1_4_2_WFM_ON_GRAPH
3.3. Review Theory of Op. of Sync Mechanism
I re-drew timing diagram of synchronization mechanism for two purposes: 1 to
re-check my understanding about the sync mechanism, 2 to have a diagram to
explain the mechanism,. There are two citations for drawing the diagram: 1
“FIDL Synchronization Theory of Op.pdf”, 2 “about the behavior of
“synchronize signal.vi””
REQ_3_3_TIMING_DIAGRAM
Based on this review, synchronization mechanism is accomplished by followings.
1. Before synchronized acquisition starts, buffer the in-coming samples in a
circular buffer. The amount of buffered samples should be larger than the
amount of tick counts with longest delay between actual and synced
triggers.
2. Acquisition starts in a synchronized manner.
3. For the first fetch on host PC, the number of samples to be fetched is
equal to (one reading sample) + (buffered samples). For fetches after 2nd,
the number of samples to be fetched is equal to just (one reading sample).
4. On host-side, discard the extra samples from buffered samples. The
amount of discarded samples will be (buffered samples) – (synchronization
delay)
5. For the rest of all fetches, do some array operations.
3.4. Test by Simple Code
REQ_3_4_TEST_FIDL_SYNC_HOST
REQ_3_4_TEST_FIDL_SYNC_FPGA
Based on multiple test, the amount of "synchronization delay" measured by
"Synchronize Signal.vi" is found longer than actual value by about 21. Below
is FPGA VI named “tc-Test Sync API 5761 (FPGA).vi”.
Below is UI of the host VI. As seen below, actual edge location does not
match with calculated edge position, whose value should be 2*(pre trigger
length) – synchronization delay. In below, synchronization delay is returned
34 and 2*25-34 = 16 should be the expected edge position of acquired signal.
However, based on multiple tests, it is found that the actual edge of acquired
signal is off by 21 clocks.
As in the red dotted rectangular below, buffer for pre-trigger has U64 data type
for its data type, because 5761 has four channels and 16bit * 4 is 64bit wide.
4.1. Show Project
Below is project explorer view of modified example.
One thing to note is that FPGA should not be reset at all times, because DRAM
seems to require some time for its stable operations after a reset. This is found
by timeout error which has frequently occurred due to the hesitation of DRAM
ready for write. So, FPGA “reset” method should not be called even at the
beginning of VI run. Also, “reset” at close FPGA reference should be un-
checked, so that FPGA is not reset.