PCM5012 I2S DAC with Teensy 4.1

thecomfychair

Active member
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.
 
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
 
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...
 
...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/5306...Module-via-I2S?p=183169&viewfull=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.
2192b9ad-0c67-44a7-984e-85db6f39f117.jpgPCM51022.jpg

I also realise I made a typo in the topic title: the chip in question is of course the PCM5102.
 
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/5306...Module-via-I2S?p=183169&viewfull=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.
 
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!
 
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.

F772DC7D-DF2E-4C26-B841-767209A2FEC1.jpeg
 
Can the VIN pin of Teensy 4.1 be used to power the PCM5102, or must the power be separately regulated ?
 
Back
Top