This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

question about calling the DSP_fft16x16t in dsp64x.lib

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

  • update

    I think I find the main cause of my issue.

    1.For the twiddle factor, array w, it would be better to use the tw_fft16x16.exe from TI\c6400\dsplib\bin in DOS.

    2.TI related document suggests that the array w,x(FFT function input),y(FFT function output) needs to use #pragma DATA_ALIGN(*, 8). It is important that the declaration must before the type definition of array w,x,y.

      e.g.#pragma DATA_ALIGN(*, 8);

            short *[size];

    3.Q.15 formate, TI dsp64x.lib provide DSP_fltoq15. I run it soomthly. sure, someone can transfer the data formate in Q.15 by hand.

    I have still question and hope to get your support---

    Q:the input array x for DSP_fft16x16t would be overwrite each time. for example, I define the array element all in conatant 1. the value would be changed into other value(not 1, randomly). Would you like help analyze my symptom.

    Best Regards

  •         For the twiddle factor, I fond that the array like this const short w[2 * 510] in output.c when I run the tw_fft16x16.exe. The FFT length I defined is 512. This must be const short w[2 * 512], right?

            Hope expert give some comments.

    Best Regards