What data type should use in software of fft vivado?

57 Views Asked by At

i have a vivado project of a FFT IP block. My reference is from master thesis (page 44) (Contribution to the development of microwave remote sensing for UAV systems).Since there is no software code, i made it myself. But i dont get any appropiate results from fft. My thoughts is im formating the data wront (FFT_data variable in software below). I made a block diagaramm of data format according from XADC and FFT user guides (see block diagramm below)Any help?data format vivado project

#include <stdio.h>
#include <complex.h>
#include "platform.h"
#include "xil_printf.h"
#include "xil_cache.h"
#include "xsysmon.h"
#include "xaxidma.h"
#include "xparameters.h"

#define SYSMON_DEVICE_ID    XPAR_SYSMON_0_DEVICE_ID
#define DMA_DEV_ID          XPAR_AXIDMA_0_DEVICE_ID

#define FFT_Size 256
//#define MAX_PKT_LEN           (sizeof(int complex) * FFT_Size)
//#define MAX_PKT_LEN           (FFT_Size * sizeof(u32))
//#define MAX_PKT_LEN           (sizeof(float complex) * FFT_Size)
#define MAX_PKT_LEN         (sizeof(double complex) * FFT_Size)
//#define MAX_PKT_LEN           (sizeof(u64) * FFT_Size)
int main() {
XSysMon_Config *SYSConfigPtr;
XSysMon SysMonInstPtr;
XAxiDma_Config *CfgPtr;
XAxiDma AxiDma;
int Status;
int reset_done;
//    float complex FFT_data[FFT_Size];
double complex FFT_data[FFT_Size];
//    int complex FFT_data[FFT_Size];
init_platform();

// XADC Initialization
SYSConfigPtr = XSysMon_LookupConfig(SYSMON_DEVICE_ID);
if (SYSConfigPtr == NULL) {
    return XST_FAILURE;
}
 XSysMon_CfgInitialize(&SysMonInstPtr, SYSConfigPtr, SYSConfigPtr->BaseAddress);

// DMA Initialization
CfgPtr = XAxiDma_LookupConfig(DMA_DEV_ID);
if (!CfgPtr) {
    printf("No config found for %d\r\n", DMA_DEV_ID);
    return XST_FAILURE;
}
Status = XAxiDma_CfgInitialize(&AxiDma, CfgPtr);
if (Status != XST_SUCCESS) {
    printf("Initialization DMA failed %d\r\n", Status);
    return XST_FAILURE;
}

// Reset DMA
XAxiDma_Reset(&AxiDma);
reset_done = XAxiDma_ResetIsDone(&AxiDma);
while (reset_done != 1) {

}
 XSysMon_ResetAdc(&SysMonInstPtr);
 XSysMon_StartAdcConversion(&SysMonInstPtr);


// Flush the cache
Xil_DCacheFlushRange((UINTPTR)FFT_data, MAX_PKT_LEN);

// Start a DMA transfer
XAxiDma_SimpleTransfer(&AxiDma, (UINTPTR)FFT_data, MAX_PKT_LEN, XAXIDMA_DEVICE_TO_DMA);

// Wait for the DMA transfer to complete
while (XAxiDma_Busy(&AxiDma, XAXIDMA_DEVICE_TO_DMA)) {

}

// Invalidate the cache
Xil_DCacheInvalidateRange((UINTPTR)FFT_data, MAX_PKT_LEN);

printf("\n FFT output: \r\n");

for (int i = 0; i < FFT_Size; i++) {
    printf("%f %f\n", creal(FFT_data[i]), cimag(FFT_data[i]));
}



cleanup_platform();
return 0;

}

0

There are 0 best solutions below