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

Thread: Teensy 4.0 Quad I2s with 2x PCM5102a - Working!

  1. #1

    Teensy 4.0 Quad I2s with 2x PCM5102a - Working!

    Click image for larger version. 

Name:	20200520_182804.jpg 
Views:	13 
Size:	83.8 KB 
ID:	20210

    Click image for larger version. 

Name:	pcm5102a.jpg 
Views:	3 
Size:	114.0 KB 
ID:	20211

    I found the info in various places on the forum but not all in one place so I thought someone might find it useful like this...

    Thanks to chipaudette who provided the test code and some bits of the puzzle here:

      Demo of the audio sweep function.
      The user specifies the amplitude,
      start and end frequencies (which can sweep up or down)
      and the length of time of the sweep.
      May 2020: Chip Audette (OpenAudio)
        * I tested this with the Teensy 4.1 and two Teensy Audio Shields
        * One shield was unmodified
        * The second shield was modified
          * Cut the trace between the two pads for the audio board's RX (Pin 7) 
          * Cut the tracce between the two pads for the audio board's TX (Pin 8)
          * Add a wire from pin 6 over to the pad that had been connected to pin 8
          * Add a wire from pin 32 to the pad that had been connected to pin 7
          * Cut the trace between the 3 pads that set the audio sheild's address (was LOW)
          * Solder-bridge the center pad to the other pad (sets the address to HIGH)
        * I based this sketch on the standard ToneSweep example
        * I extended for quad audio
        * This only tests the audio output
    #include <Audio.h>
    #include <Wire.h>
    #include <SPI.h>
    #include <SD.h>
    #include <SerialFlash.h>
    #include <Bounce.h>
    AudioSynthToneSweep     myEffect1,myEffect2;
    AudioOutputI2SQuad      audioOutput;        // audio shield: headphones & line-out
    // The tone sweep goes to left and right channels
    AudioConnection         c1(myEffect1, 0, audioOutput, 0);
    AudioConnection         c2(myEffect1, 0, audioOutput, 1);
    AudioConnection         c3(myEffect2, 0, audioOutput, 2);
    AudioConnection         c4(myEffect2, 0, audioOutput, 3);
    AudioControlSGTL5000 audioShield1;
    AudioControlSGTL5000 audioShield2;
    float t_ampx = 0.8;
    int t_lox = 10;
    int t_hix = 22000;
    // Length of time for the sweep in seconds
    float t_timex = 5;
    // <<<<<<<<<<<<<<>>>>>>>>>>>>>>>>
    void setup(void)
      while (!Serial) ;
      Serial.println("setup done");
      //play upward tone sweep through first audio shield
      Serial.println("Playing tone sweep from FIRST audio shield.");
      if(!,t_lox,t_hix,t_timex)) {
        Serial.println("AudioSynthToneSweep 1 - begin failed");
      while(myEffect1.isPlaying());    // wait for the sweep to end
      //play upward tone sweep through the second audio shield
      Serial.println("Playing tone sweep from SECOND audio shield.");
      if(!,t_lox,t_hix,t_timex)) {
        Serial.println("AudioSynthToneSweep 2 - begin failed");
      while(myEffect2.isPlaying());    // wait for the sweep to end
    void loop(void)
    The AudioControlSGTL5000 instances are not needed in the code above but it still works with them in there.

    The wires must be really short! even running wires to one DAC next to the other is too long and will cause issues on the second card. my swift solution was to cut the DIN pin shorter on the top board (this is the only pin that is not shared) and then stack them on top of each other.

    This only started being supported from Teensyduino Version 1.52. previous versions.. the quad I2S output doesn't work on T4

    VCC -- 5v
    3.3v -- I didn't connect this, probably a 3.3v out, see post below.
    GND -- Ground
    FLT -- Ground
    DMP -- Ground
    SCL -- No Connections (leaving floating)
    BCK -- Pin 21
    DIN -- Pin 7 for the first PCM5102a then Pin 32 for the second (this is one of the little tabs on the back on the T4.0, it has a bigger pad on the T4.1
    LCK -- Pin 20
    FMT -- Ground
    XMT -- Ground

    Hopefully at this point - music! or at least a sine sweep.
    Last edited by alrj; 05-20-2020 at 06:31 PM.

  2. #2
    Senior Member+ MichaelMeissner's Avatar
    Join Date
    Nov 2012
    Ayer Massachussetts
    Quote Originally Posted by alrj View Post

    VCC -- 5v
    3.3v -- didn't connect this, maybe it better if you do? time will tell.
    GND -- Ground
    I suspect the 3.3v is the output of the 3.3v voltage regulator on the pcb. I.e. the PCM5102a runs at either 1.8v or 3.3v (max of 3.9v). So the pcb adds a voltage regulator to reduce the 5v down to 3.3v. They presumably added a pin in case you needed 3.3v. I've seen several devices have a similar pin. Since the Teensy has its own voltage regulator, you don't need to use the pin.

  3. #3
    makes sense ta, post edited : )

Posting Permissions

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