UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Explorer
Explorer
8,422 Views
Registered: ‎02-18-2013

FFT IP

Hello,

 

I try to use th FFT IP-Core with an AXI Stream FIFO:

 

Unbenannt.png

 

Accessing the FIFO works very well and now I try to put some data into the FFT Core.
In the first I use a squarewave function with 128 Samples and 50% duty cycle (see Matlap example)

 

Unbenannt1.png

I write a small programm to fill a array with the data of the sqarewave and start the code. Not I get this results:

 

Daten 1: 64
Daten 2: 0
Daten 3: 0
Daten 4: 0
Daten 5: 0
Daten 6: 0
Daten 7: 0
Daten 8: 0
Daten 9: 0
Daten 10: 0
Daten 11: 0
Daten 12: 0
Daten 13: 0
Daten 14: 0
Daten 15: 0
Daten 16: 0
Daten 17: 0
Daten 18: 0
Daten 19: 0
Daten 20: 0
Daten 21: 0
Daten 22: 0
Daten 23: 0
Daten 24: 0
Daten 25: 0
Daten 26: 0
Daten 27: 0
Daten 28: 0
Daten 29: 0
Daten 30: 0
Daten 31: 0
Daten 32: 0
Daten 33: 2097153
Daten 34: 0
Daten 35: 0
Daten 36: 0
Daten 37: -65535
Daten 38: -1
Daten 39: -65536
Daten 40: -65537
Daten 41: 262147
Daten 42: -65536
Daten 43: -65534
Daten 44: -65537
Daten 45: -65535
Daten 46: -65537
Daten 47: -65535
Daten 48: -196609
Daten 49: 131075
Daten 50: -65536
Daten 51: -65534
Daten 52: -65537
Daten 53: -131071
Daten 54: -131074
Daten 55: -65535
Daten 56: -458756
Daten 57: 131073
Daten 58: -65536
Daten 59: 65537
Daten 60: -65536
Daten 61: 1
Daten 62: -196608
Daten 63: -65535
Daten 64: -1114114
Daten 65: 0
Daten 66: 0
Daten 67: 0
Daten 68: 0
Daten 69: 0
Daten 70: 0
Daten 71: 0
Daten 72: 0
Daten 73: 0
Daten 74: 0
Daten 75: 0
Daten 76: 0
Daten 77: 0
Daten 78: 0
Daten 79: 0
Daten 80: 0
Daten 81: 0
Daten 82: 0
Daten 83: 0
Daten 84: 0
Daten 85: 0
Daten 86: 0
Daten 87: 0
Daten 88: 0
Daten 89: 0
Daten 90: 0
Daten 91: 0
Daten 92: 0
Daten 93: 0
Daten 94: 0
Daten 95: 0
Daten 96: 0
Daten 97: 655361
Daten 98: -65536
Daten 99: 0
Daten 100: 0
Daten 101: -65535
Daten 102: -65537
Daten 103: -65535
Daten 104: -196610
Daten 105: 262145
Daten 106: -65536
Daten 107: 1
Daten 108: -65536
Daten 109: 1
Daten 110: -196608
Daten 111: -65535
Daten 112: -327682
Daten 113: 131073
Daten 114: -65536
Daten 115: 65537
Daten 116: -65536
Daten 117: 1
Daten 118: -196608
Daten 119: -65535
Daten 120: -589826
Daten 121: 131073
Daten 122: -65536
Daten 123: 65537
Daten 124: -65535
Daten 125: 1
Daten 126: -196608
Daten 127: 1
Daten 128: -2752511

  

It doesn´t look right...Matlab deliver this results:

 

