Quick Links
FFT and IFFT using CMSIS DSP library, q15 fractional format CMSIS DSP dedicated features
#1
Posted 14 June 2012 - 09:07 AM
I am currently trying to use the CMSIS DSP library to implement DSP functionality, by doing FFT or IFFT.
I don't have an embedded Floating point Unit, thus I would like to use the fixed q15 fractional format.
By reading the CMSIS documentation html page, it is specified that the FFT/IFFT output format is different from the input one...
For example, for a FFT length of 256, the input format is q15 (1.15) and the output format is 9.7. With 8 bits to upscale.
If I want to perform an FFT and directly fllowed by an IFFT, I have to convert output FFT data which are in 9.7 into a q15 for IFFT Input format...
My question is, from my understanding, the conversion from q15 to 9.7 or the reverse, would be just done by a simple shift of 8 bits...?
But, I guess that data may be lost between each conversion...?
It is very confused to me...
Could someone help me ...?
Thanks!
PjEmY<br class="Apple-interchange-newline">
#2
Posted 15 June 2012 - 09:00 PM
Quote
Yes. (The only possible got-cha is if the q numbers are signed as you have to be wary of what you shift into/out of the sign bit position - so you may need sign extension in some cases, rather than shifting zeros into the MSB).
Quote
Yes. You are converting from a number with 15 fractional bits (more precision, less dynamic range) to a number with 7 fraction bits (less precision, more dynamic range). Any such conversion is obviously going to lose data off one end of the number ...
Quote
Doesn't seem like you need much =P
This post has been edited by isogen74: 15 June 2012 - 09:23 PM
#3
Posted 18 June 2012 - 07:31 AM
Actually, I performed what I wanted latter during the last week.
My problem was just to perform the right up scalling before sending data to the DAC. I am currently using the Q15 fractional format because it is the only SIMD instructions optimized format (without FPU use) available in the DSP CMSIS library.
Now I have to implement Filtering (FIR) functions to avoid the resulting additional noise which appears after FFT/IFFT.
Thank you again for your help!
#4
Posted 03 July 2012 - 08:45 AM
I'm currently using CMSIS DSP Lib for my STM32F105R8T6 (Cortex - M3). I tried to run Q15 CIFFT Radix-2 function but the result is quite weird ( max value = 11 ??? while my input signal's amplitude = 1 ( 32767 in Q15 format )). This is my code :
status = arm_cfft_radix2_init_q15(&CFFT_R2_Q15, CfftLen, CifftFlagOFF, bitRevf) ; // instance for calculating fft(x) arm_cfft_radix2_q15(&CFFT_R2_Q15, x) ; // calculate fft status = arm_cfft_radix2_init_q15(&CIFFT_R2_Q15, CifftLen, CifftFlagON, bitRevi) ; // instance for calculating ifft(x) arm_cfft_radix2_q15(&CIFFT_R2_Q15, x) ; //calculate ifft
x : array of 4096 element (real, image interleaved)
fftsize = 2048
Because the Real FFT function cost too much ROM space so I have to use Complex FFT to calculate real signal ( complex signal with image part = 0 ).
I hope someone could help me with this CIFFT function.
Thank you !
#5
Posted 18 January 2013 - 08:02 AM
Protokov, on 03 July 2012 - 08:45 AM, said:
I'm currently using CMSIS DSP Lib for my STM32F105R8T6 (Cortex - M3). I tried to run Q15 CIFFT Radix-2 function but the result is quite weird ( max value = 11 ??? while my input signal's amplitude = 1 ( 32767 in Q15 format )). This is my code :
status = arm_cfft_radix2_init_q15(&CFFT_R2_Q15, CfftLen, CifftFlagOFF, bitRevf) ; // instance for calculating fft(x) arm_cfft_radix2_q15(&CFFT_R2_Q15, x) ; // calculate fft status = arm_cfft_radix2_init_q15(&CIFFT_R2_Q15, CifftLen, CifftFlagON, bitRevi) ; // instance for calculating ifft(x) arm_cfft_radix2_q15(&CIFFT_R2_Q15, x) ; //calculate ifft
x : array of 4096 element (real, image interleaved)
fftsize = 2048
Because the Real FFT function cost too much ROM space so I have to use Complex FFT to calculate real signal ( complex signal with image part = 0 ).
I hope someone could help me with this CIFFT function.
Thank you !
Hi Protokov! try to divide by the number of element













