ARM CFFT Peak Velocity from Acceleration data

               Hello guys,

      I am using an NRF chip with Cortex M4. Currently I am reading data from an accelerometer (12 signed bit ADC) and I have to get peak velocity. For that I am using the Omega arithmetic algorithm, as follows:

         - remove offset from raw data (acceleration) and shift values with 4 bits; copy the array in a x2 length array with interleaving 0 complex values;

         - do a CFFT on the new array;

         - try to divide each complex value by (0 + 2*pi*df I); now we have velocity  in frequency domain;

         - to inverse CFFT, calculate magnitude, remove offset and shift back 4 bytes;

         - check for peak velocity and convert data into mm/s value;

   I used a test array (sine wave of ~208 hz with peak value of 2048 - that is the max signed value for signed 12 bits) , sampling frequency of 3332hz and a total of 4096 samples.  Problem is that if I divide my complex values with 2*pi*f (according to the complex division formulas), I get very low values in the frequency domain for real and complex parts, and the final array has inside it a bunch of zeroes and -1. I am not getting back a sine wave in time domain.

    Does anybody has an idea if I should shift with some bits or something the values before doing the Inverse CFFT? Here is a part of the code below:

 Many thanks!

0