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.

C28x Fixed Point DSP Library RFFT Sample code

Other Parts Discussed in Thread: CONTROLSUITE, TMS320F28335

I'm using Fixed point FFT library in ControlSUITE.

But my benchmark is doubled comparing with the value of the User's Guide when using RFFT sample code.

For example:

In 512 point RFFT,

UG : 33,081 cycles

My benchmark : 62,142 cycles

I found the imaginary part of the caluculation in the assembler code (FFT32_calc.asm).

            MOVL    ACC,*XAR6       ; ACC=I1
            SFR     ACC,#1          ; ACC=I1/2
            MOVL    P,*XAR2         ; P=I2
            SUBL    ACC,P<<PM       ; ACC=(I1-I2)/2
            MOVL    *-SP[TEMP],ACC     ; temp=(I1-I2)/2
            ADDL    ACC,P           ; ACC=(I1+I2)/2

            SFR     ACC,#1          ; ACC=(I1+I2)/4
            MOVL    P,XAR5          ; P=(I3+I4)/2
            ADDL    ACC,P<<PM       ; ACC=(I1+I2+I3+I4)/4
            MOVL    *XAR6,ACC       ; I1'=(I1+I2+I3+I4)/4
            NOP     *0++
            SUBL    ACC,P           ; ACC=(I1+I2-I3-I4)/4
            MOVL    *XAR3,ACC       ; I3'=(I1+I2-I3-I4)/4
            NOP     *0++


            MOVL    ACC,*-SP[TEMP]     ; ACC=(I1-I2)/2
            SFR     ACC,#1          ; ACC=(I1-I2)/4
            MOVL    P,XT            ; P=(R3-R4)/2
            ADDL    ACC,P<<PM       ; ACC=ACC=(I1-I2+R3-R4)/4
            MOVL    *XAR4,ACC       ; I4'=(I1-I2+R3-R4)/4
            NOP     *0++
            SUBL    ACC,P           ; ACC=(I1-I2-R3+R4)/4
            MOVL    *XAR2,ACC       ; I2'=(I1-I2-R3+R4)/4
            NOP     *0++

This is the common code as CFFT.

Is it right?

My environment is:

CCSv5.5

TMS320F28335 control card

ControlSUITE v3.2.4

Best Regards,

Satoshi Shinohara

  • There is a problem with the default initialization macros for the RFFT. A 512 pt RFFT uses a 256 point CFFT and then some post processing to get the real FFT. 

    So for the defaults, please make the following change:

    #define RFFT32_512P_DEFAULTS { (long *)NULL,\
    (long *)NULL,\
    512,\ // -> change to 256
    9,\ // change number of stages to 8
    (long *)NULL,\
    (long *)NULL,\
    0,\
    0,\
    8,\ //change twiddle skip factor to 16
    (void (*)(void *))FFT32_init,\
    (void (*)(void *))FFT32_calc,\
    (void (*)(void *))FFT32_mag,\
    (void (*)(void *))FFT32_win}

  • Vishal-san,

    Thank you so much.

    It's working fine, and the other point, too.

    Best Regards,

    Satoshi Shinohara

  • This is a very significant change to the behavior of the RFFT_32_DEFAULT settings.  Why is this not more significantly documented in the c28X Fixed Point DSP Library v1.01 manual, dated 2011, and why is there not an updated library?  We are using and relying on the Fixed Point DSP library in control critical code.  We have spent a significant amount of time trying to understand these libraries, and volunteer to fix the documentation independently if it will save time.

  • Additionally, the library documentation specifies that the RFFT32.magnitude output buffer of the CCA module will be in "Q30 or Q31" format.  So which is it?  What determines that?  These things become very important in control settings!

  • Dylan, 

    I am in the process of closing out bugs and creating a new revision of this library. It should be out by next month. We are planning an overhaul of the documentation as well. if you have any input as to what needs to be added/deleted/expanded i will try to add those in. I will also include a fairly detailed revision history of all changes made.

  • Hi Vishal

    I wondered if you have updated the document, can u send me link. Have you also updated the library as well.

    Thanks

  • Richard-san,

    You can find them in the latest version of ControlSUITE.

    www.ti.com/.../controlsuite

    \libs\dsp\FixedPointLib\v1_20_00_00\include\fft.h

    \libs\dsp\FixedPointLib\v1_20_00_00\doc\FIXPT-SW-LIB-UG.pdf

      -> 4.3 Choosing a Q representation for the FFT routines

    Best Regards,

    Satoshi Shinohara