Hi,
My question is about the FFT function (DSP_fft16x16t) in dsp64x.lib and hope to get your ideas.
If I know correct, DSP_fft16x16t defined as below:
void DSP_fft16x16t(const short * restrict w, int nx, short * restrict x, short * restrict y)
(1). Could you let me know how I can define the correct array for the w, x, and y ?
My relative code shown below (can not get the correct fft transform result as MATLAB) is for your reference:
----------------------------------------------------------------------------------------------------------
#define NSize 4
#pragma DATA_SECTION(twiddle_fft,".off_ram");
#pragma DATA_SECTION(PImgTmp_double,".off_ram1");
#pragma DATA_SECTION(FFT_output,".off_ram2");
#pragma DATA_SECTION(IFFT_output,".off_ram3");
#pragma DATA_ALIGN (twiddle_fft, 8);
#pragma DATA_ALIGN (PImgTmp_double, 8);
#pragma DATA_ALIGN (FFT_output, 8);
#pragma DATA_ALIGN (IFFT_output, 8);
far const short twiddle_fft[NSize*2];
short PImgTmp_double[NSize*2]={1,0,3,0,6,0,9,0}; //input data for FFT
short FFT_output[NSize*2];
unsigned int i;
void main()
{
gen_twiddle(twiddle_fft,NSize,32767.5);
DSP_fft16x16t(twiddle_fft,NSize,PImgTmp_double,FFT_output);
}
------------------------------------------------------------------------------------------------------------
Cmd linker file
MEMORY
{
IPRAM: origin = 0x00000000, len = 0xffff
IDRAM: origin = 0x80000000, len = 0xffff
IDRAM1: origin = 0x80100000, len = 0x1000
IDRAM2: origin = 0x00200000, len = 0x1000
IDRAM3: origin = 0x80300000, len = 0x1000
IDRAM4: origin = 0x80400000, len = 0xffff
}
SECTIONS
{
.vectors: {} > IPRAM
.text: {} > IPRAM
.cinit: {} > IPRAM
.bss: {} > IPRAM
.far: {} > IPRAM
.const: {} > IPRAM
.sysmem: {} > IPRAM
.cio: {} > IPRAM
.stack: {} > IDRAM
.off_ram: > IDRAM1
.off_ram1: > IDRAM2
.off_ram2: > IDRAM3
.off_ram3: > IDRAM4
}
----------------------------------------------------------------------------------------------------------------
(2).In our application, SDRAM is configured in EMIFA CE0 (0x8000 0000 – 0x8FFF FFFF)
I used the watch window in CCS to check the input array data (PImgTmp_double), and found that the value in the PImgTmp_double changed (all zero). I hope to know the root cause. Can you help give some suggestions?
(3).for the function DSP_fft16x16t(const short * restrict w, int nx, short * restrict x, short * restrict y); there are the 'const', 'restrict'.
Therefore I define
the 'twiddle_fft'(w) as 'far const short twiddle_fft[NSize*2]';
PImgTmp_double(x) and the FFT_output(y) in the separator memory (#pragma DATA_SECTION) because of restrict definition.
Are the above steps right or necessary if I call the DSP_fft16x16t from the dsp64x.lib?
p.s I am confused about this issue these days and search the related content in E2E bbs but still can not find the root cause. The datasheet I refered is TMS320C64x DSP Library Programmer’s Reference_SPRU565B. We hope to get more support.
Best Regards