Basic Troubleshooting Help - Teensy 4.1 + Audio Shield + Adafruit MAX 98306

Sakuyal

Member
Hey folks,

Having trouble getting audio playing through the Adafruit MAX 98306 amp and have come here for some guidance.

Right now I'm just using the basic WavFilePlayer script and have downloaded the first sample audio (SDTEST1.wav) to the SD card. When I run the script and plug my headphones in I can hear the sound fine, but no sound is coming through the speakers on the amp side.

I did some basic multimeter troubleshooting and made sure the connections were good and no shorts were involved (I found that the connection from L- to ground was faulty but have since fixed it to no improvement). Unfortunately I don't own a multimeter with fine enough A/C detection to measure what is coming through on the amp side, if anything.

Connections to the amp are:
VDD: 3.3V from Teensy 4.1
GND: common ground
L+: L lineout from audio shield
L-: common ground
R+: R lineout from audio shield
R-: common ground
The ground lineout on the audio shield is also connected to common ground.

The speakers I'm using are 4 ohm 3 watt speakers.

So yes, guidance would be appreciated! I've attached my code and pictures of the circuit below (there is more going on on the board but since sound works via headphones I don't suspect anything there to be the problem). Right now my best guess is that the amp might need more power than the Teensy can provide, but other than that not sure what else to try.
img_0620_compressed.jpg
img_0621_compressed.jpg
.

C:
// Simple WAV file player example
//
// Three types of output may be used, by configuring the code below.
//
//   1: Digital I2S - Normally used with the audio shield:
//         http://www.pjrc.com/store/teensy3_audio.html
//
//   2: Digital S/PDIF - Connect pin 22 to a S/PDIF transmitter
//         https://www.oshpark.com/shared_projects/KcDBKHta
//
//   3: Analog DAC - Connect the DAC pin to an amplified speaker
//         http://www.pjrc.com/teensy/gui/?info=AudioOutputAnalog
//
// To configure the output type, first uncomment one of the three
// output objects.  If not using the audio shield, comment out
// the sgtl5000_1 lines in setup(), so it does not wait forever
// trying to configure the SGTL5000 codec chip.
//
// The SD card may connect to different pins, depending on the
// hardware you are using.  Uncomment or configure the SD card
// pins to match your hardware.
//
// Data files to put on your SD card can be downloaded here:
//   http://www.pjrc.com/teensy/td_libs_AudioDataFiles.html
//
// This example code is in the public domain.

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

AudioPlaySdWav           playWav1;
// Use one of these 3 output types: Digital I2S, Digital S/PDIF, or Analog DAC
AudioOutputI2S           audioOutput;
//AudioOutputSPDIF       audioOutput;
//AudioOutputAnalog      audioOutput;
//On Teensy LC, use this for the Teensy Audio Shield:
//AudioOutputI2Sslave    audioOutput;

AudioConnection          patchCord1(playWav1, 0, audioOutput, 0);
AudioConnection          patchCord2(playWav1, 1, audioOutput, 1);
AudioControlSGTL5000     sgtl5000_1;

// Use these with the Teensy Audio Shield
//#define SDCARD_CS_PIN    10
//#define SDCARD_MOSI_PIN  7   // Teensy 4 ignores this, uses pin 11
//#define SDCARD_SCK_PIN   14  // Teensy 4 ignores this, uses pin 13

// Use these with the Teensy 3.5 & 3.6 & 4.1 SD card
#define SDCARD_CS_PIN    BUILTIN_SDCARD
#define SDCARD_MOSI_PIN  11  // not actually used
#define SDCARD_SCK_PIN   13  // not actually used

// Use these for the SD+Wiz820 or other adaptors
//#define SDCARD_CS_PIN    4
//#define SDCARD_MOSI_PIN  11
//#define SDCARD_SCK_PIN   13

void setup() {
  Serial.begin(9600);

  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(8);

  // Comment these out if not using the audio adaptor board.
  // This may wait forever if the SDA & SCL pins lack
  // pullup resistors
  sgtl5000_1.enable();
  sgtl5000_1.volume(0.5);

  SPI.setMOSI(SDCARD_MOSI_PIN);
  SPI.setSCK(SDCARD_SCK_PIN);
  if (!(SD.begin(SDCARD_CS_PIN))) {
    // stop here, but print a message repetitively
    while (1) {
      Serial.println("Unable to access the SD card");
      delay(500);
    }
  }
}

void playFile(const char *filename)
{
  Serial.print("Playing file: ");
  Serial.println(filename);

  // Start playing the file.  This sketch continues to
  // run while the file plays.
  playWav1.play(filename);

  // A brief delay for the library read WAV info
  delay(25);

  // Simply wait for the file to finish playing.
  while (playWav1.isPlaying()) {
    // uncomment these lines if you audio shield
    // has the optional volume pot soldered
    //float vol = analogRead(15);
    //vol = vol / 1024;
    // sgtl5000_1.volume(vol);
  }
}


void loop() {
  playFile("SDTEST1.WAV");  // filenames are always uppercase 8.3 format
  delay(500);
  //playFile("SDTEST2.WAV");
  //delay(500);
  //playFile("SDTEST3.WAV");
  //delay(500);
  //playFile("SDTEST4.WAV");
  //delay(1500);
}
 
I would probably use the Teensy's 5V output (at the Vin pin) instead of the 3.3Volt output (4 ohm speakers could be a lot of power at 3.3V).
Did you set the jumpers for gain correctly? Here is what the information page says:
Regards,
Ed
 
I would probably use the Teensy's 5V output (at the Vin pin) instead of the 3.3Volt output (4 ohm speakers could be a lot of power at 3.3V).
Did you set the jumpers for gain correctly? Here is what the information page says:
Regards,
Ed
Hello Ed,

Sorry for the delayed reply.

I switched the voltage input to Vin but it didn't seem to do much good. Tried switching gain settings around too to no avail.

I got another board in I'm going to try and hook up to see if that works, and if it does go backwards from there...

Will update with any developments!
 
Back
Top