05-02-2013 09:53 PM
Hi, we are controlling and acquiring data from multiple hardware devices (including translational stages and photodetectors). Until last week, we used to peform all control and acquisition using a PCIe 7852R FPGA board. However, we decided to switch the acquisition part to a PCIe 6363 DAQ card to improve the voltage resolution. During testing, I found that the internal clocks in the FPGA and the DAQ cards are slightly mismatched (not just a phase delay, but a difference in time-period).
I know this because I generated a square wave (period = 20us) using the FPGA and acquired it using the DAQ card (at a rate of 200kHz, i.e., 1 sample every 5us). I observed that the acquired square shifts by 5us every 5 seconds or so. Such a shift does not occur if the generation and acquisition is done using the same board. Therefore, the only explanation is that the clock frequencies of FPGA and DAQ cards differ. According to my calculation, percentage difference between their clock times must be 5us/5s = 0.0001%.
Therefore, I am wondering if there is anyway to synchronise the clocks between them. Or, is there a way I can drive the DAQ device based on the FPGA clock, or vice versa? Also, please let me know if there is something trivial that I have fix.
Thank you very much.
Regards,
Varun
Solved! Go to Solution.
05-03-2013 02:15 AM
Hi varun,
you can also use external clock signals on DAQ boards to control the sampling rate!
You could connect one DO of your FPGA to one PFI of your DAQ card. Use that connection to send an external clock signal from FPGA to DAQ…
05-03-2013 06:06 AM
Hi GerdW,
Thank you for your reply.
I understand both solutions you have suggested. I had conceptually thought about the first one (to control the sampling rate). However, I still haven't figured out how to accurately generate a 200kHz square wave - I think I can figure that one out this morning.
However, I am unsure how to implement the second option. I presume the default internal clock inside the DAQ is running at 100MHz or so. Therefore, inorder to obtain the same performance while using an external clock, I would have to generate at least a 80MHz TTL clock-out from the FPGA. Could you please tell me how I can do that? I couldn't find any clock-out capabilities on my FPGA. Or would I have to generate a clock of my own using Single-Cycle-Timed-Loops?
Not only did you provide two different solutions, your reply suggested that I wasn't wrong in interpreting that the clock periods of our FPGA and DAQ must be slightly off.
Thank you very much.
Regards,
Varun
05-03-2013 06:20 AM
Hi Varun,
my post was meant a just one solution...
Your DAQ card can take a trigger input to control the sampling. In this mode samples are taking on rising edge of the external clock signal. As long as you stay within limits of the DAQ hardware (100MHz for your card) the sampling will work fine. There are even examples coming with LabVIEW explaining how to program your DAQ card...
Using this mode you use your FPGA as sampling clock source for the DAQ. Both will run synchronized to the FPGA clock. When the FPGA is a little bit off from 40MHz then it will not matter because both devices trigger on the same clock signal...
05-03-2013 06:39 AM
Thank you GerdW.
If that is the only solution, then the only hurdles that remains for me is to generate a 200kHz square wave from my FPGA so that my DAQ board will acquire at rising edges of this TTL. Until yesterday I had trouble to faithfully generate square waves of period less than 20 us (or frequency higher than 50kHz).
One more question. What is the difference between a PFI and generic digital i/o channel?
Thank you.
Regards,
Varun
05-03-2013 07:21 AM
05-05-2013 02:59 PM
Hi GerdW,
Thanks for your reply. I figured it out. I wasn't able to generate TTL sample pulses faster than 5kHz because of having to perform a read/write function in every run. I removed this and it woks fine.
Thanks for your help.
Regards,
Varun