Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 8 of 8

Thread: Teensy prop shield amp. Need troubleshooting assistance

  1. #1

    Teensy prop shield amp. Need troubleshooting assistance

    I just purchased a new prop shield and teensy 3.5. Both are wired up as seen in the pictures linked below. DAC on the prop is connected to DA0. The only pin not connected is A17 because the pads came off... according to everything I read on this website that shouldn't be used by the prop shield anyway.

    Right now, I'm trying to run the following code to play the SD test 1 file from the example given on here.

    Code:
    /////////////////////////////////////////////////////////////////////////////
    //////////////////////////LIBRARIES AND VARIABLES////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    
    const int ledPin = 13;
    
    // GUItool: begin automatically generated code
    AudioPlaySdWav           playSdWav1;     //xy=107,61
    AudioPlaySdWav           playSdWav2;     //xy=108,126
    AudioMixer4              mixer1;         //xy=429,117
    AudioOutputAnalog        dac1;           //xy=766,61
    AudioConnection          patchCord1(playSdWav1, 0, mixer1, 0);
    AudioConnection          patchCord2(playSdWav1, 1, mixer1, 1);
    AudioConnection          patchCord3(playSdWav2, 0, mixer1, 2);
    AudioConnection          patchCord4(playSdWav2, 1, mixer1, 3);
    AudioConnection          patchCord5(mixer1, dac1);
    // GUItool: end automatically generated code
    
    /////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////SDCARD SETUP/////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    // Use these with the Teensy Audio Shield
    //#define SDCARD_CS_PIN    10
    //#define SDCARD_MOSI_PIN  7
    //#define SDCARD_SCK_PIN   14
    
    // Use these with the Teensy 3.5 & 3.6 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
    
    
    
    /////////////////////////////////////////////////////////////////////////////
    ///////////////////////////////////SETUP/////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    void setup()
    {
      
      Serial.begin(9600);    //initialize serial communication
    
      
      AudioMemory(20); //set memory allocated to audio functions
      dac1.analogReference(EXTERNAL); //much louder!
    
      mixer1.gain(0, 1);
      mixer1.gain(1, 1);
      mixer1.gain(2, 1);
      mixer1.gain(3, 1);
      
      delay(50);             //time for DAC voltage stabilization
      pinMode(5, OUTPUT);
      digitalWrite(5, HIGH); // turn on the amplifier
      delay(10);
      
      
      SPI.setMOSI(SDCARD_MOSI_PIN);   //set SD card MOSI pin
      SPI.setSCK(SDCARD_SCK_PIN);     //set SD card clock pin
    
      pinMode(ledPin, OUTPUT); //board indicator LED
    
    }
    
    
    
    
    /////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////LOOP/////////////////////////////////////
    /////////////////////////////////////////////////////////////////////////////
    void loop() 
    {
      if(playSdWav1.isPlaying()==false)
      {
        playSdWav1.play("SDTEST1.WAV");
        digitalWrite(ledPin, HIGH);
      }
    }
    I am getting a slight buzz from the speaker as though it is on, but no pop and no sound.

    I've successfully run the SD check test which shows the file on the card, tried two differend SD's (a no name 1gb and 16gb sandisk), I've tested it with two known working speakers, and I've succesfully calibrated and used the motion sensors and simulated it using the processing visualizer. I haven't tested the LED drivers yet. I'm just powering it with computer usb, which has worked in the past. I did a clean install of arduino 1.8.6 and teensy duino (whatever the latest is) plus libraries.

    I'm not sure what I'm doing wrong here. I've had this working before. If someone could please provide a second set of eyes, I would greatly appreciate it.

    Thank you!

    PICTURES: https://imgur.com/a/FTYlZmF

  2. #2
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    I think that it’s pin5 which has to be configured as output and to be asserted (driven high) to enable the amplifier on the prop shield. Not sure about the PIN number, please look up in the prop shield documentation.

  3. #3
    That's correct. If you look in my code, you can see I have implemented the exact same setup code from the prop shield page with the exception of the mixer gain. https://www.pjrc.com/store/prop_shield.html

  4. #4
    Senior Member+ Theremingenieur's Avatar
    Join Date
    Feb 2014
    Location
    Colmar, France
    Posts
    1,788
    Sorry, now I see it in your code. Before, at a quick glance, I hadn’t seen it, sorry.

    Next step would be checking the DAC output with an oscilloscope to see if it’s an audio code problem or rather on the prop shield side.

  5. #5
    Quote Originally Posted by Theremingenieur View Post
    Sorry, now I see it in your code. Before, at a quick glance, I hadnít seen it, sorry.

    Next step would be checking the DAC output with an oscilloscope to see if itís an audio code problem or rather on the prop shield side.
    I don't have an oscilloscope, but I was able to upload my model train code to the teensy and it was outputting audio fine with the OEP20W amplifier.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    18,153
    You need to add this in your setup() function.

    Code:
      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);
        }
      }
    Without SD.begin(), there is no access to the SD card.

  7. #7
    Senior Member+ manitou's Avatar
    Join Date
    Jan 2013
    Posts
    1,572
    oooops, you forgot to init the SD, after delay(10); add
    Code:
      if (!(SD.begin(SDCARD_CS_PIN))) {
        while (1) {
          Serial.println("Unable to access the SD card");
          delay(500);
        }
      }
    your sketch works for me with that addition

  8. #8
    Quote Originally Posted by PaulStoffregen View Post
    You need to add this in your setup() function.

    Code:
      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);
        }
      }
    Without SD.begin(), there is no access to the SD card.
    Thank you guys so much! Works just fine now. Can't believe I missed that... I was staring at the SD example code for an hour and still didn't realize SD.begin() was missing.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •