This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

CMSIS-DSP library support for arm_cfft_radix2_q31 function

Hello,

I'm trying to implement a cfft_radix2 in Q31 format using CMSIS DSP libraries and a (Cortex-M0) STM32F0308 ST discovery kit. I haven't found so much help and support for these libraries as examples are written for floating point implementations. In short, I'd like to perform a module calculation of an sin(x) input in Q31 format so I've followed these steps:

// declare and initialize variables
#define _BUFFER_SIZE 128
q31_t SrcBufferInt32[_BUFFER_SIZE] = { 0x00000000,...};
q31_t DstBufferInt32[_BUFFER_SIZE/2];
arm_status status;
arm_cfft_radix2_instance_q31 S;
uint32_t fftSize = _BUFFER_SIZE/2;
uint32_t ifftFlag = 0;
uint32_t doBitReverse = 1;

// init S structure
status = arm_cfft_radix2_init_q31(&S, fftSize, ifftFlag, doBitReverse);

// perform cfft
arm_cfft_radix2_q31(&S, SrcBufferInt32);

// calculate magnitude and sqr for each pair of real and imaginary data
arm_cmplx_mag_squared_q31(SrcBufferInt32, DstBufferInt32, _BUFFER_SIZE/2); // output in 3.29 format

Is something wrong with this implementation? I expect DstBufferInt32[0] with DC component and DstBufferInt32[1] with 1st harmonic but I also found a component in DstBufferInt32[63]. Why? Should I perform other steps?
Please I need any help to solve this issue.
Thanks in advance,
gaston

0