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.

C5515 FFT Documentation Erratum

Section 4.4, page 13 of SPRABB6, the documentation for the C5505/5515's hardware FFT accelerator, appears to be incorrect. More specifically, the column in Table 2 indicating the ROM addresses for the FFT routines for PG 2.0 are not correct for the device that is on my EVM5515. I only made use of the 1024-point FFT, so I only searched for its implementation in ROM. The document indicates that the 1024-point FFT function is at address 0x00FF7A3E. Instead, on my C5515 device, the function actually begins at 0x00FF7A56. Jumping to the location specified in the document causes the expected bad things that happen when you jump to the middle of a routine.

I suspect that the other FFT routine addresses may be wrong also; I only checked the 1024-point case.

  • Hi Jason,

    You are absolutely right! The ROM locations listed in SPRABB6 are incorrect for the C5505/C5515 (PG2.0).

    The corrected ROM locations are listed below:

    /* 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;

    I have tested each address on the C5515 just to make sure they are correct. I also tested the VC5505 (PG1.4) ROM addresses, and they are correct.

    Thank you for catching this mistake. I will update the SPRABB6 document with the corrected ROM addresses.

    Regards,
    Mark

  • Hi Mark Mckeown and Jason,

    Could you please help me out in the fft code.

    What i am doing is caputuring a signal for 10s and , I want to compute the FFT.
    When i am running my code, I am not able to get the FFT computed. As soon as the code reaches the FFT computation part, it just stands still.
    So , I stopped the running to see what is getting executed. The code gets stuck here

    8e49bdeb1110             COPR #16,AC0,dbl(*AR2-),AC1 :: MOV AC1,dbl(*(AR3+T0))
    8e49bdeb1110             COPR #16,AC0,dbl(*AR2-),AC1 :: MOV AC1,dbl(*(AR3+T0))
    8e49bdeb1110             COPR #16,AC0,dbl(*AR2-),AC1 :: MOV AC1,dbl(*(AR3+T0))
    8e49bdeb1110             COPR #16,AC0,dbl(*AR2-),AC1 :: MOV AC1,dbl(*(AR3+T0))

    I am not sure , what exactly these statements does. But all the lines are same !!

    If i step debug this, it loops arround these lines.

    But, If i give a run and stop , it get stuck @

    040009                   BCC #0x3d12c3,AC0 == #0

    and if I give a run again : I get an error message saying I cant do tht !!!!!!

    I am struggling with this issue for the past 2-3 days. It will be a great help, If you can tell me how to solve this.
    I have a breif code structure, which shows how I am computing FFT. Please have a look.

    This is my code
    ==================================================================================================================================
    #include "stdio.h"
    #include "usbstk5515.h"
    #include "usbstk5515_led.h"
    #include "usbstk5515_gpio.h"
    #include "usbstk5515_i2c.h"
    #include "sar.h"
    #include "lcd.h"
    #include "hwafft.h"
    #include "math.h"

    Int32 Input_Signal1024];
    extern Uint16 hwafft_wrapper(  Int32 *data,Int32 *scratch,Uint16 fft_flag,Uint16 scale_flag,hwafft_func_t fft_func);
    Int32* fft(Int32 *data);

    void main( void )
    {
        Int16 result = 0;Int32 *fft_data = 0;
        USBSTK5515_init( );
        Input_Signal =  Aquire_signal_from_ADC_for_10s();
        fft_data = fft( Input_Signal);
        while(1);
    }

    Int32* fft(Int32 *data)
    {
        Int32 *result = 0;
        Int32 *data_br = 0;
        Uint16 out_sel = 0;
        Int32 *scratch=  0;
        hwafft_br(data,data_br,DATA_LEN_1024); // bit reversal
        data = data_br;
        out_sel = hwafft_wrapper(data,scratch,FFT_FLAG,SCALE_FLAG,hwafft_1024pts); // I am using this because, I am using large memory model
        if (out_sel == OUT_SEL_DATA)
        {
            result = data;
        }
        else
        {
            result = scratch;
        }        
        return(result);
    }   
    ===================================================================================================================================
    ===================================================================================================================================

    I have defined the below code in an assembly file. I got this code snippet from TI forum. I was asked to use this since I am using large memory model. It seems
    FFT accelerator supports only small memory model

             .sect ".onchip_code"
             .def _hwafft_wrapper
            ; HWAFFT code burned in C5515 ROM seems to support small memory model only.
            ; The following wrapper helps to use HWAFFT for large/huge memory models.
            ; CVN 20110920
    _hwafft_wrapper:
        XAR2 = XAR1
        XAR3 = XAR0
        call AC0
        return

    I have defined the below code in a C header file.(USBSTK5515.h)

    typedef Uint16 (*hwafft_func_t)(Int32 *data,
                                    Int32 *scratch,
                                    Uint16 fft_flag,
                                    Uint16 scale_flag);
    Uint16 hwafft_wrapper(  Int32 *data,
                            Int32 *scratch,
                            Uint16 fft_flag,
                            Uint16 scale_flag,
                            hwafft_func_t fft_func);


    ===================================================================================================================================
    ===================================================================================================================================

    The following is my .cmd file

    -stack    0x400                /* PRIMARY STACK SIZE    */
    -sysstack 0x400                /* SECONDARY STACK SIZE  */
    -heap     0x400               /* HEAP AREA SIZE        */  
    MEMORY
    {
        MMR     (RW) : origin = 0000000h length = 0000c0h     /* MMRs */
        DARAM_0 (RW)  : origin = 00000c0h length = 001f40h    /* on-chip DARAM 0 */
        DARAM_1 (RW)  : origin = 0002000h length = 002000h    /* on-chip DARAM 1 */
        DARAM_2 (RW)  : origin = 0004000h length = 002000h    /* on-chip DARAM 2 */
        DARAM_3 (RW)  : origin = 0006000h length = 002000h    /* on-chip DARAM 3 */
        DARAM_4 (RW)  : origin = 0008000h length = 002000h    /* on-chip DARAM 4 */
        DARAM_5 (RW)  : origin = 000a000h length = 002000h    /* on-chip DARAM 5 */
        DARAM_6 (RW)  : origin = 000c000h length = 002000h    /* on-chip DARAM 6 */
        DARAM_7 (RW)  : origin = 000e000h length = 002000h    /* on-chip DARAM 7 */
        SARAM   (RW) : origin = 0010000h length = 040000h    /* on-chip SARAM */
        SAROM_0 (RX)  : origin = 0fe0000h length = 008000h     /* on-chip ROM 0 */
        SAROM_1 (RX)  : origin = 0fe8000h length = 008000h     /* on-chip ROM 1 */
        SAROM_2 (RX)  : origin = 0ff0000h length = 008000h     /* on-chip ROM 2 */
        SAROM_3 (RX)  : origin = 0ff8000h length = 007f00h     /* on-chip ROM 3 */
        VECS    (RX)  : origin = 0ffff00h length = 000100h    /* on-chip ROM vectors */
        EMIF_CS0 (RW) : origin = 0050000h  length = 07B0000h    /* mSDR */
        EMIF_CS2 (RW) : origin = 0800000h  length = 0400000h    /* ASYNC1 : NAND */
        EMIF_CS3 (RW) : origin = 0C00000h  length = 0200000h    /* ASYNC2 : NAND  */
        EMIF_CS4 (RW) : origin = 0E00000h  length = 0100000h    /* ASYNC3 : NOR */
        EMIF_CS5 (RW) : origin = 0F00000h  length = 00E0000h    /* ASYNC4 : SRAM */
    }
    SECTIONS
    {
        vectors (NOLOAD)
        .intvec                         : > DARAM_0        ALIGN = 256
        .bss                             : > SARAM         /*, fill = 0 */
        .stack                           : > DARAM_1     ALIGN = 1024
        .sysstack                    : > DARAM_1     ALIGN = 1024
        .heap                          : > DARAM_1        ALIGN = 1024
        .text                              : > SARAM          ALIGN = 1024
        .onchip_code            : > SARAM
         .cinit                            : > DARAM_2
        .cio                                : > DARAM_2
        .const                            : > DARAM_2
        
    // The Bit-Reverse destination buffer data_br_buf requires an address with
    // at least 4+log2(FFT_LENGTH) least significant binary zeros

        data_br_buf          : > DARAM_1        ALIGN = 1024
        scratch_buf           : > DARAM_1        ALIGN = 1024
        convolved_buf       : > DARAM_2
        coeffs_fft_buf         : >    DARAM_2

        RcvL1            : > DARAM_3    
        RcvL2            : > DARAM_3    
        RcvR1            : > DARAM_4    
        RcvR2            : > DARAM_4    

        FilterOut    : > DARAM_5    
        OverlapL    : > DARAM_5    
        OverlapR    : > DARAM_5    

        XmitL1        : > DARAM_6    
        XmitL2        : > DARAM_6    
        XmitR1        : > DARAM_7    
        XmitR2        : > DARAM_7    

        RcvL1_copy    : > SARAM    
        RcvL2_copy    : > SARAM    
        RcvR1_copy    : > SARAM    
        RcvR2_copy    : > SARAM    

        .emif_cs0   : > EMIF_CS0
        .emif_cs2   : > EMIF_CS2
        .emif_cs3   : > EMIF_CS3
        .emif_cs4   : > EMIF_CS4
        .emif_cs5   : > EMIF_CS5
    }

    ===================================================================================================================================
    ===================================================================================================================================

    Following is my console output:


    **** Build of configuration Debug for project first_Project ****

    E:\TI\ccsv4\utils\gmake\gmake -k all
    'Building file: ../csl_irqplug.asm'
    'Invoking: Compiler'
    "E:/TI/ccsv4/tools/compiler/c5500/bin/cl55" -vcpu:3.3 -g --include_path="E:/TI/xdais_6_25_01_08/packages/ti/xdais" --include_path="E:/C5505/CD/C5505/Chapter 1/Application 1 Getting Started" --include_path="E:/TI/ccsv4/emulation/boards/usbstk5515_v1/include" --include_path="E:/TI/ccsv4/tools/compiler/c5500/include" --include_path="E:/TI/bios_5_41_02_14" --include_path="E:/TI/bios_6_21_00_13" --include_path="E:/C5505/CSL/build" --include_path="E:/C5505/CSL/inc" --include_path="E:/C5505/CSL/src" --diag_warning=225 --ptrdiff_size=32 --algebraic --memory_model=large --asm_source=algebraic --preproc_with_compile --preproc_dependency="csl_irqplug.pp"  "../csl_irqplug.asm"
    'Finished building: ../csl_irqplug.asm'
    ' '
    'Building file: ../main.c'
    'Invoking: Compiler'
    "E:/TI/ccsv4/tools/compiler/c5500/bin/cl55" -vcpu:3.3 -g --include_path="E:/TI/xdais_6_25_01_08/packages/ti/xdais" --include_path="E:/C5505/CD/C5505/Chapter 1/Application 1 Getting Started" --include_path="E:/TI/ccsv4/emulation/boards/usbstk5515_v1/include" --include_path="E:/TI/ccsv4/tools/compiler/c5500/include" --include_path="E:/TI/bios_5_41_02_14" --include_path="E:/TI/bios_6_21_00_13" --include_path="E:/C5505/CSL/build" --include_path="E:/C5505/CSL/inc" --include_path="E:/C5505/CSL/src" --diag_warning=225 --ptrdiff_size=32 --algebraic --memory_model=large --asm_source=algebraic --preproc_with_compile --preproc_dependency="main.pp"  "../main.c"
    "E:\TI\ccsv4\emulation\boards\usbstk5515_v1\include\usbstk5515.h", line 144: warning: typedef name has already been declared (with same type)
    "E:\TI\ccsv4\emulation\boards\usbstk5515_v1\include\usbstk5515.h", line 144: warning: typedef name has already been declared (with same type)
    "E:\TI\ccsv4\emulation\boards\usbstk5515_v1\include\usbstk5515.h", line 144: warning: typedef name has already been declared (with same type)
    "E:/TI/ccsv4/emulation/boards/usbstk5515_v1/include/usbstk5515.h", line 144: warning: typedef name has already been declared (with same type)
    "../main.c", line 33: warning: integer conversion resulted in a change of sign
    "../main.c", line 34: warning: integer conversion resulted in a change of sign
    "../main.c", line 341: warning: last line of file ends without a newline
    'Finished building: ../main.c'
    ' '
    'Building file: ../sample_code.c'
    'Invoking: Compiler'
    "E:/TI/ccsv4/tools/compiler/c5500/bin/cl55" -vcpu:3.3 -g --include_path="E:/TI/xdais_6_25_01_08/packages/ti/xdais" --include_path="E:/C5505/CD/C5505/Chapter 1/Application 1 Getting Started" --include_path="E:/TI/ccsv4/emulation/boards/usbstk5515_v1/include" --include_path="E:/TI/ccsv4/tools/compiler/c5500/include" --include_path="E:/TI/bios_5_41_02_14" --include_path="E:/TI/bios_6_21_00_13" --include_path="E:/C5505/CSL/build" --include_path="E:/C5505/CSL/inc" --include_path="E:/C5505/CSL/src" --diag_warning=225 --ptrdiff_size=32 --algebraic --memory_model=large --asm_source=algebraic --preproc_with_compile --preproc_dependency="sample_code.pp"  "../sample_code.c"
    At end of source: warning: a translation unit must contain at least one declaration
    'Finished building: ../sample_code.c'
    ' '
    'Building file: ../vectors.asm'
    'Invoking: Compiler'
    "E:/TI/ccsv4/tools/compiler/c5500/bin/cl55" -vcpu:3.3 -g --include_path="E:/TI/xdais_6_25_01_08/packages/ti/xdais" --include_path="E:/C5505/CD/C5505/Chapter 1/Application 1 Getting Started" --include_path="E:/TI/ccsv4/emulation/boards/usbstk5515_v1/include" --include_path="E:/TI/ccsv4/tools/compiler/c5500/include" --include_path="E:/TI/bios_5_41_02_14" --include_path="E:/TI/bios_6_21_00_13" --include_path="E:/C5505/CSL/build" --include_path="E:/C5505/CSL/inc" --include_path="E:/C5505/CSL/src" --diag_warning=225 --ptrdiff_size=32 --algebraic --memory_model=large --asm_source=algebraic --preproc_with_compile --preproc_dependency="vectors.pp"  "../vectors.asm"
    'Finished building: ../vectors.asm'
    ' '
    'Building target: first_Project.out'
    'Invoking: Linker'
    "E:/TI/ccsv4/tools/compiler/c5500/bin/cl55" -vcpu:3.3 -g --diag_warning=225 --ptrdiff_size=32 --algebraic --memory_model=large --asm_source=algebraic -z -m"first_Project.map" --warn_sections -i"E:/TI/ccsv4/tools/compiler/c5500/lib" -i"E:/C5505/CSL/first_Project/../../lib" -i"E:/TI/ccsv4/tools/compiler/c5500/include" --reread_libs --rom_model -o "first_Project.out"  "./vectors.obj" "./sample_code.obj" "./main.obj" "./csl_irqplug.obj" -l"E:\TI\ccsv4\tools\compiler\c5500\lib\rts55x.lib" -l"E:\C5505\CD\C5505\Chapter 1\Application 1 Getting Started\55xdsph.lib" -l"E:\C5505\CSL\build\cslVC5505.lib" -l"E:\TI\ccsv4\tools\compiler\c5500\lib\lib\usbstk5515bsl.lib" "../C5515.cmd"
    <Linking>
    'Finished building target: first_Project.out'
    ' '
    Build complete for project first_Project