LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

How to reduce LabVIEW FPGA signal generation frequency error

vnetawz_0-1651216703012.png

vnetawz_1-1651216790980.png

vnetawz_2-1651216824043.png

 

When I generate sine signal using Sine IP on FPGA by CRIO 9038, I found the actual frequency is always 2.5% smaller or larger than the set value, no matter low frequency or high. And the signal data obtained from FPGA verifys this. So I wonder why this happen because there seems nothing I can do to enhance this. The Normalize signal  generation parameter convertor VI runs on the computer, so it has nothing to do with FPGA setting.  Is such error the property of FPGA? Or the LabVIEW?

0 Kudos
Message 1 of 7
(1,421 Views)

Hi vne,

 


@vnetawz wrote:

vnetawz_2-1651216824043.png

When I generate sine signal using Sine IP on FPGA by CRIO 9038, I found the actual frequency is always 2.5% smaller or larger than the set value, no matter low frequency or high. 


The numbers on your image only differ 0.35% / 0.024% from expected value...

 

How is the code shown in your image related to FPGA? I guess that code runs on your RT target?

Best regards,
GerdW


using LV2016/2019/2021 on Win10/11+cRIO, TestStand2016/2019
0 Kudos
Message 2 of 7
(1,389 Views)

The point of that VI is to convert into fixed point data for periods per tick. What is your FPGA clock rate input? What do the fixed point outputs show?

0 Kudos
Message 3 of 7
(1,368 Views)

Thank you for reply and correction. Sorry, I may have the wrong conclusion. But for low frequency, like 0.1Hz, it does result in about 2.5% error. And it get better when frequency increases as you found. The FPGA reference interface runs on PC.

 

Regards!

0 Kudos
Message 4 of 7
(1,357 Views)

Thank  you BertMcMahan!  The help doc says output fixed point variables are “unsigned fixed-point data type with a 32-bit word length and a 0-bit integer word length”. I didn’t monitor them and sorry now I have no access to my device. 

But I am afraid even if they are monitored it may make no sense, since the output signal is right the frequency of the displayed one. So I am more concerned of the converter itself.  

Regards!

0 Kudos
Message 5 of 7
(1,353 Views)

Hi    and BertMcMahan, thanks for your direction. I think I may have found the reason. The converter VI program is as below which I forgot to double click to see how it works before. The actual frequency is calculated by dividing desired frequency by 40M (FPGA clock) and then converting it to a 32 bits FixedPoint data type. The quantization of FXP(32,0) is 2^(-32)=2.328E-10. So we can calculated the minimum desired frequency  quantization by solving f/40M=2^(-32), f=0.009312. Because of quantization, when desired frequency f_d is assigned, f_d needs to be converted to the nearest FXP(32,0), thus the error. And the small the frequency, the larger the error.

 

vnetawz_2-1651386552065.jpeg

vnetawz_0-1651387546916.png

 

 

 

0 Kudos
Message 6 of 7
(1,318 Views)

Thanks BertMcMahan and GerdW for your kind help!

 

The VI program may tell everything. The error comes from the quantization of FXP<32,0> which is 2(-32)=2.328e-10. And the frequency converted to FXP is calculated by f_d/40M, so the minimum f_d is 0.009312. Because of the quantization, the smaller the f_d is,  the larger the error will be.

vnetawz_0-1651387825818.png

vnetawz_1-1651387853733.png

 

0 Kudos
Message 7 of 7
(1,334 Views)