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

Thread: PCM5012 I2S DAC with Teensy 4.1

  1. #1

    PCM5012 I2S DAC with Teensy 4.1

    I'm trying to use the PCM5012, a cheap DAC from Aliexpress, for an audio project that's been in development for a while. The PCM5012 has been stable-ish in the past, but now I can't get any audio from the output jack. This is the same with two different modules.
    In between times, the only thing I think has changed was updating from TD 1.54 to 1.55, but this may be unconnected.

    My current setup is:
    PCM5012 - Teensy 4.1
    VIN - 3.3V
    GND - GND
    LCK - 20
    DIN - 7
    BCK - 21
    SCK - 23 (although I have also tried tying SCK to GND)

    For a sanity check, I'm running a stripped back version of the Hardware Test code from the Audio Library:
    Code:
    #include <Audio.h>
    #include <Wire.h>
    #include <SD.h>
    #include <SPI.h>
    #include <SerialFlash.h>
    #include <Bounce.h>
    
    AudioSynthWaveform    waveform1;
    AudioOutputI2S        i2s1;
    AudioConnection       patchCord1(waveform1, 0, i2s1, 0);
    AudioConnection       patchCord2(waveform1, 0, i2s1, 1);
    AudioControlSGTL5000  sgtl5000_1;
    
    int count=1;
    
    void setup() {
      AudioMemory(10);
      Serial.begin(9600);
      sgtl5000_1.enable();
      sgtl5000_1.volume(0.3);
      waveform1.begin(WAVEFORM_SINE);
      delay(1000);
     
    }
    
    void loop() {
      Serial.print("Beep #");
      Serial.println(count);
      count = count + 1;
      waveform1.frequency(440);
      waveform1.amplitude(0.9);
      delay(250);
      waveform1.amplitude(0);
      delay(1750);
    }
    Does anyone know of any Audio Library bugs in 1.55 that might be causing this? Or whether support for certain DACs has been removed?
    If not, then I'm presuming it's a hardware issue and I may need to buy a different DAC.

  2. #2
    Senior Member
    Join Date
    May 2013
    Posts
    131
    You should power the DAC board with 5V, not 3.3V.

    At least that was the case with my DAC board (PCM5102 based).

  3. #3
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    732
    Your code is running fine on Arduino 1.8.15 & Teensyduino 1.55.
    Using the same board here that bigpilot referred to. And indeed powered that board by 5V.
    What exact Aliexpress DAC board do you have?

    Paul

  4. #4
    Good shout, just gave it a try. Don't remember needing 5V before, though, from what I've read around the interwebs, the PCB has a voltage regulator so it's 3.3V and 5V safe.

    It seems to be solved now: while messing around further with the wiring, I tried the running power and ground jumpers from directly next to the corresponding pins on the Teensy, as opposed to from my breadboard's power/GND lines. Guess my breadboard is getting a little past it.

    Thank you very much for your thoughts bigpilot, I'll also be following your audio player project with interest as I'm on a similar quest!

    Also cheers for confirming the code side is working Paul, eliminates one side of the equation!

    Apologies for noob fault-finding on my part...

  5. #5
    ...Spoke too soon. It worked for a moment, but has reverted back to no output. I have tried:

    - 3.3V and 5V for power
    - sending SCK to GND or 23 on my T4.1
    - driving the other pins on the back high or low according to JayShoe's findings a couple of years ago (https://forum.pjrc.com/threads/53069...l=1#post183169).
    (this last step should be redundant, as the PCB I have includes solder jumpers to achieve the same thing)

    What exact Aliexpress DAC board do you have?
    This appears to be fucntionally the same as what I have.
    Click image for larger version. 

Name:	2192b9ad-0c67-44a7-984e-85db6f39f117.jpg 
Views:	14 
Size:	338.9 KB 
ID:	26422Click image for larger version. 

Name:	PCM51022.jpg 
Views:	14 
Size:	68.7 KB 
ID:	26423

    I also realise I made a typo in the topic title: the chip in question is of course the PCM5102.

  6. #6
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    25,491
    Quote Originally Posted by thecomfychair View Post
    I have tried:

    - 3.3V and 5V for power
    - sending SCK to GND or 23 on my T4.1
    - driving the other pins on the back high or low according to JayShoe's findings a couple of years ago (https://forum.pjrc.com/threads/53069...l=1#post183169).
    Maybe share some photos, so we can see how you've actually connected the hardware.

    Many times on this forum, when hardware that is known to be able to work has problems, we're able to spot a wiring mistake or misunderstanding only when we can actually see the wiring in photos. So please don't be shy. Take some photos and post them here.

  7. #7
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    732
    According to this thread, message #40, the SCK pin must be connected to GND.

    Hope this helps,
    Paul

  8. #8
    According to this thread, message #40, the SCK pin must be connected to GND.
    I saw that advice too. Unfortunately no dice with this configuration either.

  9. #9
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    732
    Well, then I hope you can show us some close-up photos of your setup.

    Paul

  10. #10
    Update: in clearing down my breadboard and rewiring just the DAC to take a good photo of the setup, the DAC appears to now be stable again. (Perhaps leaving it to sleep overnight and think about its attitude helped...)
    The solutions were, as you both correctly surmised, wiring SCK to GND, and using 5V power instead of 3.3V (I was misled on that one). Unsure why that setup didn't work yesterday, but I'm not going to argue with it today.
    Again thank you both for your assistance!

  11. #11
    Senior Member ETMoody3's Avatar
    Join Date
    Mar 2014
    Location
    New Ulm, Mn
    Posts
    178
    I've got a bunch of these and they work fine for me with several different microcontrollers.

    Note on top of the card right by the silkscreen of SCK there is a pair of pads. Bridging them with solder connects SCK to ground.

    This card has * 2 * low dropout converters, you must power the card with 5 volts.

    Click image for larger version. 

Name:	F772DC7D-DF2E-4C26-B841-767209A2FEC1.jpeg 
Views:	18 
Size:	130.8 KB 
ID:	26442

  12. #12
    Senior Member PaulS's Avatar
    Join Date
    Apr 2015
    Location
    Netherlands
    Posts
    732
    Quote Originally Posted by ETMoody3 View Post
    This card has * 2 * low dropout converters, you must power the card with 5 volts.
    Yes, the pad on the bottom labeled A3V3 is an output of one of the LDO voltage regulators.

    Paul

Posting Permissions

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