From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.

We appreciate your patience as we improve our online experience.

LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Crossing Clock Domains in the FPGA Examples

Solved!
Go to solution

I was looking through some of the LabVIEW FPGA Examples and I came across the Crossing Clock Domains Example.

 

In this example there exists 4 VIs; FIFOs.vi; Global Variables.vi; Local Variables.vi; and Registers.vi. In each of these VIs there is a timed-loop that runs at 160 MHz.

 

How is this possible? Since the clock on the FPGA is only 40 MHz. Am I missing something?

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
0 Kudos
Message 1 of 9
(5,565 Views)
Solution
Accepted by topic author johnoc

On the FPGA target you can right-click the 40MHz clock and create a derived clock which can be a multiple of or a fraction of the base clock (40MHz).

 

160MHz is a trivial example of 4 times the base clock.

Message 2 of 9
(5,564 Views)

 

I could make a derived clock frequency as shown below(sorry in Japanese), but I couldn't know how to use it.

I tried to drug&drop DACtest.vi under the derived 70 MHz clock, and I also tried to move I/O there, I couldn't do that.

 

snapshot.png

 

Thank you for your kind help,

moge

0 Kudos
Message 3 of 9
(4,879 Views)

Hi moge,

 

If you are using a timed loop in your application and you double-click on the input node of the timed loop it will allow you to select your timing source. This is where it will let you choose a clock other that your top level clock.

 

Hope this helps. 

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
Message 4 of 9
(4,862 Views)

Thanks for your kind reply.

I could chose derived clock frequency  as below.

I assumed that below diagram generates continuous 35 MHz clock, but it doesn't work well.

 

キャプチャ.PNG]

 

If possible, please tell me how I can generate 35 MHz(70 MHz/2) clock.

Thanks for your kind help,

moge

0 Kudos
Message 5 of 9
(4,850 Views)

 

It's additional detail.

By below left diagram, I could get right result.

My USB-7856R output 10 MHz continuous clock.

The duty ratio was 0.26 (26 ns + 74 ns = 100 ns).

キャプチャ.PNG  キャプチャ.PNG

 

Then I changed the while loop to the timing loop as shown below.

キャプチャ.PNG

In above diagram, I used top-level timing source (80MHz) and the result was below.

キャプチャ.PNG

My USB-7856R output pulses disorderly for 342 ns, then went high.

I restarted the vi to check the repeatability of this strange operation, but the output remained Hi level (didn't change).

I couldn't observe any pulse after I recompiled same diagram.

 

If possible, please point out the problem or tell me the other way to use derived clock.

I'm using:

   LabVIEW2017 professional development system (ver.17.0f2) 32-bit on Windows 10 pro

   NI USB-7856R R series Multifunction RIO

Thank you for your kind help,

moge

 

0 Kudos
Message 6 of 9
(4,840 Views)

This is an FPGA so you do not want to write to the same port twice in the same clock cycle.

 

My recommendation would be to set your source to a derived clock of 70Mhz for a 35 MHz continuous clock. Then toggle the pin on every clock cycle. This should give you a 35 MHz signal with a 50% duty cycle.

 

The duty cycle can be controlled by inserting a case structure with a different wait time for each state.

John O'C
Staff Test Systems Engineer
Woodward, Inc.
Skokie, Illinois, USA

"Life is not a journey to the grave with the intention of arriving safely
in a pretty and well preserved body, but rather to skid in broadside,
thoroughly used up, totally worn out, and loudly proclaiming...
Wow...What a Ride!"
Message 7 of 9
(4,820 Views)

Also, there may be example code that shows better how to generate an output.  For some I/O, you must have them in a loop that runs based on the IO Clock otherwise you may end up out of phase (especially for analog I/O).


Certified LabVIEW Architect, Certified Professional Instructor
ALE Consultants

Introduction to LabVIEW FPGA for RF, Radar, and Electronic Warfare Applications
Message 8 of 9
(4,814 Views)

 

Dear johnoc and Terry,

 

Thanks for your kind replies and I'm sorry for this really rate reply.

I couldn't try this for about 5 months for other jobs.

 

With below diagram, I've succeeded to output 35 MHz and 20 MHz clock as shown below.

I changed my diagram to "toggle type" as johnoc said.

As Terry said, the synchronization is the next problem.

I'll try to search good sample.

 

20180518-派生クロック.pngscope_0.png

 

Thanks for your kind help,

Best regads,

moge

 

0 Kudos
Message 9 of 9
(4,536 Views)