[SOLVED] Teensy 3.2 and I2S DAC PCM5102

Hi,

I’m trying to use the Teensy Audio library to output audio to a PCM5102 I2S DAC, but I fail to get any audio out of it.

My connections are as follows:

**PCM5102 ** Teensy 3.2








VIN 3.3V
GND GND
LRCK 23
DIN 22
BCK 9
SCK 11
FLT GND (normal latency)
DEMP GND (de-emphasis off)
XSMT 3.3V (soft un-mute)
FMT GND (I²S format)

This is the code I’ve tried. I have no idea if it is even remotely correct, since I only found examples with the SGTL5000 DAC, but not for a generic I2S DAC.

#include <Audio.h>

AudioSynthWaveformSine   sine1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(sine1, 0, i2s1, 0);
AudioConnection          patchCord2(sine1, 0, i2s1, 1);

void setup() {                
  // AudioMemory(12);
  // i2s1.begin();
  AudioNoInterrupts();
  sine1.frequency(440);
  sine1.amplitude(0.5);
  AudioInterrupts();
}

void loop() {}

I would be very grateful if someone could point me in the right direction.

Pieter

It would make more sense to ask this in the PJRC Audio forum

Pete

Thanks, I didn't know they had an entire forum for it. It doesn't seem to be well indexed by Google. I'll look through it tomorrow, and post my question there if I can't find an answer.

The solution was to call AudioMemory(4) but not i2s1.begin().

#include <Audio.h>

AudioSynthWaveformSine   sine1;
AudioOutputI2S           i2s1;
AudioConnection          patchCord1(sine1, 0, i2s1, 0);
AudioConnection          patchCord2(sine1, 0, i2s1, 1);

void setup() {                
  AudioMemory(4);
  AudioNoInterrupts();
  sine1.frequency(440);
  sine1.amplitude(0.5);
  AudioInterrupts();
}

void loop() {}