fft doesn't run fft.available() always returns 0

Status
Not open for further replies.

dimivb01

New member
Hi guys,
I m trying a simple project with Teensy 3.1. I want to read and adc input and perform an fft on it. For troubleshooting I cutout all the irrelevant code and I am left with this.

The problem is that myFFT.available() call always returns a 0.

I have an adafruit electret microphone I am powering from the teensy 3.3Vout. I can disconnect it - no difference. I know the code runs since the LED blinks and I do get some output on the serial monitor.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>

// GUItool: begin automatically generated code
AudioInputAnalog adc1;
AudioAnalyzeFFT1024 myFFT;
AudioConnection patchCord1(adc1, 0, myFFT, 0);
// GUItool: end automatically generated code
float level[16];

void setup() {
// put your setup code here, to run once:

Serial.begin(115200);
AudioMemory(12);
pinMode(10, OUTPUT);

// Configure the window algorithm to use
myFFT.windowFunction(AudioWindowHanning1024);
}

void loop() {
// put your main code here, to run repeatedly:
Serial.println("start: ");
digitalWriteFast(10, !digitalReadFast(10));
Serial.println(myFFT.available());
delay(100);
level[1] = myFFT.read(1);
Serial.println(level[1]);
Serial.print(" cpu:");
Serial.println(AudioProcessorUsageMax());
// delay(1000);
}

Any thoughts on why I keep getting myFFT.available() always = 0?

Thanks
 
The question is if the signal of the electret microphone is strong enough... You could check that with your oscilloscope or by connecting the DAC output directly to the ADC input as a kind of "monitor" function. Or you take your function generator and feed a 400Hz 1Vpp sine wave into the ADC.
 
I have an adafruit electret microphone I am powering from the teensy 3.3Vout. I can disconnect it - no difference. I know the code runs since the LED blinks and I do get some output on the serial monitor.

Are you sure the put the actual code here ?
Teensy3.1 LED is on pin 13 and not Pin10.

please give a functioning code that demonstrates the problem
 
Last edited:
Thanks Paul. It seems the clock speed was the problem. I set it to 96MHz and now I can read values. YAY!
 
Status
Not open for further replies.
Back
Top