Frequenz =
Columns 1 through 12
64.0000 40.7478 0 13.5935 0 8.1692 0 5.8493 0 4.5641 0 3.7494
Columns 13 through 24
0 3.1879 0 2.7786 0 2.4677 0 2.2241 0 2.0288 0 1.8692
Columns 25 through 36
0 1.7367 0 1.6254 0 1.5310 0 1.4502 0 1.3807 0 1.3206
Columns 37 through 48
0 1.2685 0 1.2231 0 1.1836 0 1.1493 0 1.1195 0 1.0938
Columns 49 through 60
0 1.0718 0 1.0532 0 1.0376 0 1.0249 0 1.0149 0 1.0076
Columns 61 through 72
0 1.0027 0 1.0003 0 1.0003 0 1.0027 0 1.0076 0 1.0149
Columns 73 through 84
0 1.0249 0 1.0376 0 1.0532 0 1.0718 0 1.0938 0 1.1195
Columns 85 through 96
0 1.1493 0 1.1836 0 1.2231 0 1.2685 0 1.3206 0 1.3807
Columns 97 through 108
0 1.4502 0 1.5310 0 1.6254 0 1.7367 0 1.8692 0 2.0288
Columns 109 through 120
0 2.2241 0 2.4677 0 2.7786 0 3.1879 0 3.7494 0 4.5641
Columns 121 through 128
0 5.8493 0 8.1692 0 13.5935 0 40.7478

 

 

I don´t have any idea what my misstake is. 
Did I use the FFT Core wrong?

 

Thank you for help!

 

0 Kudos
14 Replies
Teacher muzaffer
Teacher
8,399 Views
Registered: ‎03-31-2012

Re: FFT IP

what is the format of the data fft is expecting? actually regardless of the actual format, the data you are sending 0x1 is too small. you need to figure out what '1' is in fft format and fill the fifo array with that bit vector.
- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Explorer
Explorer
8,388 Views
Registered: ‎02-18-2013

Re: FFT IP

Hello,

 

thank you.

I read the manual yesterday. I configure the FFT Core for floating point now, so I have to change the format of the Input and Output Buffer to float.

I also change the amplitude of the sqareqave to 5 (for a simple 5V sqarewave):

 

for(Zaehler = 0; Zaehler < ANZAHL_PAKETE; Zaehler++)
{
	SendBuffer[Zaehler] = 0;
}
for(Zaehler = 0; Zaehler < ANZAHL_PAKETE/2; Zaehler++)
{
	SendBuffer[Zaehler] = 5.0;
}

 Now I got this results:

 

Daten 1: 320.000000
Daten 2: 0.000000
Daten 3: 0.000000
Daten 4: 0.000000
Daten 5: 0.000000
Daten 6: 0.000000
Daten 7: 0.000000
Daten 8: 0.000000
Daten 9: 0.000000
Daten 10: 0.000000
Daten 11: 0.000000
Daten 12: 0.000000
Daten 13: 0.000000
Daten 14: 0.000000
Daten 15: 0.000000
Daten 16: 0.000000
Daten 17: 0.000000
Daten 18: 0.000000
Daten 19: 0.000000
Daten 20: 0.000000
Daten 21: 0.000000
Daten 22: 0.000000
Daten 23: 0.000000
Daten 24: 0.000000
Daten 25: 0.000000
Daten 26: 0.000000
Daten 27: 0.000000
Daten 28: 0.000000
Daten 29: 0.000000
Daten 30: 0.000000
Daten 31: 0.000000
Daten 32: 0.000000
Daten 33: 5.000011
Daten 34: 4.999992
Daten 35: 4.999992
Daten 36: 4.999996
Daten 37: 4.999996
Daten 38: 4.999996
Daten 39: 5.000000
Daten 40: 5.000000
Daten 41: 5.000000
Daten 42: 4.999996
Daten 43: 5.000000
Daten 44: 4.999996
Daten 45: 4.999996
Daten 46: 4.999996
Daten 47: 5.000000
Daten 48: 4.999996
Daten 49: 4.999992
Daten 50: 4.999996
Daten 51: 4.999996
Daten 52: 5.000000
Daten 53: 4.999996
Daten 54: 5.000000
Daten 55: 5.000000
Daten 56: 5.000004
Daten 57: 4.999996
Daten 58: 5.000000
Daten 59: 5.000000
Daten 60: 4.999996
Daten 61: 5.000000
Daten 62: 5.000000
Daten 63: 4.999996
Daten 64: 4.999996
Daten 65: 0.000000
Daten 66: 0.000000
Daten 67: 0.000000
Daten 68: 0.000000
Daten 69: 0.000000
Daten 70: 0.000000
Daten 71: 0.000000
Daten 72: 0.000000
Daten 73: 0.000000
Daten 74: 0.000000
Daten 75: 0.000000
Daten 76: 0.000000
Daten 77: 0.000000
Daten 78: 0.000000
Daten 79: 0.000000
Daten 80: 0.000000
Daten 81: 0.000000
Daten 82: 0.000000
Daten 83: 0.000000
Daten 84: 0.000000
Daten 85: 0.000000
Daten 86: 0.000000
Daten 87: 0.000000
Daten 88: 0.000000
Daten 89: 0.000000
Daten 90: 0.000000
Daten 91: 0.000000
Daten 92: 0.000000
Daten 93: 0.000000
Daten 94: 0.000000
Daten 95: 0.000000
Daten 96: 0.000000
Daten 97: 4.999996
Daten 98: 4.999996
Daten 99: 5.000000
Daten 100: 4.999996
Daten 101: 5.000000
Daten 102: 4.999996
Daten 103: 5.000000
Daten 104: 4.999996
Daten 105: 5.000004
Daten 106: 4.999996
Daten 107: 5.000000
Daten 108: 4.999996
Daten 109: 5.000000
Daten 110: 4.999992
Daten 111: 4.999996
Daten 112: 4.999992
Daten 113: 4.999996
Daten 114: 4.999996
Daten 115: 4.999996
Daten 116: 4.999996
Daten 117: 5.000000
Daten 118: 4.999996
Daten 119: 4.999996
Daten 120: 5.000000
Daten 121: 5.000000
Daten 122: 4.999996
Daten 123: 4.999996
Daten 124: 4.999996
Daten 125: 5.000000
Daten 126: 4.999992
Daten 127: 4.999992
Daten 128: 5.000011

