Inverse FFT (IFFT)

General discussion on mikroBasic PRO for dsPIC30/33 and PIC24.
Post Reply
Author
Message
shunt010
Posts: 7
Joined: 22 Sep 2013 10:15

Inverse FFT (IFFT)

#1 Post by shunt010 » 20 May 2017 17:37

I am desperate to carry out IFFT, but I cannot find any source code examples and am pulling my hair out trying to do it!

I have the following:-

fft(6,@TwiddleCoeff_64,fftbuffer3)
bitreversecomplex(6,fftbuffer3)

'At this point we have FFT ready to work on...


'Now do the inverse FFT
for lowTmpByte=1 to 127 step 2
FFTbuffer3[lowtmpbyte]=FFTbuffer3[lowtmpbyte] xor 65535
next lowtmpbyte

fft(6,@TwiddleCoeff_64,fftbuffer3)
bitreversecomplex(6,fftbuffer3)



But this just returns nonsense garbage.

Have checked all my buffers are loading/unloading properly by passing through - only using the real numbers (0,2,4,6...124,126). That's all good.

Just the FFT/IFFT doesn't work as promised.

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Inverse FFT (IFFT)

#2 Post by lana.arsic » 22 May 2017 17:51

Hi,

Unfortunately, we don't have function for IFFT.

Did you try FFT example, did it work?
You can find that example in installation folder in the compiler, for example in:

c:\Users\Public\Documents\Mikroelektronika\mikroBasic PRO for dsPIC\Examples\Digital Signal Processing\FFT\

If that example works, you can try to write IFFT on this way:

viewtopic.php?f=101&t=59619#p236670

If that example doesn't work, which MCU are you using?

Kind regards,
Lana

shunt010
Posts: 7
Joined: 22 Sep 2013 10:15

Re: Inverse FFT (IFFT)

#3 Post by shunt010 » 22 May 2017 20:04

The problem is my circuit doesn't have an easy way for me to verify the FFT, but I have managed to now set up a system whereby I can dump the FFT out.

The FFT doesn't appear to be working unfortunately.

The CPU is dsPIC33FJ128GP802.

The arrays are all in Y mem as specified, it's the first one in the program so lines up with the boundaries as specified for the bit reversals, etc.

Arrays 128 words long, the input is even as simple as a sine wave, between 16000 and 48000 (Approx), centred on 32767, and it doesn't work properly.

At least I think I'm as far along as possibly diagnosing the FFT command isn't working, or perhaps I'm not using it properly.

Can send you the ASM if you want?

User avatar
lana.arsic
mikroElektronika team
Posts: 1715
Joined: 15 Jan 2016 12:50

Re: Inverse FFT (IFFT)

#4 Post by lana.arsic » 24 May 2017 10:53

Hi,

Did you check if you set up Project Settings properly?

Unfortunately, at this moment I don't have dsPIC33FJ128GP802,
so I cannot try FFT example on it, but which signal did you get when you run example?

Except frequency, does your input signal satisfies another requirements
written in example?

Kind regards,
Lana

Post Reply

Return to “mikroBasic PRO for dsPIC30/33 and PIC24 General”