cancel
Showing results for 
Search instead for 
Did you mean: 

CMSIS DSP arm_rfft_q15 troubleshooting

hashtala
Associate II

Hello

I am trying to perform FFT on real data sampled with ADC

However, first I need to perform it on test data that I generated inside my code to verify it would work

  1. I set parameters: frequency, buffer size, sampling rate (buffsize 512)

then I generated 50hz sine + 150hz sine like this

Note that buffer is int16, signed two's complement 16 bits;

NOW

rfft_q15 expect 1.15 format...

where 1 (msb) is sign and 15 are fractional (so much like two's complement)

I am not interested in exact values of Fourier Transform, rather I want to determine which bins have highest value, SO I JUST COPIED THESE VALUES TO q15_t BUFFER AND FED INTO arm_rfft_q15

As for the output, now it gives back 9.7 where 9 bits are integer parts and 7 bits are fractions. Since I do not care about exact values and just want to know which frequency bin has biggest absolute value I ignore these bits

Now what I though was following: if msb of 9 bit integer is actually kind of the sign bits and it works like two's complement. I should be able to store it in int16 and just pick up greatest value

However it didn't work, rfft output didn't make any sense.

is it because that q15 format does not actually work like two's complement and sign bit is just literally to carry information about the sign?

0 REPLIES 0