The first result is the same as with matlab....but all other results looking strange. :/

 

0 Kudos
Explorer
Explorer
8,339 Views
Registered: ‎02-18-2013

Re: FFT IP

Has no one an idea or an example :(?

0 Kudos
Teacher muzaffer
Teacher
8,334 Views
Registered: ‎03-31-2012

Re: FFT IP

try to simulate the block diagram rtl by itself and see if you can get the fft running. 

- Please mark the Answer as "Accept as solution" if information provided is helpful.
Give Kudos to a post which you think is helpful and reply oriented.
0 Kudos
Explorer
Explorer
8,317 Views
Registered: ‎02-18-2013

Re: FFT IP

Ok I will do that.
Do you have any example or description for an AXI Stream Testbench? Or has the Core a build in Testbench or something like that?

0 Kudos
Xilinx Employee
Xilinx Employee
8,208 Views
Registered: ‎08-02-2011

Re: FFT IP

Yes, the FFT core comes with a demo testbench when you generate it.
www.xilinx.com
0 Kudos
Explorer
Explorer
8,199 Views
Registered: ‎02-18-2013

Re: FFT IP

Hello,

 

great. That is fine. Can you please give me a link with more informations (if you have) :)?

0 Kudos
Xilinx Employee
Xilinx Employee
8,197 Views
Registered: ‎07-11-2011

Re: FFT IP

Hi,

 

Please go through Chapter-6 of below link

http://www.xilinx.com/support/documentation/ip_documentation/xfft/v9_0/pg109-xfft.pdf

---------------------------------------------------------------------------------------------
Please do google search before posting, you may find relavant information.
Mark the post - "Accept as solution" and give kudos if information provided is helpful and reply oriented
0 Kudos
Explorer
Explorer
8,184 Views
Registered: ‎02-18-2013

Re: FFT IP

Hello,

 

ok, I take a look on that Testbench and I found a error in my design.

The FFT Core has a FWD_INV Signal Input which has to be set in the configuration channel for a forward FFT. In my first try the core calculates a inverse fft, because the signal isn´t set to 1.

Now I have a new question:

I connect my FFT Core over an AXI FIFO to my PS. This AXI FIFO has a configuration channel (AXI4 Stream Transmit Control).
Can I use this configuration channel to configure my FFT Core? 

0 Kudos
Explorer
Explorer
5,976 Views
Registered: ‎02-18-2013

Re: FFT IP

Hello,

 

I work a little bit on my code for the FFT Core.
I have added a second FIFO to configure the FFT Core and test it again with this code:

 

/*******************************************************************************/
/*                                H E A D E R                                  */
/*******************************************************************************/
// File Name            : main.c
// Author               : Daniel Kampert
// Modified by          :
// Processor            : ARM Cortex-A9
// Evaluation Board     : Zybo
// Date                 : 25-12-2014

/*******************************************************************************/
/*                     U P D A T E   I N F O R M A T I O N                     */
/*******************************************************************************/

