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.

Modifying RFFT-ADC Example on F28335

Other Parts Discussed in Thread: ADS1278

Hi,

I am interfacing ADS1278 EVM-PDK  with Piccolo f28335 via MCBSP. When I get samples I want to compute FFT by using  the example from FPU library ("2833x_RFFT_ADC_RT"). this example use the ADC 12bits experimenter kit F28335 and as I know, It scale samples input int 16 from ADC by 1/4096 to float 32 and it compute FFT. As ADS1278 EVM-PDK has 24 bits resolution, I need to change the source code written in assemby and modify variable type to int 32 and to scale by 1/16777216 (2^24). Unfortunately, I dont know asembly lenguage and I dont know how do it. Could anyone help me out? 

This is the soude code.

RFFT_adc_f32.asm

  • Hi, 

    You need to change the inverse scale factor in the assembly. Change this line

    MOVI32    R4H, 0x39800801

    to

    MOVI32    R4H, 0x33800001


    What you are doing is changing the 12-bit adc scaling factor (1/4095) to the 24-bit factor of (1/(2^24-1))

  • Hi Vishal

    Thanks for you quickly reply,

    I did what did you say but the resuls don't agree, I think the variable type could be affecting because I get into unsigned int 32 input variables and the example works with 16 unsigned int input variables. and again, I don't know change it in the assembly code. Could this have to do?.

    Thanks,

    Jonatan.
  • Oh, i forgot about the change in data size, that will complicate things a bit. I guess we need a few more changes to the _rfft_adc_f32_Stages1and2and3andBitReverse() within the assembly file.

            MOV      AR0,#0Ah
            MOV      AH,*+XAR4[AR0]         ; FFT SIZE
    ;<---------------------------------------commented the line below
    ;       LSR      AH,1                   ; FFT SIZE/2 - for 16-bit input data
            MOV      AR0,AH
    ;       LSR      AH,3
            LSR      AH,2                   ; for 16-bit input data
            SUBB     AH,#1                  ; (Size / 8) - 1
            MOVL     XAR1,#0000h            ; index if memory is not aligned
    
            RPTB    _rfft_32_Last, AH
    ;------------------------------------------------------------------------------
    ;  Input buffer must be aligned for this code
    ;------------------------------------------------------------------------------
            NOP     *,ARP2
            MOVI32    R4H, 0x33800001       ;<------------(1/(2^24-1))
            UI32TOF32 R0H, *BR0++           ;I1 load
            UI32TOF32 R1H, *BR0++           ;I2 load
            MPYF32    R0H, R0H, R4H         ;I1 scale 
            UI32TOF32 R2H, *BR0++           ;I3 load
            MPYF32    R1H, R1H, R4H         ;I2 scale
         || MOV32     *-SP[I1], R0H         ;I1 save
            UI32TOF32 R0H, *BR0++           ;I4 load
            MPYF32    R2H, R2H, R4H         ;I3 scale
         || MOV32    *-SP[I2], R1H          ;I2 save           
            UI32TOF32 R1H, *BR0++           ;I5 load       
            MPYF32    R0H, R0H, R4H         ;I4 scale
         || MOV32    *-SP[I3], R2H          ;I3 save
            UI32TOF32 R2H, *BR0++           ;I6 load 
            MPYF32    R1H, R1H, R4H         ;I5 scale
         || MOV32    *-SP[I4], R0H          ;I4 save
            UI32TOF32 R0H, *BR0++           ;I7 load 
            MPYF32    R2H, R2H, R4H         ;I6 scale
         || MOV32    *-SP[I5], R1H          ;I5 save
            UI32TOF32 R1H, *BR0++           ;I8 load 
            MPYF32    R0H, R0H, R4H         ;I7 scale
         || MOV32    *-SP[I6], R2H          ;I6 save
            MPYF32    R1H, R1H, R4H         ;I8 scale            
            MOV32    *-SP[I7], R0H          ;I7 save                             
            MOV32    *-SP[I8], R1H          ;I8 save
    

    So,

    1. the first change is to comment out the LSR AH,1 so that AR0 = FFT_SIZE (and not FFT_SIZE/2)- this will ensure that each time you use the bit-reverse addressing - the instructions with BR0++ - its getting the right location for a 32-bit sized data.
    2. Change the scaling factor to 1/(2^24 - 1)
    3. change all the UI16TOF32 to UI32TOF32