Other Parts Discussed in Thread: TMS320F28377D, CONTROLSUITE
Hello, I am trying to use the FFT library on TMS320F28377D.
I have referenced the manual on controlSUITE about RFFT (C:\ti\controlSUITE\libs\dsp\FPU\v1_50_00_00\examples\fft\2837x_rfft)
I already checked ADC data using memory browser.
and then I used memcpy function to copy from ADC memory to RFFTin1Buff.
The ADC data size is 200. so.. To use the FFT size(256), I added zero padding.. just add 0 after data repeated 56th.
After initializing for RFFToutBuff and using the "RFFT_f32(hnd_rfft)", there are no proper output data(just write 0) in RFFToutBuff. (There is no error)
I think.. it seem that it doesn't work well RFFT_f32(hnd_rfft) function.
I also checked the path of header and library(c28x_fpu_dsp_library).
How can i solve the this problem?
or from where can i start the debugging..?
Please help me as your good insight!
I attached my source code about the part of FFT to discuss with you.
/***** 2837xD_FLASH_lin_cpu1.cmd *****/
EXRAM0 : origin = 0x80000000, length = 0x014FFE // Set the External Memory-ADC Data
EXRAM1 : origin = 0x80015000, length = 0x01FFFE // Set the External Memory-1(0x20000 = 130KB) for FFT Input Data
EXRAM2 : origin = 0x80035000, length = 0x00FFFE // Set the External Memory-2(0x10000 = 65KB) for FFT Output Data
EXRAM3 : origin = 0x80045000, length = 0x004FFE // Set the External Memory-3(0x5000 = 20KB) for FFT Mag Data
EXRAM4 : origin = 0x80050000, length = 0x00FFFE // Set the External Memory-4(0x10000 = 65KB) for FFT Coe Data
EXRAM5 : origin = 0x80060000, length = 0x000FFE // Set the External Memory-5(0x01000 = 4KB) for FPUmathTables
...
usersection : > EXRAM0, PAGE = 1
RFFTdata1 : > EXRAM1, PAGE = 1, ALIGN = 512 // ALIGN = RFFT_SIZE * 2;
RFFTdata2 : > EXRAM2, PAGE = 1
RFFTdata3 : > EXRAM3, PAGE = 1
RFFTdata4 : > EXRAM4, PAGE = 1
FPUmathTables : > EXRAM5, PAGE = 1
/***** Task.c (not main.c)*****/
#include <math.h>
#include "fpu_rfft.h"
#include "fpu_vector.h"
#pragma DATA_SECTION(adc_i_data,"usersection"); // Set the External Memory to save the ADC Data
#define TEST_FFT 1
#if (TEST_FFT)
#define RFFT_STAGE 8
#define RFFT_SIZE (1 << RFFT_STAGE)
#define EPSILON 0.01
#pragma DATA_SECTION(RFFTin1Buff,"RFFTdata1");
#pragma DATA_SECTION(RFFToutBuff,"RFFTdata2");
#pragma DATA_SECTION(RFFTmagBuff,"RFFTdata3");
#pragma DATA_SECTION(RFFTF32Coef,"RFFTdata4");
float RFFTin1Buff[RFFT_SIZE];
float RFFToutBuff[RFFT_SIZE];
float RFFTF32Coef[RFFT_SIZE];
float RFFTmagBuff[RFFT_SIZE/2+1];
float* FFT_INPUT = RFFTin1Buff;
float* FFT_OUTPUT = RFFToutBuff;
float* FFT_MAG = RFFTmagBuff;
float RFFTgoldenOut[RFFT_SIZE] = {
#include "data_output_1.h"
};
RFFT_F32_STRUCT rfft;
RFFT_F32_STRUCT_Handle hnd_rfft = &rfft;
uint16_t pass = 0;
uint16_t fail = 0;
#endif
...
void Zero_Padding(void)
{
Uint16 i = 0;
// Data Copy from ADC to FFTinput
memcpy(FFT_INPUT, IQ_I_Addr, 200 * 4);
//Zero Padding
for(i=0; i<56; i++)
{
__addr32_write_uint16((unsigned long) FFT_INPUT+(200+i), 0);
}
}
...
void RFFT_TEST(void)
{
Uint16 i = 0;
hnd_rfft->FFTSize = RFFT_SIZE;
hnd_rfft->FFTStages = RFFT_STAGE;
hnd_rfft->InBuf = &RFFTin1Buff[0]; //Input buffer
hnd_rfft->OutBuf = &RFFToutBuff[0]; //Output buffer
hnd_rfft->MagBuf = &RFFTmagBuff[0]; //Magnitude buffer
hnd_rfft->CosSinBuf = &RFFTF32Coef[0]; //Twiddle factor buffer
RFFT_f32_sincostable(hnd_rfft); //Calculate twiddle factor
//Clean up output buffer
for (i=0; i < RFFT_SIZE; i++)
{
__addr32_write_uint16((unsigned long) FFT_OUTPUT+i, 0);
}
//Calculate real FFT
RFFT_f32(hnd_rfft);
for(i = 0; i < RFFT_SIZE; i++){ // Check the output
if(fabs(RFFTgoldenOut[i] - hnd_rfft->OutBuf[i]) <= EPSILON){
pass++;
}else{
fail++;
}
}
}