// Date             Changes
// -----------------------------------------------------------------------------
//


/*******************************************************************************/
/*                             I N C L U D E S                                 */
/*******************************************************************************/

#include "xparameters.h"
#include "Interrupt.h"
#include "IO.h"
#include "Timer.h"
#include "XADC.h"
#include "TTC.h"
#include "FIFO.h"
#include "math.h"

/*******************************************************************************/
/*                             D E F I N E S                                   */
/*******************************************************************************/

#define  			SAMPLE 			128

/*******************************************************************************/
/*                    F U N C T I O N   D E C L A R A T I O N S                */
/*******************************************************************************/

/*******************************************************************************/
/*                        G L O B A L   V A R I A B L E S                      */
/*******************************************************************************/

u32 				Eingang 		= 0;
u32 				Status 			= 0;
u32 				Zaehler 		= 0;
u32					Sample			= 0;
u32					Capture			= 0;
u32					Timervalue		= 0;
u32					Counter			= 0;

u32					FFT_Config[1] = {0x00};
float				FFT_Data;

/*******************************************************************************/
/*                             I N S T A N C E S                               */
/*******************************************************************************/


/*******************************************************************************/
/*                                   M A I N                                   */
/*******************************************************************************/

int main (void)
{
	printf("\n");
	printf("--Programmstart--\n");
	printf("\n");

	// Konfiguration fuer die FFT
	FFT_Config[0] = 0x10000;

	// FIFO initialisieren
	Setup_Fifo(&Fifo_0, FIFO_0);
	Setup_Fifo(&Fifo_1, FIFO_1);

	// Buffer mit Daten fuellen
	printf("Buffer fuellen...\n");
	for(Zaehler = 0; Zaehler < SAMPLE; Zaehler++)
	{
		SendBuffer[Zaehler] = 5*cos(2.0*3.14*((float)Zaehler/128));
	}

	printf("FFT Core konfigurieren...\n");
	Status = SendToBuffer(&Fifo_1, FFT_Config, 1);
    printf("Konfiguration abgeschlossen!\n");

	printf("Zum Buffer 1 senden...\n");
	Status = SendToBuffer(&Fifo_0, SendBuffer, SAMPLE);
	printf("Senden abgeschlossen!\n");

	printf("Vom Buffer 1 empfangen...\n");
	Status = ReadFromBuffer(&Fifo_0, RecieveBuffer);
	printf("Empfangen abgeschlossen!\n");

	// Empfangene Daten ausgeben
	for(Zaehler = 0; Zaehler < SAMPLE; Zaehler++)
	{
		printf("Daten %i: %f\n", (Zaehler + 1), RecieveBuffer[Zaehler]);
	}


	while(1)
	{
		sleep(1);
	}
}

I use a Cosinewave with a Amplitude of 5 for a first test and I have to configure the FFT Core for a forward FFT (writing to the Config-Channel).

I got this results:

 

