From 04:00 PM CDT – 08:00 PM CDT (09:00 PM UTC – 01:00 AM UTC) Tuesday, April 16, 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: 

Data acquisition using Labview FPGA

Solved!
Go to solution

What do you have for the number of samples to read from the DMA?  Hopefully that is not 0 (though, your error description tells me it is set to 0).


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 11 of 23
(722 Views)

Hi I have number of samples as 1000. Please find the images of my VI and waveform chart. I expect a 4Vpp sine wave of 1Khz frequency

Download All
0 Kudos
Message 12 of 23
(721 Views)

At least we have the right general shape now.  Your FPGA can sample at up to 1MS/s.  So with a 1000 samples and one full cycle captured, you are getting 1kHz.  And the amplitude looks correct.

 

You might want to add a wait inside of your FPGA to have a more consistent and known sample rate.  I am thinking a 10us wait should be good, giving you a 100kHz sample rate.

 

What are you using to generate the waveform?  What sample rate is it using?  I am eye balling a sample rate of ~10kHz.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 13 of 23
(718 Views)

Yes we have the proper amplitude and wave. I have added the wait in my FPGA, but that didn't seem to improve my output. How do I get a smoother sine wave? I also wanted to increase the range of x axis to get a clearer waveform. How do we do that?

I am using a sine wave generator AFG 3021B with sample rate 250MS/s.

 

0 Kudos
Message 14 of 23
(713 Views)

@pratikpade wrote:

I also wanted to increase the range of x axis to get a clearer waveform. How do we do that?


Increase the history of your chart.  Right-click on the chart and choose "Chart History Length".  The default is 1024 samples.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 15 of 23
(709 Views)

@pratikpade wrote:

How do I get a smoother sine wave?


Please attach your entire project. I am talking the project file, target VI, and host VI.  I cannot debug anymore with pictures.  I need actual code and environment.

 

My latest observation is that the read waveform only has integer values.  So I think you have a really bad FXP configuration for your DMA FIFO, which is causing the decimal places to be truncated/rounded off.  More evidence of this shows up in the Target VI since there is a coercion dot going into the DMA Write node.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 16 of 23
(705 Views)

I tried changing the FIFO data type to u32 which gave me a square wave. Also I tried using the "Get number of elements" method but I was not able to place it correctly.

Please find the attached project as well as the VIs.

 

Please refer to Vis:

Host: test_6_22_part2(HOST).vi

Target:test_6_22.vi

 

Thank You

 

P.S: I would like to apologize in advance for the excess VIs in the project and bad designing of VIs.

Download All
0 Kudos
Message 17 of 23
(700 Views)

@pratikpade wrote:

I tried changing the FIFO data type to u32 which gave me a square wave.


Yeah, that is definitely not going to work.  The data type of the DMA should match exactly the FXP configuration of the AI node or a SGL.

 

I am away from the office, but I can look at your code in the morning.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 18 of 23
(693 Views)

Thank You for your efforts. By that time I will keep trying and let you know if I can get something.

0 Kudos
Message 19 of 23
(690 Views)

Yep, I just confirmed what I thought was happening.  The FXP settings for your DMA currently has a resolution of 1.  So any decimal places are going to get truncated or rounded.  My suggestion is to just make the DMA data type be a SGL, which is a floating type that is now supported by LabVIEW FPGA.  This is also a data type that can be wired straight into your chart.


GCentral
There are only two ways to tell somebody thanks: Kudos and Marked Solutions
Unofficial Forum Rules and Guidelines
"Not that we are sufficient in ourselves to claim anything as coming from us, but our sufficiency is from God" - 2 Corinthians 3:5
0 Kudos
Message 20 of 23
(678 Views)