pCM5102 DAC and teensy 4.0 am I missing something ?

Keith_M

Well-known member
I purchased this DAC ...https://www.ebay.com/itm/275054014657?
it takes 6 lines
Vcc +5
DGND - Digital ground
AGND - Analog Ground
LRCK - left right clock
DATA - Stream to DAC
BCK - CLOCK

Connected grounds as common to teensy ground. ( See NOTE in vendors Ad about BCK and DATA being reversed)
LRCK Teensy pin 20 (LRCLK1)
DATA Teensy Pin 7 (OUT1A)
BCLK Teensy pin 21 (BCK)
and of course VCC and GND

So far so good ...

I'm running Arduino ide 1.8.16 and teensyduino 1.55

code is as follows

#include <Audio.h>
#include <Wire.h>

AudioInputUSB usb1; //xy=114,159
AudioAmplifier amp2; //xy=266,191
AudioAmplifier amp1; //xy=269,133
AudioOutputI2S i2s1; //xy=406,166
AudioConnection patchCord1(usb1, 0, amp1, 0);
AudioConnection patchCord2(usb1, 1, amp2, 0);
AudioConnection patchCord3(amp2, 0, i2s1, 1);
AudioConnection patchCord4(amp1, 0, i2s1, 0);

void setup()
{
AudioMemory(16);
}

void loop()
{

float vol =usb1.volume();
amp1.gain(vol);
amp2.gain(vol);
delay(100);
}

Teensy is picked up as an audio device in Windows fine , no issues ... no issues compiling , however no sound out . dead as a mouse. I tried sending it a sinewave as well (no happyness) ...

Did I miss something in my script ...

Note I did try the BCK/DATA reverse as indicated in the note (no happyness there either ) ...

There is a jumper on the board that selects from I2S or LJ ( Left Justified) ..I left it on I2S

I had a second teensy 4.0 .. tried it there in case it was a processor issue but same issue ..

Could use some schooling and some pointers ...

NOTE . I have the SGL5000 running fine with the Teensy no issues , but fail to understand what I'm missing when streaming out to an external D/A converter ...

Thanks a heap in advance .. cheers and Happy New Year to all !

Keith
 
Hi Keith, have the same PCM5102 board running on a Teensy 4.0 without problems here.
Your code should work. Your pin assignments are OK. Jumper on my board is also set to I2S.
Can you show a picture of your setup?

Paul
 
( See NOTE in vendors Ad about BCK and DATA being reversed)
That's weird, those pins are marked correctly on the PCB. BCK connects to pin 13 of the PCM5102A, DATA to pin 14.

s-l1600.jpg

Wonder if you received the same board as shown in the ad.

Paul
 
Try adding this under the audio connections.
Code:
AudioControlSGTL5000     codec;
An external codec needs that to be enabled, if I remember correctly.
 
Really looks like it should work.

Maybe for the sake testing edit the code to with "gain = 1.0;"

If you can show us photos of your wiring, maybe we can spot something you might have missed.
 
Thanks for the input , I took a pic , but have not figured out how to post it yet ...I'll try adding the Codec and see what happens .....totally stumped ..and rather suprised! Will post back with results
 
An external codec needs that to be enabled, if I remember correctly.
Adding that codec is not required, this code worked for me:
Code:
// PCM5102 bd   Teensy 3.x    Teensy 4.0
// VCC          Vin           Vin           5V
// GND          GND           GND
// LRCK         23            20            44.1 KHz
// DATA         22            7
// BCK          9             21            2.8224 MHz = 64.LRCK
// --           11            23            MCLK 11.29 MHz

// set Tools > USB Type to Audio

#include <Audio.h>

AudioInputUSB            usb1;
AudioAmplifier           amp2;
AudioAmplifier           amp1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(usb1, 0, amp1, 0);
AudioConnection          patchCord2(usb1, 1, amp2, 0);
AudioConnection          patchCord3(amp2, 0, i2s1, 1);
AudioConnection          patchCord4(amp1, 0, i2s1, 0);

void setup(){
  AudioMemory(12);
}

void loop(){
  float vol = usb1.volume();  // read PC volume setting
  amp1.gain(vol);             // set gain according to PC volume
  amp2.gain(vol);
  delay(100);
}

Paul
 
I took a pic , but have not figured out how to post it yet
Click on the icon in the orange circle and upload your photo.

Capture.PNG

There is a size limitation though. Don't know the exact max size but it will complain when you try to upload a too big photo.

Hope this helps,
Paul
 
Looks like it should work. The wiring looks correct. Very mysterious.

At this point I would try running the LED blink example and set it for pin 7. Then use a voltmeter to check if you can see the changing signal at LRCLK on the DAC board (touch the side of the resistor near that pin). Then repeat for pins 20 and 21. Also try to check that the DAC really has power.

This really should "just" work when the 3 signals are connected properly. Even if the jumper is configured for the wrong format, you should still get recognizable sound but it will be horribly distorted for louder sounds.
 
I know , this should be a no brainer. I've worked on bigger projects then this so its not my first kick at the can .Sort of suprised to be honest , Great idea on tracing the line out using blink .. I have a scope as well ..(200 MHz dual trace)
So I should see something happening on the scope.. Will post up .. "Its a mystery" cheers
 
With a dual trace scope, best to connect LRCLK to the external trigger input. You can look at it briefly with either of the channels to get a visual idea of the horizontal scale, then use both channels to view the other 2 signals while keeping the trigger on LRCLK.
 
Okay ..now I feel stupid (and should of done this before posting) ..I opened up a second board here, swapped the boards out ,ran the sine wave test and I'm good ...So the initial board has an issue .I'l point out its wired as it should be ..but what a bunch of frustration ..I appreciate your time both you and Frank chiming in .. (Frank ..I'm SDR building too !) Cheers !
 
Well, at least you have one board up & running...
The photo you made of the PCM5102 board does not fully look like the one in the Ebay ad - the board misses the silkscreen writing that states "PCM5102MK" etc.
Does the chip itsself have the Burr & Brown logo [BB] printed on the package? There are cheap knock-offs of that chip around...

Paul
 
Well have 3 boards running! .. I have Burr Brown in my studio A/D and D/A hardware ...but I'll check these ..I actually received these boards back in 2021 and am finally getting around to them ...Now working in the A/D portion .going to see if I can get a passthru chain running tonight.! Cheers and thanks for all your insight ..always appreciated !
 
Back
Top