Buffer fuellen...
FFT Core konfigurieren...
Konfiguration abgeschlossen!
Zum Buffer 1 senden...
Senden abgeschlossen!
Vom Buffer 1 empfangen...
Empfangen abgeschlossen!
Daten 1: -0.324543
Daten 2: 0.000206
Daten 3: 0.001350
Daten 4: 0.000240
Daten 5: 0.000404
Daten 6: 0.000404
Daten 7: 0.000240
Daten 8: 0.001347
Daten 9: 0.021694
Daten 10: 0.000206
Daten 11: 0.000893
Daten 12: 0.000263
Daten 13: 0.000336
Daten 14: 0.000496
Daten 15: 0.000225
Daten 16: 0.002342
Daten 17: 0.005222
Daten 18: 0.000214
Daten 19: 0.000641
Daten 20: 0.000294
Daten 21: 0.000294
Daten 22: 0.000641
Daten 23: 0.000214
Daten 24: 0.005222
Daten 25: 0.002342
Daten 26: 0.000221
Daten 27: 0.000500
Daten 28: 0.000336
Daten 29: 0.000263
Daten 30: 0.000893
Daten 31: 0.000210
Daten 32: 0.021694
Daten 33: 319.918396
Daten 34: 0.000198
Daten 35: 0.001202
Daten 36: 0.000248
Daten 37: 0.000381
Daten 38: 0.000423
Daten 39: 0.000240
Daten 40: 0.001522
Daten 41: 0.013584
Daten 42: 0.000210
Daten 43: 0.000816
Daten 44: 0.000267
Daten 45: 0.000324
Daten 46: 0.000526
Daten 47: 0.000221
Daten 48: 0.002777
Daten 49: 0.004131
Daten 50: 0.000217
Daten 51: 0.000603
Daten 52: 0.000301
Daten 53: 0.000286
Daten 54: 0.000694
Daten 55: 0.000214
Daten 56: 0.006832
Daten 57: 0.002010
Daten 58: 0.000225
Daten 59: 0.000473
Daten 60: 0.000351
Daten 61: 0.000256
Daten 62: 0.000977
Daten 63: 0.000210
Daten 64: 0.040596
Daten 65: 0.108131
Daten 66: 0.000206
Daten 67: 0.001080
Daten 68: 0.000248
Daten 69: 0.000366
Daten 70: 0.000446
Daten 71: 0.000229
Daten 72: 0.001740
Daten 73: 0.009338
Daten 74: 0.000214
Daten 75: 0.000751
Daten 76: 0.000275
Daten 77: 0.000313
Daten 78: 0.000561
Daten 79: 0.000217
Daten 80: 0.003349
Daten 81: 0.003353
Daten 82: 0.000217
Daten 83: 0.000561
Daten 84: 0.000313
Daten 85: 0.000275
Daten 86: 0.000751
Daten 87: 0.000210
Daten 88: 0.009338
Daten 89: 0.001740
Daten 90: 0.000229
Daten 91: 0.000446
Daten 92: 0.000366
Daten 93: 0.000248
Daten 94: 0.001080
Daten 95: 0.000206
Daten 96: 0.108131
Daten 97: 0.040596
Daten 98: 0.000210
Daten 99: 0.000977
Daten 100: 0.000256
Daten 101: 0.000351
Daten 102: 0.000469
Daten 103: 0.000225
Daten 104: 0.002007
Daten 105: 0.006832
Daten 106: 0.000214
Daten 107: 0.000698
Daten 108: 0.000286
Daten 109: 0.000305
Daten 110: 0.000603
Daten 111: 0.000217
Daten 112: 0.004128
Daten 113: 0.002781
Daten 114: 0.000217
Daten 115: 0.000530
Daten 116: 0.000324
Daten 117: 0.000271
Daten 118: 0.000816
Daten 119: 0.000210
Daten 120: 0.013584
Daten 121: 0.001522
Daten 122: 0.000237
Daten 123: 0.000423
Daten 124: 0.000381
Daten 125: 0.000248
Daten 126: 0.001202
Daten 127: 0.000198
Daten 128: 319.918396

I don´t understand why the 32th result is 319.918396 (Daten 33). 
Normaly I should get a peak of ~320 at  result 1 and N-1 (127).

Hope somebody can help me :)
Thank you very much

0 Kudos
Explorer
Explorer
5,939 Views
Registered: ‎02-18-2013

Re: FFT IP

