Somewhere between the Teensy (3.2) and the Audio Adapter, something has stopped working where I can no longer hear sound. I assume it is the audio adapter, but I'd like to get a better idea as to what the issue may be before I go out and spend $20 to fix it (ie: get a new one).
I'll start with what I think could possibly have caused an issue:
The only thing I can think of that I have done that could potentially cause a part to fail is, during a brief lapse in attention, I accidentally connected the audio adapter and the Teensy transposed by one. As opposed to the normal mapping of pins, this would have resulted in the following:
[tr]
I worry that this may have caused a short, unexpected/unpredictable voltages (given that GND/3.3V were not correctly mapped) or otherwise cause unexpected results causing the SGTL5000 chip to fail.
Below is a simple example sketch that has worked for me in the past and should be independent of wiring configuration, it also uses an LED, which is still working, so I know that, if there is an issue with the Teensy rather than the audio board, it is at least limited in scope.
If nothing here is sufficient to declare it dead, I can provide more information or run some additional tests (I don't have an oscilloscope, though).
I'll start with what I think could possibly have caused an issue:
The only thing I can think of that I have done that could potentially cause a part to fail is, during a brief lapse in attention, I accidentally connected the audio adapter and the Teensy transposed by one. As opposed to the normal mapping of pins, this would have resulted in the following:
Teensy | Audio Adapter |
GND | --- |
+3.3V | --- |
7 | MEMCS |
8 | MOSI |
10 | BCLK |
11 | SDCS |
12 | MCLK |
--- | MOSI |
23 | +3.3V |
22 | LRCLK |
21 | TX |
18 | SCL |
17 | SDA |
14 | VOL |
13 | SCLK |
--- | RX |
I worry that this may have caused a short, unexpected/unpredictable voltages (given that GND/3.3V were not correctly mapped) or otherwise cause unexpected results causing the SGTL5000 chip to fail.
Below is a simple example sketch that has worked for me in the past and should be independent of wiring configuration, it also uses an LED, which is still working, so I know that, if there is an issue with the Teensy rather than the audio board, it is at least limited in scope.
Code:
#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
// GUItool: begin automatically generated code
AudioSynthWaveform waveform1; //xy=415,314
AudioEffectEnvelope envelope1; //xy=617,310
AudioOutputI2S i2s1; //xy=865,324
AudioConnection patchCord1(waveform1, envelope1);
AudioConnection patchCord2(envelope1, 0, i2s1, 0);
AudioConnection patchCord3(envelope1, 0, i2s1, 1);
AudioControlSGTL5000 codec; //xy=877,265
// GUItool: end automatically generated code
int ledPin = 13;
// Helper function for converting MIDI note to frequency
float calcFreq(byte note){
return (pow(2,(note-69)/12.0)*440);
}
// Handler function for MIDI note on
void OnNoteOn(byte channel, byte note, byte velocity)
{
AudioNoInterrupts();
waveform1.frequency(calcFreq(note));
waveform1.amplitude(velocity/127.0);
envelope1.noteOn();
AudioInterrupts();
digitalWrite(ledPin, HIGH);
}
// Handler function for MIDI note off
void OnNoteOff(byte channel, byte note, byte velocity)
{
envelope1.noteOff();
digitalWrite(ledPin, LOW);
}
void setup() {
pinMode(ledPin, OUTPUT);
AudioMemory(18); // Way more audio memory than needed
codec.enable();
codec.volume(0.45);
waveform1.begin(0,0,WAVEFORM_SINE);
usbMIDI.setHandleNoteOff(OnNoteOff);
usbMIDI.setHandleNoteOn(OnNoteOn);
envelope1.attack(9.2);
envelope1.hold(2.1);
envelope1.decay(31.4);
envelope1.sustain(0.6);
envelope1.release(84.5);
digitalWrite(ledPin, HIGH);
delay(1000);
digitalWrite(ledPin, LOW);
delay(1000);
}
void loop() {
usbMIDI.read();
}
If nothing here is sufficient to declare it dead, I can provide more information or run some additional tests (I don't have an oscilloscope, though).