Tool/software: TI C/C++ Compiler
First post on here so go easy on me!
I'm trying to get my head around the fixed point FFT code in MSP dsplib, in particular msp_fft_fixed_q15.
The example code initialises the input array using the msp_sinusoid_q15 utility, which presumably puts q15 results into the input array for the FFT to work on.
The parameter I am passing to the sinusoid for the amplitude is 0.5 as a q15, and the result that is returned from msp_sinusoid has a peak amplitude of about +/-16384 decimal which makes sense.
When I run the FFT, I am having trouble interpreting the scaling of the result.
The MSP dsp lib user guide says that the results for a 256 point FFT can be interpreted as a q8 result +/- 127.00000, or as a int16_t result divided by 128.
If I want to compute the magnitudes of each of the complex results, is it best to use the _QNmag function in the Qmath library, and make N=8 , i.e. _Q8mag()?
If I do that, is the result then in q8 format? I want to get the magnitudes into dB eventually, so I presume I can stay in q8 format to get a dB result using +/- 128 dB, or is that too simplistic?
If I don't use QNmag, how do I get the correctly scaled magnitude from the interger real and imaginary parts?
Do I need to multiply each by 128 then square, add and square root?
I've gone round in circles on this, but I am quite new to the complexities of FP maths!
For the moment I am not too worried about precision and resolution etc.