Nobody an idea :(?

0 Kudos
Xilinx Employee
Xilinx Employee
5,904 Views
Registered: ‎08-02-2011

Re: FFT IP

Mein deutsch ist schrecklich! Ich koenne deine Kommentar nicht gelesen.

 

I'd recommend probing the input and output of the FFT using Vivado Logic Analyzer. Bring that into matlab and compare.

www.xilinx.com
0 Kudos
Explorer
Explorer
5,860 Views
Registered: ‎02-18-2013

Re: FFT IP

Hello,

 

I´ve got the FFT Core working (in the simulation). Now I try to use him with the PS.
For this I write a small programm:

 

/*******************************************************************************/
/*                                H E A D E R                                  */
/*******************************************************************************/
// File Name            : main.c
// Author               : Daniel Kampert
// Modified by          :
// Processor            : ARM Cortex-A9
// Evaluation Board     : Zybo
// Date                 : 25-12-2014

/*******************************************************************************/
/*                     U P D A T E   I N F O R M A T I O N                     */
/*******************************************************************************/

// Date             Changes
// -----------------------------------------------------------------------------
//


/*******************************************************************************/
/*                             I N C L U D E S                                 */
/*******************************************************************************/

#include "xparameters.h"
#include "FIFO.h"
#include "math.h"

/*******************************************************************************/
/*                             D E F I N E S                                   */
/*******************************************************************************/

/*******************************************************************************/
/*                    F U N C T I O N   D E C L A R A T I O N S                */
/*******************************************************************************/

/*******************************************************************************/
/*                        G L O B A L   V A R I A B L E S                      */
/*******************************************************************************/

u32 				Status 			= 0;
u32 				Zaehler 		= 0;

/*******************************************************************************/
/*                             I N S T A N C E S                               */
/*******************************************************************************/


/*******************************************************************************/
/*                                   M A I N                                   */
/*******************************************************************************/

int main (void)
{
	int Config = 1;

	Setup_Fifo(&Fifo_0, FIFO_0);
	Setup_Fifo(&Fifo_1, FIFO_1);

	printf("\n");
	printf("--Let´s go...--\n");
	printf("\n");

	printf("Generating Sample...\n");
	for(Zaehler = 0; Zaehler < ANZAHL_PAKETE; Zaehler++)
	{
		SendBuffer[Zaehler] = sin(2 * M_PI *Zaehler/ANZAHL_PAKETE);
		printf("Input %i: %f\n", (Zaehler + 1), SendBuffer[Zaehler]);
	}

	printf("Sending Configuration to FFT Core...\n");
	Status = SendToBuffer(&Fifo_1, Config, 1);
	printf("Configuration successful!\n");

	printf("Sending Sample...\n");
	Status = SendToBuffer(&Fifo_0, SendBuffer, ANZAHL_PAKETE);
	printf("Sending Sample complete!\n");

	printf("Receive Data...\n");
	Status = ReadFromBuffer(&Fifo_0, RecieveBuffer);
	printf("Receive Data successful!\n");

	for(Zaehler = 0; Zaehler < ANZAHL_PAKETE; Zaehler++)
	{
		printf("Output %i: %f\n", (Zaehler + 1), RecieveBuffer[Zaehler]);
	}
}

 FIFO.h:

/*
 * FIFO.h
 *
 *  Created on: 28.12.2014
 *      Author: Daniel
 */

#ifndef FIFO_H_
#define FIFO_H_

/*******************************************************************************/
/*                             I N C L U D E S                                 */
/*******************************************************************************/

#include "xllfifo.h"

/*******************************************************************************/
/*                             D E F I N E S                                   */
/*******************************************************************************/

#define FIFO_0				XPAR_AXI_FIFO_MM_S_0_DEVICE_ID
#define FIFO_1				XPAR_AXI_FIFO_MM_S_1_DEVICE_ID

#define ANZAHL_PAKETE 		64
#define PAKET_WIDTH 		4

/*******************************************************************************/
/*                    F U N C T I O N   D E C L A R A T I O N S                */
/*******************************************************************************/

int Setup_Fifo				(XLlFifo *Fifo, u32 ID);

int SendToBuffer			(XLlFifo *pFifo, u32 *Quelle, u32 Anzahl);
int ReadFromBuffer			(XLlFifo *InstancePtr, u32 *Ziel);

/*******************************************************************************/
/*                        G L O B A L   V A R I A B L E S                      */
/*******************************************************************************/

XLlFifo_Config 				*Config_Fifo 	= NULL;

float 						SendBuffer[ANZAHL_PAKETE];
float 						RecieveBuffer[ANZAHL_PAKETE];

/*******************************************************************************/
/*                             I N S T A N C E S                               */
/*******************************************************************************/

XLlFifo 					Fifo_0;
XLlFifo 					Fifo_1;

/*******************************************************************************/
/*                             F U N C T I O N S	                           */
/*******************************************************************************/

int Setup_Fifo(XLlFifo *Fifo, u32 ID)
{
	return XLlFifo_CfgInitialize(Fifo, XLlFfio_LookupConfig(ID), XLlFfio_LookupConfig(ID)->BaseAddress);
}

int SendToBuffer(XLlFifo *pFifo, u32 *Quelle, u32 Anzahl)
{
	int Paket;

	for(Paket = 0; Paket < Anzahl; Paket++)
	{
		// Daten in Buffer kopieren, wenn Platz vorhanden
		if(XLlFifo_iTxVacancy(pFifo))
		{
			XLlFifo_TxPutWord(pFifo, *(Quelle + Paket));
		}
	}

	// Übertragung starten
	XLlFifo_iTxSetLen(pFifo, Anzahl * PAKET_WIDTH);

	// Warten bis Übertragung beendet ist
	while(!(XLlFifo_IsTxDone(pFifo)));

	return 0;
}

int ReadFromBuffer(XLlFifo *pFifo, u32 *Ziel)
{
	int Laenge = 0;
	int Byte = 0;
	u32 Buffer;

	Laenge = XLlFifo_iRxGetLen(pFifo) / PAKET_WIDTH;

	for(Byte = 0; Byte < Laenge; Byte++)
	{
		Buffer = XLlFifo_RxGetWord(pFifo);
		*(Ziel + Byte) = Buffer;
	}

	return Laenge;
}

#endif /* FIFO_H_ */

 I send a sine wave to the FFT Core (same as in the simulation) and I got this output:

--Let´s go...--

Generating Sample...
Input 1: 0.000000
Input 2: 0.098017
Input 3: 0.195090
Input 4: 0.290285
Input 5: 0.382683
Input 6: 0.471397
Input 7: 0.555570
Input 8: 0.634393
Input 9: 0.707107
Input 10: 0.773010
Input 11: 0.831470
Input 12: 0.881921
Input 13: 0.923880
Input 14: 0.956940
Input 15: 0.980785
Input 16: 0.995185
Input 17: 1.000000
Input 18: 0.995185
Input 19: 0.980785
Input 20: 0.956940
Input 21: 0.923880
Input 22: 0.881921
Input 23: 0.831470
Input 24: 0.773010
Input 25: 0.707107
Input 26: 0.634393
Input 27: 0.555570
Input 28: 0.471397
Input 29: 0.382683
Input 30: 0.290285
Input 31: 0.195090
Input 32: 0.098017
Input 33: 0.000000
Input 34: -0.098017
Input 35: -0.195090
Input 36: -0.290285
Input 37: -0.382683
Input 38: -0.471397
Input 39: -0.555570
Input 40: -0.634393
Input 41: -0.707107
Input 42: -0.773010
Input 43: -0.831470
Input 44: -0.881921
Input 45: -0.923880
Input 46: -0.956940
Input 47: -0.980785
Input 48: -0.995185
Input 49: -1.000000
Input 50: -0.995185
Input 51: -0.980785
Input 52: -0.956940
Input 53: -0.923880
Input 54: -0.881921
Input 55: -0.831470
Input 56: -0.773010
Input 57: -0.707107
Input 58: -0.634393
Input 59: -0.555570
Input 60: -0.471397
Input 61: -0.382683
Input 62: -0.290285
Input 63: -0.195090
Input 64: -0.098017
Sending Configuration to FFT Core...
Configuration successful!
Sending Sample...
Sending Sample complete!
Receive Data...
Receive Data successful!
Output 1: 0.000000
Output 2: 0.000000
Output 3: 0.000000
Output 4: 0.000000
Output 5: 0.000000
Output 6: 0.000000
Output 7: 0.000000
Output 8: 0.000000
Output 9: 0.000000
Output 10: 0.000000
Output 11: 0.000000
Output 12: 0.000000
Output 13: 0.000000
Output 14: 0.000000
Output 15: 0.000000
Output 16: 0.000000
Output 17: 0.000001
Output 18: -0.000001
Output 19: -0.000000
Output 20: 0.000000
Output 21: 0.000000
Output 22: -0.000000
Output 23: 0.000000
Output 24: -0.000000
Output 25: -0.000001
Output 26: -0.000000
Output 27: 0.000000
Output 28: 0.000000
Output 29: 0.000000
Output 30: 0.000000
Output 31: 0.000000
Output 32: -0.000001
Output 33: 0.000000
Output 34: 0.000000
Output 35: 0.000000
Output 36: 0.000000
Output 37: 0.000000
Output 38: 0.000000
Output 39: 0.000000
Output 40: 0.000000
Output 41: 0.000000
Output 42: 0.000000
Output 43: 0.000000
Output 44: 0.000000
Output 45: 0.000000
Output 46: 0.000000
Output 47: 0.000000
Output 48: 0.000000
Output 49: -0.000000
Output 50: 0.000000
Output 51: 0.000000
Output 52: 0.000000
Output 53: 0.000001
Output 54: 0.000000
Output 55: -0.000000
Output 56: -0.000001
Output 57: -0.000000
Output 58: 0.000000
Output 59: 0.000000
Output 60: -0.000000
Output 61: 0.000000
Output 62: -0.000000
Output 63: -0.000001
Output 64: 0.000001

 If I use a cosine wave I get this:

 


--Let´s go...--

Generating Sample...
Input 1: 1.000000
Input 2: 0.995185
Input 3: 0.980785
Input 4: 0.956940
Input 5: 0.923880
Input 6: 0.881921
Input 7: 0.831470
Input 8: 0.773010
Input 9: 0.707107
Input 10: 0.634393
Input 11: 0.555570
Input 12: 0.471397
Input 13: 0.382683
Input 14: 0.290285
Input 15: 0.195090
Input 16: 0.098017
Input 17: 0.000000
Input 18: -0.098017
Input 19: -0.195090
Input 20: -0.290285
Input 21: -0.382683
Input 22: -0.471397
Input 23: -0.555570
Input 24: -0.634393
Input 25: -0.707107
Input 26: -0.773010
Input 27: -0.831470
Input 28: -0.881921
Input 29: -0.923880
Input 30: -0.956940
Input 31: -0.980785
Input 32: -0.995185
Input 33: -1.000000
Input 34: -0.995185
Input 35: -0.980785
Input 36: -0.956940
Input 37: -0.923880
Input 38: -0.881921
Input 39: -0.831470
Input 40: -0.773010
Input 41: -0.707107
Input 42: -0.634393
Input 43: -0.555570
Input 44: -0.471397
Input 45: -0.382683
Input 46: -0.290285
Input 47: -0.195090
Input 48: -0.098017
Input 49: -0.000000
Input 50: 0.098017
Input 51: 0.195090
Input 52: 0.290285
Input 53: 0.382683
Input 54: 0.471397
Input 55: 0.555570
Input 56: 0.634393
Input 57: 0.707107
Input 58: 0.773010
Input 59: 0.831470
Input 60: 0.881921
Input 61: 0.923880
Input 62: 0.956940
Input 63: 0.980785
Input 64: 0.995185
Sending Configuration to FFT Core...
Configuration successful!
Sending Sample...
Sending Sample complete!
Receive Data...
Receive Data successful!
Output 1: 0.000000
Output 2: 0.000000
Output 3: 0.000000
Output 4: 0.000000
Output 5: 0.000000
Output 6: 0.000000
Output 7: 0.000000
Output 8: 0.000000
Output 9: 0.000000
Output 10: 0.000000
Output 11: 0.000000
Output 12: 0.000000
Output 13: 0.000000
Output 14: 0.000000
Output 15: 0.000000
Output 16: 0.000000
Output 17: 32.000000
Output 18: 0.000000
Output 19: -0.000001
Output 20: 0.000000
Output 21: -0.000000
Output 22: -0.000000
Output 23: 0.000000
Output 24: 0.000000
Output 25: 0.000000
Output 26: 0.000000
Output 27: 0.000000
Output 28: 0.000000
Output 29: 0.000000
Output 30: -0.000000
Output 31: -0.000000
Output 32: -0.000001
Output 33: 0.000000
Output 34: 0.000000
Output 35: 0.000000
Output 36: 0.000000
Output 37: 0.000000
Output 38: 0.000000
Output 39: 0.000000
Output 40: 0.000000
Output 41: 0.000000
Output 42: 0.000000
Output 43: 0.000000
Output 44: 0.000000
Output 45: 0.000000
Output 46: 0.000000
Output 47: 0.000000
Output 48: 0.000000
Output 49: -0.000001
Output 50: -0.000000
Output 51: -0.000000
Output 52: 0.000000
Output 53: 0.000000
Output 54: 0.000000
Output 55: 0.000000
Output 56: 0.000000
Output 57: 0.000000
Output 58: 0.000000
Output 59: -0.000000
Output 60: -0.000000
Output 61: 0.000000
Output 62: -0.000001
Output 63: 0.000000
Output 64: 32.000000

I don´t understand why the first peak is the 16th input and why I got no results with a sine :(

0 Kudos
Adventurer
Adventurer
283 Views
Registered: ‎09-18-2018

Re: FFT IP

Hi @kampi 

did you solve the problem already? Because I am in front of the same problem!

greetings

0 Kudos