SparkFun Forums 

Where electronics enthusiasts find answers.

Your source for all things Atmel.
By iq66
#89005
Hi
What compiler do you use to compile it?

I cannot get it to work in arduino ide.
Please explain.

Thank you
By ptaa32
#90064
Is there an easy way to get the assembly part into the Arduino IDE?

I would like to try getting a spectrum display on the S65 Shield.
By ptaa32
#90065
As an afterthought:

Guess it would be unpractical with all that inline assy.
The ideal would be as an earlier poster asked for: make a stand-alone library for the FFT.

Hope, hope .... :D
By stevech
#90285
It would be good to change this code that is now in the timer interrupt service routine:
Code: Select all
	
SIGNAL(SIG_OVERFLOW0) { 
...
fft_input(capture, bfly_buff);
fft_execute(bfly_buff);
fft_output(bfly_buff, spektrum);
print_FFT(spektrum, NUM_SAMPLES/2);
to run in the main() code. It's unwise/risky to do library calls like (printf, etc) and do extensive function calls from an ISR - due to reentrancy. Indeed, the butterfly FFT calcs are called from the ISR.
By ptaa32
#90579
Just got the FFT up and running on the Arduino by using AVR Studio.
By iq66
#92534
how did you get the code to compile?
what type of cable do you use for it?

thanx
By ptaa32
#92575
iq66 wrote:how did you get the code to compile?
what type of cable do you use for it?

thanx
I used AVR Studio.

What cable are you referring to?
If it is the prgramming cable, I used Atmel AVR ISP MkII on the 6-pin Arduino ISP connector.
By iq66
#92670
Hi I compiled the code with AVR studio but it gave me 3 compile error. However, they are included in "ffft.h" header file.

fft_input(capture, bfly_buff);
fft_execute(bfly_buff);
fft_output(bfly_buff, spectrum);

How do I get the fundamental frequency from the fft code? I basically need to see the output on the serial terminal. I do not have an lcd display.

Thanx.[/quote]
By ptaa32
#92775
iq66 wrote:Hi I compiled the code with AVR studio but it gave me 3 compile error. However, they are included in "ffft.h" header file.

fft_input(capture, bfly_buff);
fft_execute(bfly_buff);
fft_output(bfly_buff, spectrum);

How do I get the fundamental frequency from the fft code? I basically need to see the output on the serial terminal. I do not have an lcd display.

Thanx.
[/quote]

Maybe you forgot to include the FFFT.S file?
By maokh
#93142
An FFT could be quite useful for other things. There was an attempt about 5 years back to directly decode WWVB on a microcontroller (60KHz time standard in the US), which wasn't entirely successful...but the person didn't really indicate why or even what one he/she was using. There is a 75KHz similar operation in europe.

Id imagine you'd connect the ADC to a loop antenna (perhaps with an op amp on the front end, optional crystal filter if WWVB doesnt come in strong in your location), mix in a PWM near its frequency to get it low in the baseband, and decode it with a low frequency bucket, there might be some success possible.

Its just some 1 bps signal where they cut the power 17dB (ASK) to indicate the type of bit. 17dB should show up with even the crudest of FFT resolutions.

It would be really cool with some wound wire on the ADC line though wouldn't it? you could practically build in a RTC into anything for almost zero cost. You wouldn't really need to run it much either to make use of one of the many arduino software RTC's. Sync when you need to.
By daled
#93220
ptaa32 wrote:As an afterthought:

Guess it would be unpractical with all that inline assy.
The ideal would be as an earlier poster asked for: make a stand-alone library for the FFT.

Hope, hope .... :D
Did you ever find (or make) a version of this code that can be used as a library in the Arduino SDE?
By KreAture
#93496
So, how many FFT's/second did you finally manage?

On ATMega64 at 16 MHz I can do 128 FFT in 13ms with conversion to phase/magnitude taking 8ms.

On the MSP430 at 16 MHz I can do a 128 FFT in 11ms with conversion to phase/magnitude taking 6ms.
By chipaudette
#191732
Just in case anyone else is looking for FFT code, I did some benchmarking tests of FFT on different flavors of Arduino, and on a Teensy. My write-up below shows the relative speeds of the different boards. It also has a link to my GitHub for the FFT and benchmarking code:

https://openaudio.blogspot.com/2016/09/ ... speed.html

My results show that the Arduino Uno is, predictably, very very slow in doing FFTs. The Teensy (especially the new K66-based Teensy 3.6) is way better for such computational tasks.

Chip