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: 

Strange Behaviour of Wait VI in FPGA

Hi all, 

 

I had this strange behaviour of Wait VI and I really wonder why I'm facing this. 

 

I use three frames in FPGA. Code in second frame causes a delay (which is simulated in attached VI). I'm able to calculate the difference between first and second frame by using Tick Count VIs. Then calculated delay is subtracted from a control called "Desired Loop Rate" at third frame where that strange behaviour appears. (The idea is to subtract the delay from desired rate. By this way, desired rate is always compansated.) Result of that subtraction is connected to Wait VI. After compilation and run, VI freezes. I guess VI runs only once and it hangs. If I disconnect that output of the subtract operation and connect a control or a constant, everything is normal. Correct delay can be seen from "Delay caused by second frame" indicator. But when I connect the output of subraction it hangs. 

 

By the way, I created the same VI for Windows and it works exactly the way I expected. Am I missing something about the usage of Wait VI in FPGA? (I tried in sbRIO-9636 and cRIO-9030 and there is no difference.)

 

Thanks in advance,

 

Best regards,

Emre 

 

delay_control.png

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 1 of 13
(5,372 Views)
What is the value of Desired Loop Rate?Is it default to 0?
Thanks
uday
0 Kudos
Message 2 of 13
(5,355 Views)

Actually, it is not equal to zero. I forgot to change because I prepared this VI for posting. Default value for "# of iterations" is 10 and "Desired Loop Rate" is 40000 ticks. I initialize both of them in host VI. 

 

Thanks,

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 3 of 13
(5,348 Views)

Desired Loop rate (40,000)-(no.of iterations(10)*Simulation time(12,500)) gives me negative value!!!
-Did i miss anything?

Thanks
uday
0 Kudos
Message 4 of 13
(5,341 Views)

Normally, I have a delay which is around 1000 and 2500 ticks in that loop. I tried the 1 iteration and 10000 tick as default after your message it still hangs. Do you think that loop hangs because there is a probability for output of subtraction to be negative? If so, this may explain why it works in Windows and not in FPGA. 

 

Thanks, 

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 5 of 13
(5,334 Views)

By the way it can't be negative because it is U32. 🙂 

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 6 of 13
(5,333 Views)
Maybe the rollover what explained here is what you are experiencing and it has to do with the datatype of count(Ticks) which i am not familiar :
http://forums.ni.com/t5/LabVIEW/Can-someone-clarify-how-this-works/m-p/1265804/highlight/true#M52979...

-can you define what you mean by hangs? Or does it take long time to update value?
Thanks
uday
0 Kudos
Message 7 of 13
(5,322 Views)

Thanks udka, I'll read that post. 

 

When I say it hangs, I mean loop is not running. I created an indicator to look at the loop iteration whether it is changing or not. It remains 0 although loop seems to be running. 

 

Thanks,

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 8 of 13
(5,320 Views)
Could you please create indicator after subtraction and see how much you got and that might explain the Wait functions is waiting to finish that many counts and that should give a hint.
Thanks
uday
0 Kudos
Message 9 of 13
(5,318 Views)

I already did what you're suggesting but there is a huge number (I guess it is max. of U32 can get) and it does not change later.

 

I guess I have to think more about the part you pointed. There may be a problem during compilation, not a fatal error, just a logic error about the rollover situation.

 

Thanks,

Emre

Actor Framework rocks!
Emre TUZUNER
0 Kudos
Message 10 of 13
(5,314 Views)