stm32 - CMSIS real-FFT on 8192 samples in Q15 -
i need perform fft on block of 8192 samples on stm32f446 microcontroller. wanted use cmsis dsp library it's available , optimised stm32f4.
my 8192 samples of input values internal 12-bit adc (left aligned , converted q15 flipping sign bit)., testing purpose i'm feeding fft test-buffers.
with cmsis's fft functions, q15 version supports lengths of 8192. using arm_rfft_q15().
because fft functions of cmsis libraries include default 32k of luts - adapt many fft lengths, have "rewritten" them remove tables corresponding other length 1 i'm interested in. haven't touched except removing useless code.
my samples stored on external sdram access via dma.
when using fft, have several problems :
- both source buffer , destination buffer modified ;
- the result not @ expected
to make sure had wrong results did ifft right after fft confirmed code wasn't working.
here code :
status_codes fsm::fft_state(void) { // flush sdram section si_ovf_buf_clr_u16((uint16_t *)0xc0000000, 8192); q15_t* buf = (q15_t*)(0xc0000000); for(int = 0; i<50; i++) buf[i] = 0x0fff; // fill buffer test vector (50 sp gate) // initialise fft // ---> forward, 8192 samples, bitreversed arm_rfft_instance_q15 s; if(arm_rfft_init_q15(&s, 8192, 0, 1) != arm_math_success) return state_error; // perform fft arm_rfft_q15(&s, (q15_t*)0xc0000000, (q15_t*)0xc0400000); // post-shift 12, in place (see doc) arm_shift_q15((q15_t*)0xc0400000, 12, (q15_t*)0xc0400000, 16384); // init inverse fft if(arm_rfft_init_q15(&s, 8192, 1, 1) != arm_math_success) return state_error; // perform ifft arm_rfft_q15(&s, (q15_t*)0xc0400000, (q15_t*)0xc0800000); // post shift arm_shift_q15((q15_t*)0xc0800000, 12, (q15_t*)0xc0800000, 8192); return state_success; } and here result (from gdb)
ps : i'm using chibios - not sure if relevant.

Comments
Post a Comment