Jump to content
  • 0

How to program correctly the FFT 9.1 blocks with Cordic Atan to obtain the magnitude and frequency of a signal ADC?


totobL

Question

Hi! I need to implement a real-time DFFT on an FPGA to obtain the frequency spectrum of a current signal. I'm new in the use of Vivado and FPGA implementation. Instead of using directly Vivado Software (version 2021.2) I used Simulink (Matlab 2020b), since, it is more intuitive for me. I have read the FFTCORE 9.1 manual to understand how the configuration works  (https://www.xilinx.com/support/documents/ip_documentation/xfft/v9_1/pg109-xfft.pdf) and I have been working with a simulation that found on YouTube, which I modified to make it a little simpler (I attach the file I made). 

4.thumb.png.02dde0b265d9e139c0c2d046585fd790.png

However, I have had problems with being able to correctly find the magnitude and phase of the test signal. I don't know why the magnitude of the two frequencies found is the same.

How should I configure the blocks so that the magnitudes displayed are correct?

This is the spectrum obtained by the simulink application (powergui, not for vivado application), although, this is the signal before inserting the binary dot , 

1.thumb.png.f5c753d6c83ede37682655a6e124332d.png

but, i have this graphics from fft and cordic core

2.thumb.png.638d86e9951c98708fadeaa2a2472f15.png

Where the magnitude obtained for one memory cycle

3.thumb.png.8499fba4c2f71c45723d6c08dd8f3d43.png

The frequency shown is fine, both are 1000 and 9000 Hz but the magnitudes do not have to be the same and their values do not have much to do with the amplitude of the signal.  

Can someone here give me a hand? I'm new to this world of FPGA.

-The sample time of the simulation is 1.25 us.  

-The ADC sample time is 100 us. 

-The input data type used in the FFT real and imaginary part is Fix16_15 and the imaginary input is a constant 0. 

The configuration of the blocks are:

FFT core:

5.png.95c0a8fb38ae0c1aaf10d7d1756a3f94.png

6.png.f94b379039b4eca9a98e979cfb37f2d0.png

7.png.edec13be5a1b8ee4a623e6c729bd07b5.png

 

 CORDIC ATAN:

8.png.ab79fdf6d30c59ba5ba4a518b7ef9231.png

In this part, I calculate the Data Width whit this:

9.thumb.png.1b4f2cd469f109f5a7ca269fdc2d1ae4.png

As the FFT configuration is Unscaled: 

Bxk = 16 + log_2(4096) + 1 = 29   

And I assumed that the binary point was located the same as in the input.

I don't know what could be wrong. I've been thinking about it several times, until I decided to consult here. 
Any advice on how to configure it correctly?

Sorry If something is not understood or is not good write, I am using translator to write this message. 

PD: The video that I used as an example is as follows:

 

 

 

 

FFT_example_v6.slx fft_script_example.m

Edited by totobL
was not well written
Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 0

Update:
It seems to me that I found the answer to why the magnitude of 9000Hz is the same as 1000Hz, reading in the other Xlinix FFT block the instructions say that the maximum frequency that it can calculate correctly is that of sampling/2, therefore, That makes me suppose that the frequencies greater than that are found but with wrong magnitudes.

10.thumb.png.0afbe8509b6569d1235db3f0e17cd5b8.png

 

I tested with a 40Khz sample time and a different signal ADC and obtained this spectrum:

11.thumb.png.7964f0205dd1f4ec00e57e15ff237e73.png}

Here you can clearly see how the magnitudes are repeated at the beginning and end of the memory cycle. But if I calculate the frequencies and compare them with the simulink spectrum I realize that the frequencies are the same.

12.thumb.png.0247e4041f91bd92e7518e85bb3874aa.png

Now this still solves my main problem, which is obtaining magnitude and phase values correctly. In case anyone knows, though, I have a suspicion that it is due to the formatting of the output data width with the binary point in Cordic Atan or something similar in some other block.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...