cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 DSP lib FFT problem

dzl
Associate II
Posted on March 03, 2009 at 08:24

STM32 DSP lib FFT problem

5 REPLIES 5
dzl
Associate II
Posted on May 17, 2011 at 13:04

Hi,

I am developing a modem for HF-radio digital modes. In this project i am using the 1024 point FFT from the STM32 DSP lib and are encountering some problems with the output data.

For testing purpose i have generated a complex sinewave that sweeps from zero to half the sampling frequency.

When observing the output bins they appear to be partly swapped as as if the last butterfly calculation is missing.

I am using the method described in the library demo to enter data into the input vector as well as retrieving data from the output vector.

Has anyone used this library with success?

My project is developed under RIDE7.

dzl
Associate II
Posted on May 17, 2011 at 13:04

I have now tested the 64 point and 256 point routines as well.

the 64 point seem to work just fine but the 256 point has the same problem as the 1024 point.

dzl
Associate II
Posted on May 17, 2011 at 13:04

The STM32 DSP library does apparently not compile properly under RIDE.

The 256 and 1024 point FFT routines does not work.

I have persuaded Ivan Mellen's FFT/IFFT library to compile under RIDE7 so i am using that instead... Thank's Ivan!

guyvo67
Associate II
Posted on May 17, 2011 at 13:04

hi,

I had an issue too using the FIR from the DSP library see my post:

http://www.st.com/mcu/forums-cat-8015-23.html

Apparently the gcc assembler (code sourcery) still suffers from some problems for the cortex target. I think it may be the same for your case.

The best thing todo is posting a bug via the ST online support form to the DSP group people.

-G

16-32micros
Associate III
Posted on May 17, 2011 at 13:04

Hi,

There is a mistake inside the 256 and 1024 Points FFTs files. We will release a new version soon that corrects this issue.

For 1024 points (cr4_fft_1024_stm32.s) GNU file, Please copy/paste this part from Line 25 to Line 57:

.equ NPT, 1024

/*;*******************************************************************************

;* Function Name : cr4_fft_1024_stm32

;* Description : complex radix-4 1024 points FFT

;* Input : - R0 = pssOUT: Output array .

;* - R1 = pssIN: Input array

;* - R2 = Nbin: =1024 number of points, this optimized FFT function

;* can only convert 1024 points.

;* Output : None

;* Return : None

;*********************************************************************************/

.thumb_func

cr4_fft_1024_stm32:

STMFD SP!, {R4-R11, LR}

MOV r12, #0

MOV r3, r0

MOV r0,#0

preloop_v7:

ADD r14, r1, r12, LSR#22 /*1024pts*/

LDRSH r5, [r14, #2]

LDRSH r4, [r14]

ADD r14, #NPT

LDRSH r9, [r14, #2]

LDRSH r8, [r14]

ADD r14, #NPT

LDRSH r7, [r14, #2]

LDRSH r6, [r14]

ADD r14, #NPT

LDRSH r11, [r14, #2]

LDRSH r10, [r14]

ADD r14, #NPT

....

Instead of

.equ NPT, 64

/*;*******************************************************************************

;* Function Name : cr4_fft_1024_stm32

;* Description : complex radix-4 1024 points FFT

;* Input : - R0 = pssOUT: Output array .

;* - R1 = pssIN: Input array

;* - R2 = Nbin: =1024 number of points, this optimized FFT function

;* can only convert 1024 points.

;* Output : None

;* Return : None

;*********************************************************************************/

.thumb_func

cr4_fft_1024_stm32:

STMFD SP!, {R4-R11, LR}

MOV r12, #0

MOV r3, r0

MOV r0,#0

preloop_v7:

ADD r14, r1, r12, LSR#22 /*1024pts*/

LDRSH r5, [r14, #2]

LDRSH r4, [r14],#NPT

LDRSH r9, [r14, #2]

LDRSH r8, [r14],#NPT

LDRSH r7, [r14, #2]

LDRSH r6, [r14],#NPT

LDRSH r11, [r14, #2]

LDRSH r10, [r14],#NPT

----------------

The same for 256 Points , just change the similar part to

.equ NPT, 256

/*;*******************************************************************************

;* Function Name : cr4_fft_256_stm32

;* Description : complex radix-4 256 points FFT

;* Input : - R0 = pssOUT: Output array .

;* - R1 = pssIN: Input array

;* - R2 = Nbin: =256 number of points, this optimized FFT function

;* can only convert 256 points.

;* Output : None

;* Return : None

;********************************************************************************/

.thumb_func

cr4_fft_256_stm32:

STMFD SP!, {R4-R11, LR}

MOV r12, #0

MOV r3, r0

MOV r0,#0

preloop_v7:

ADD r14, r1, r12, LSR#24 /*256pts*/

LDRSH r5, [r14, #2]

LDRSH r4, [r14]

ADD r14, #NPT

LDRSH r9, [r14, #2]

LDRSH r8, [r14]

ADD r14, #NPT

LDRSH r7, [r14, #2]

LDRSH r6, [r14]

ADD r14, #NPT

LDRSH r11, [r14, #2]

LDRSH r10, [r14]

ADD r14, #NPT

Cheers,

STOne-32.