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.

C5505 hwaFFT死活通不了,真怀疑TI的这款DSP本身就是有错误



大家好,最近遇到了HwaFFT无法实现1024点FFT算法的功能,这到底是为什么?各种方式几乎都尝试过了还是这样,是不是这个片子本身就是个错误。

希望有关TI的FAE能够帮忙解决一下问题,如果各位做过C55xxHwaFFT的朋友们能不吝赐教?

  • 详细说下你是怎么做的?

    是否有参考sprabb6b这篇文档.

  • 1、CMD文件的配置,如下:

    -stack 0x1000 /* PRIMARY STACK SIZE */
    -sysstack 0x1000 /* SECONDARY STACK SIZE */
    -heap 0x3F80 /* HEAP AREA SIZE */
    MEMORY
    {
    PAGE 0:
    MMR: o = 0x000000 l = 0x0000c0 /* 192B Memory Mapped Registers */
    DARAM0: o = 0x0000C0 l = 0x001F40 /* 8kB Dual Access RAM 0 */
    DARAM1: o = 0x002000 l = 0x006000 /* 8kB Dual Access RAM 1 */
    DARAM2: o = 0x008000 l = 0x008000 /* 8kB Dual Access RAM 2 */
    // DARAM3: o = 0x00C000 l = 0x002000 /* 8kB Dual Access RAM 5 */
    // DARAM4: o = 0x00E000 l = 0x002000 /* 8kB Dual Access RAM 5 */
    PAGE 1:
    SARAM0: o = 0x010000 l = 0x002000 /* 8kB Single Access RAM 0 */
    SARAM1: o = 0x012000 l = 0x002000 /* 8kB Single Access RAM 1 */
    SARAM2: o = 0x014000 l = 0x002000 /* 8kB Single Access RAM 2 */
    SARAM3: o = 0x016000 l = 0x002000 /* 8kB Single Access RAM 3 */
    SARAM4: o = 0x018000 l = 0x004000 /* 8kB Single Access RAM 4 */
    //SARAM5: o = 0x01A000 l = 0x002000 /* 8kB Single Access RAM 5 */
    SARAM6: o = 0x01C000 l = 0x002000 /* 8kB Single Access RAM 6 */
    SARAM7: o = 0x01E000 l = 0x002000 /* 8kB Single Access RAM 7 */
    SARAM8: o = 0x020000 l = 0x002000 /* 8kB Single Access RAM 8 */
    SARAM9: o = 0x022000 l = 0x002000 /* 8kB Single Access RAM 9 */
    SARAM10: o = 0x024000 l = 0x002000 /* 8kB Single Access RAM 10 */
    SARAM11: o = 0x026000 l = 0x002000 /* 8kB Single Access RAM 11 */
    SARAM12: o = 0x028000 l = 0x002000 /* 8kB Single Access RAM 12 */
    SARAM13: o = 0x02A000 l = 0x002000 /* 8kB Single Access RAM 13 */
    SARAM14: o = 0x02C000 l = 0x002000 /* 8kB Single Access RAM 14 */
    SARAM15: o = 0x02E000 l = 0x002000 /* 8kB Single Access RAM 15 */
    SARAM16: o = 0x030000 l = 0x002000 /* 8kB Single Access RAM 16 */
    SARAM17: o = 0x032000 l = 0x002000 /* 8kB Single Access RAM 17 */
    SARAM18: o = 0x034000 l = 0x002000 /* 8kB Single Access RAM 18 */
    SARAM19: o = 0x036000 l = 0x002000 /* 8kB Single Access RAM 19 */
    SARAM20: o = 0x038000 l = 0x002000 /* 8kB Single Access RAM 20 */
    SARAM21: o = 0x03A000 l = 0x002000 /* 8kB Single Access RAM 21 */
    SARAM22: o = 0x03C000 l = 0x002000 /* 8kB Single Access RAM 22 */
    SARAM23: o = 0x03E000 l = 0x002000 /* 8kB Single Access RAM 23 */
    SARAM24: o = 0x040000 l = 0x002000 /* 8kB Single Access RAM 24 */
    SARAM25: o = 0x042000 l = 0x002000 /* 8kB Single Access RAM 25 */
    SARAM26: o = 0x044000 l = 0x002000 /* 8kB Single Access RAM 26 */
    SARAM27: o = 0x046000 l = 0x002000 /* 8kB Single Access RAM 27 */
    SARAM28: o = 0x048000 l = 0x002000 /* 8kB Single Access RAM 28 */
    SARAM29: o = 0x04A000 l = 0x002000 /* 8kB Single Access RAM 29 */
    SARAM30: o = 0x04C000 l = 0x002000 /* 8kB Single Access RAM 30 */
    SARAM31: o = 0x04E000 l = 0x002000 /* 8kB Single Access RAM 31 */

    CS0: o = 0x050000 l = 0x7B0000 /* 8MB CS0 external memory space */
    CS2: o = 0x800000 l = 0x400000 /* 4MB CS2 external memory space */
    CS3: o = 0xC00000 l = 0x200000 /* 2MB CS3 external memory space */
    CS4: o = 0xE00000 l = 0x100000 /* 1MB CS4 external memory space */
    CS5: o = 0xF00000 l = 0x0E0000 /* 1MB CS5 external memory space */
    ROM: o = 0xFE0000 l = 0x01FE00 /* 128kB ROM (MPNMC=0) or CS5 (MPNMC=1) */
    VECS: o = 0xFFFE00 l = 0x000200 /* reset vector */
    }

    SECTIONS
    {
    .vectors > VECS PAGE 1 /* If MPNMC = 1, remove the NOLOAD directive */
    .cinit > DARAM0 PAGE 0
    .text > DARAM1 PAGE 0
    // .stack > SARAM0 PAGE 1
    // .sysstack > SARAM3 PAGE 1
    .sysmem > SARAM4 PAGE 1
    .data > SARAM6 PAGE 1
    .cio > DARAM0 PAGE 0
    .bss > SARAM1 PAGE 1
    .const > DARAM0 PAGE 0
    .switch > DARAM0 PAGE 0
    data_br_buf : > DARAM2 PAGE 0/* hwafft Output–bit-reversed data memory allocation */
    data_buf : > DARAM2 PAGE 0/* hwafft Input/output static memory allocation */
    scratch_buf : > DARAM2 PAGE 0 /* hwafft Intermediate/output static memory allocation */

    //data_buf : >DARAM2 PAGE 0
    //scratch_buf : >DARAM2 PAGE 0
    //data_br_buf : >DARAM2 PAGE 0
    }
    /* HWAFFT Routines ROM Addresses */
    /* (PG 2.0) */
    _hwafft_br = 0x00ff6cd6;
    _hwafft_8pts = 0x00ff6cea;
    _hwafft_16pts = 0x00ff6dd9;
    _hwafft_32pts = 0x00ff6f2f;
    _hwafft_64pts = 0x00ff7238;
    _hwafft_128pts = 0x00ff73cd;
    _hwafft_256pts = 0x00ff75de;
    _hwafft_512pts = 0x00ff77dc;
    _hwafft_1024pts = 0x00ff7a56;

    2、HWAFFT相关变量及函数的的定义,如下:

    Int32 *data;
    Int32 *data_br;
    Uint16 fft_flag;
    Uint16 scale_flag;
    Int32 *scratch;
    Uint16 out_sel;
    Int32 *result;

    #define ALIGNMENT 2*1024
    #pragma DATA_SECTION(data_buf, "data_buf");
    #pragma DATA_ALIGN (data_buf, ALIGNMENT);
    Int32 data_buf[1024];
    Int32 *data = data_buf;

    #pragma DATA_SECTION(scratch_buf, "scratch_buf");
    #pragma DATA_ALIGN (scratch_buf, ALIGNMENT);
    Int32 scratch_buf[1024];
    Int32 *scratch =scratch_buf;

    #pragma DATA_SECTION(data_br_buf, "data_br_buf");
    #pragma DATA_ALIGN (data_br_buf, ALIGNMENT);
    Int32 data_br_buf[1024];
    Int32 *data_br =data_br_buf;

    void fft();

    void fft(){
    fft_flag = FFT_FLAG;
    scale_flag = SCALE_FLAG;
    data =data_buf;
    /* Bit-Reverse 1024-point data, Store into data_br, data_br aligned to
    12-least significant binary zeros*/
    hwafft_br(data, data_br, DATA_LEN_1024); /* bit-reverse input data,
    Destination buffer aligned */
    //data = data_br;
    //memcpy(data_buf,data_br,sizeof(data_br_buf));
    //data = data_buf;
    /* Compute 1024-point FFT, scaling enabled. */
    // out_sel = hwafft_1024pts(data_br, scratch, fft_flag, scale_flag);
    out_sel = hwafft_1024pts(data_br, scratch, fft_flag, scale_flag);
    if (out_sel == OUT_SEL_DATA) {
    result = data_br;
    }else {
    result = scratch;
    }
    }

    3、主要代码如上,数据的接收及处理在SAR接收中断里处理:

    interrupt void sarISR(void)
    {

    SAR_readData(SarHandle, &readBuffer[i]);
    // printf("SAR ADC read data 0x%x\n",readBuffer);
    data_buf[i]=readBuffer[i];
    i++;
    if(i==1024){
    fft();
    i=0;
    }

    4、外部给出正谐波信号,由SAR直接采集。通过观察输入数据,readBuffer[1024]接收正常。时钟配置PLL,sysclock=100MHZ.


  • 您看一下我做得过程,相关的代码都贴出来了

  • 你好,FFT你调通了吗?遇到同样的问题