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).
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.
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.
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.
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.
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:
P.S: I would like to apologize in advance for the excess VIs in the project and bad designing of VIs.
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.
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.