FFT DSP problems

For Flowcode users to discuss projects, flowcharts, and any other issues related to Flowcode 6.

Moderator: Benj

Post Reply
hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

FFT DSP problems

Post by hyperion007 »

Hi,

So I've been struggling all day today trying to get the FFT DSP component to work. For some reason I thought that it would be possible to run the DSP components on 8 bit PICs and not exclusively on 16 bit PICs but I got all sorts of errors trying to compile my test program when having an 8 bit PIC selected as the target chip.

So I switched to an 33EP256GP504 and basically copied the FFT example program in the help Wiki and... no...
First of all the ADC RawSampleInt() and for that matter RawSampleByte() macros that should work just fine as long as you have used the RawEnable, just as the FFT Test example in the Wiki.
But sadly it seems to halt at RawSampleInt(). Adding a RawDisable() after the RawSampleInt() makes it work though. Since I'm only using one ADC pin just as the example, the RawDisable shouldn't be needed according to the Wiki.

I then tried every config change I could think of to try to get some results printed on my display and even though I got something printed, it didn't seem to matter what I used as an input or how the FFT sample rate or accuracy etc. was set up, the printed results on the display kind of looked like noise and the data in the FFTData[128] array only varied by 1 or 2 as in: [63,63,63,64,63,64,63,65,...]

I have a function/arbitrary waveform generator that I used to try to get a value from one of the FFT Frequency Bins to stand out but sadly no.

The program evolved to something that doesn't even contain any FFT or DSP components anymore so I have nothing to upload.

I started tinkering with the plot and DrawLine display macros for the SSD1306 instead and got that working quite nicely if I do say so myself :)

But, if anyone could perhaps have a go at the FFT example to see if they can get it working and posting a working program I would be very grateful. I want to use it together with my other project (Video here: http://youtu.be/a6XfC257a2A ) to make the RGB LEDs react to sound like a light organ. I used to love that when I was a kid, but the two ones I got to play with (I got one new for my birthday one year, it was crap, barely worked and had a built in microphone. The second one was given to me by a friends's dad who built it from a kit back in the early 70's)
OLED Waveform.jpg
(326.03 KiB) Downloaded 459 times

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: FFT DSP problems

Post by hyperion007 »

I might have found a reason for my problems with the FFT. I didn't understand that the FFT needs both negative and positive values to work but it should have been kind of obvious with the calculation box "data=data-512"

I'll have another go and see what I can come up with.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: FFT DSP problems

Post by hyperion007 »

Well that was part of the problem but the big problem seems to be the timing of the sample period.

Any suggestions on how to go about this would be great.

hyperion007
Posts: 528
Joined: Sat Dec 01, 2012 1:23 pm
Location: Sweden
Has thanked: 49 times
Been thanked: 101 times
Contact:

Re: FFT DSP problems

Post by hyperion007 »

Thought I might bump this one a bit :)

Post Reply