Real-Time Measurement and Control

cancel
Showing results for 
Search instead for 
Did you mean: 

FPGA jitter issues

Dear LabVIEW community,

 

within a university project I got the task to programm a trigger-based event in FPGA (the professor recommended using FPGA due to its fast reaction times). I already programmed a different projekt using DAQmx drivers on a compactRIO for data aquisition, but my knowledge is somewhat limited (short project schedules) and I'm totally new to FPGA.

I'm using a cRIO 9045 and the 9401 module. All necessary software packages are avalaible.

 

The task:

A rotor is running a variable amount of rpm (somewhat between 1000 rpm and 30,000 rpm).

A TTL-signal is generated every revolution (1f-signal).

The user should be able to vary the trigger event in regards to the angle. E.g. the TTL-output trigger shall occur at 90° phaseshift to the 1f-impuls. This TTL-Output hast to be very, very reproducible between every user-initialized event.

 

At the moment I'm using a testing scenario with a frequency generator with a rectangle signal (1f-signal simulation) and an oszilloscope to measure the TTL-input and output to verify the phaseshift.

 

Issue:

If I use the angle of 0° for a direct trigger (wait time = zero ticks), I measure a constant delay from input to output about 400ns which is totally fine for the task as long as it is constant and a jitter about 25ns. I guess this jitter time is a result of the 40MHz onboard timer (40MHz = 25ns)

If I use the angle of 180° or 360°, the jitter increases somewhat linear up to 2 microseconds (!) at 360° phaseshift @100Hz (6,000RPM).

The jitter decreases at higher input frequencies (400ns @ 500Hz (30,000RPM) but the relative amount of jitter-error stays constant (about 0.072°).

 

Explanation of my .vi:

The TTL-Output is set to zero at the beginning and the delay between two rising flanks of the input signal are measured to get the rotational speed. I used mainly the tacts to increase the accuracy.

After the user pushes the start button the code awaits the rising flank. After that it waits for the individual dwell time to realize the phaseshift. As this wait time has passed, the TTL-output signal will be generated.

 

Questions:

Is there a fundamental programming mistake in my written FPGA vi?

Are the jitter-issues related to the numeric conversion? (the 0.0027777... is 1/360 for the angle variation)

Are there more options to improve the program? (using single cycle loops or wait for rising flank give me no differences)

Is there an alternative explanation for the increasing jitter?

If I hit the run button the "periodic time in tacts" and the "wait time in tacts" at 360° phaseshift should be the same, but sometimes they have a difference about 54 ticks (1.35 micro seconds). The "periodic time in tacts" is generally very unstable. I assume those issues do not come from the frequency generator as it has a jitter below 1ns. Any idea what causes those issues in the FPGA?

 

Any help or advice would really help to improve the situation.

Even if there is no way to improve the solution or if there are no better solutions, I would need an explanation for this issues.

 

Many thanks in advance!

Greetings

0 Kudos
Message 1 of 3
(2,394 Views)

Your jitter is likely caused by all the stuff you have going on in parallel creating race conditions and arbitration. If you can get it all into one big sequence or a state machine, it will help.

 

Your single point math is going to run pretty slow compared to the rest of the stuff. I highly recommend using fixed point math instead.

 

Also, it sorta looks like you're creating a delay generator. You might want to look at this example: http://www.ni.com/example/31131/en/

0 Kudos
Message 2 of 3
(2,362 Views)

Dear nanocyte,

 

thank you for your kind reply. I guess I found the jitter issue and will explain it at the end.

Thank you for this interesting link, I may give it a try.

 

I reprogrammed everything in a big sequence but it gave me now advantage, but the delay decreased to 200ns (Maybe its the update-rate of the 9401 with 100ns).

The jitter issue increased linear to the desired phase-shift. The jitter stays is about the same (25ns) with a 1° phaseshift but is greatly increase with 360° = next revolution of the rotor. After some further tests, the source of all the problems is not related to LabVIEW but to the frequency generator. Measuring only the freq. generator I can see the jitter mentioned in the initial post. Guess this device needs a calibration or whatever. That is what you get for relying on datasheet specifications blindly.

 

Nevertheless, thank you for your time.

0 Kudos
Message 3 of 3
(2,346 Views)