Hey folks!
I got my teensy 4.0 hooked up to a rev C audio board. I followed the directions on the schematic page. I didn't hook up any of the Volume Pot, SD Card or Memory Chip wires, because I don't have any of those in use.
I am using arduino 1.8.10, with the teensyloader 1.48-beta1.
Things are working fine (not experiencing any audio clock jitter as far as I can tell) - however, I cannot get any audio code to work _unless_ I run analogRead during the setup function:
Code:
#include <Audio.h>
#include <Wire.h>
#include <SD.h>
#include <SPI.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=294,323
AudioEffectFreeverbStereo freeverbs1; //xy=592,499
AudioOutputI2S i2s1; //xy=756,481
AudioConnection patchCord1(waveform1, freeverbs1);
AudioConnection patchCord2(freeverbs1, 0, i2s1, 0);
AudioConnection patchCord3(freeverbs1, 1, i2s1, 1);
AudioControlSGTL5000 sgtl5000_1; //xy=805,363
// GUItool: end automatically generated code
int count=1;
int a1history=0;
void setup() {
// this is the offending line, and I'm not sure why it is necessary
// it can be placed anywhere within setup, it doesn't seem to matter
a1history = analogRead(A1);
AudioMemory(10);
Serial.begin(115200);
sgtl5000_1.enable();
sgtl5000_1.volume(0.3);
waveform1.begin(WAVEFORM_SINE);
delay(1000);
}
void loop() {
Serial.print("Beep #");
Serial.println(count);
Serial.println(AudioProcessorUsageMax());
AudioProcessorUsageMaxReset();
count = count + 1;
waveform1.frequency(440);
waveform1.amplitude(0.9);
wait(250);
waveform1.amplitude(0);
wait(1750);
}
void wait(unsigned int milliseconds)
{
delay(milliseconds);
}
I tested this with the guitar sample as well, and got the same results (no functioning unless I added analogRead).
When I don't include the analogRead line, and the audio isn't working, the serial monitor fails to work as well, and I can't write new programs without pressing the reset button.
attached shows my setup, which is admittedly a little rough, but just as long as everything is seated right, these results are reproducible.
