AnsweredAssumed Answered

FFT problem

Question asked by kgb.georges on Jan 24, 2016
Latest reply on Jan 24, 2016 by Clive One
Hi, I need do FFT on stm32f4 and therefore I
have few questions:
1. Is there any why to directly copy adc values which are uint16_t to float32_t buffer using DMA, without casting them in fork loop and using two buffers. I used this:  
DMA_PeripheralDataSize = DMA_PeripheralDataSize_HalfWord;
DMA_MemoryDataSize = DMA_MemoryDataSize_Word;
but i get only zeros.
2. I tested  arm_rfft_fast_f32 function from CMSIS-DSP 1.4.4 with generated 50hz sine wave at 1000Hz sample rate using 1024 samples, but i get peek value at 102, not 51 which i should get 1000/1024 ~0,97 * 51 = 50Hz:

uint16_t i;
    float32_t khz10[1024];
    float32_t maxvalue;
    uint32_t maxindex;
    //float32_t output2[1024];
    arm_rfft_fast_instance_f32 S;

    arm_rfft_fast_init_f32(&S, 1024);

    printf("Input=[");
    for(i=0; i<1024; i++){
        khz10[i] = 1.2f*arm_sin_f32(2*3.1415926f*50*i/1000)+1;
        printf("%f,",khz10[i]);
    }
    printf("]\r\n");

    arm_rfft_fast_f32(&S, khz10,khz10,0);
    arm_abs_f32(khz10, khz10, 1024);
    arm_max_f32(khz10+1, 1023, &maxvalue, &maxindex);
    printf("Max:[%ld]:%f Output=[",maxindex,maxvalue);
    for(i=0; i<1024; i++){
        printf("%f,",khz10[i]);
    }
    printf("]\r\n");

thx for help

Outcomes