Should I Ground DAC on 3.2?

Status
Not open for further replies.

propa

Well-known member
Hello,

I'm not sure on the answer to this question, I have a minijack connecting to the DAC on the teensy, should I also attach the ground of the jack to the ground on the teensy?.. and as I haven't done this when using it over the last few days, could that be responsible for not getting any signal out of the dac anymore?

I was working all last night and half of today, and have come back to the project in the same situation now not working. I'm wondering if me not grounding the dac had any influence.

Is there a way I can check with a multimeter to see if the dac is outputting anything?

I haven't been using it with an opamp circuit, just been giving it a really decent work out over the last few days.

Tried with example code to rule that out, and nothing

Has anyone else had a similar issue with the 3.2 DAC?


Code:
// Waveform Modulation Example - Create waveforms with 
// modulated frequency
//
// This example is meant to be used with 3 buttons (pin 0,
// 1, 2) and 2 knobs (pins 16/A2, 17/A3), which are present
// on the audio tutorial kit.
//   [url]https://www.pjrc.com/store/audio_tutorial_kit.html[/url]
//
// Use an oscilloscope to view the 2 waveforms.
//
// Button0 changes the waveform shape
//
// Knob A2 changes the amount of frequency modulation
//
// Knob A3 varies the shape (only for Pulse & Variable Triangle)
//
// This example code is in the public domain.

#include <Audio.h>
#include <Wire.h>
#include <SPI.h>
#include <SD.h>
#include <SerialFlash.h>
#include <Bounce.h>

AudioSynthWaveformSine   sine1;          //xy=131,97
AudioSynthWaveformSine   sine2;          //xy=152,170
AudioSynthWaveformModulated waveformMod1;   //xy=354,69
AudioOutputAnalog  dacs1;          //xy=490,209
AudioOutputI2S           i2s1;           //xy=532,140
AudioConnection          patchCord1(sine1, 0, i2s1, 1);
AudioConnection          patchCord2(sine1, 0, dacs1, 1);
AudioConnection          patchCord3(sine1, 0, waveformMod1, 0);
AudioConnection          patchCord4(sine2, 0, waveformMod1, 1);
AudioConnection          patchCord5(waveformMod1, 0, i2s1, 0);
AudioConnection          patchCord6(waveformMod1, 0, dacs1, 0);

Bounce button0 = Bounce(5, 15);
Bounce button1 = Bounce(6, 15);
Bounce button2 = Bounce(7, 15);

int current_waveform=0;

extern const int16_t myWaveform[256];  // defined in myWaveform.ino

void setup() {
  Serial.begin(9600);
  pinMode(5, INPUT_PULLUP);
  pinMode(6, INPUT_PULLUP);
  pinMode(7, INPUT_PULLUP);

  delay(300);
  Serial.println("Waveform Modulation Test");
  
  // Audio connections require memory to work.  For more
  // detailed information, see the MemoryAndCpuUsage example
  AudioMemory(12);

  // Confirgure both to use "myWaveform" for WAVEFORM_ARBITRARY
  waveformMod1.arbitraryWaveform(myWaveform, 172.0);

  // Configure for middle C note without modulation
  waveformMod1.frequency(261.63);
  waveformMod1.amplitude(1.0);
  sine1.frequency(20.3); // Sine waves are low frequency oscillators (LFO)
  sine2.frequency(1.2);

  current_waveform = WAVEFORM_TRIANGLE_VARIABLE;
  waveformMod1.begin(current_waveform);

  // uncomment to try modulating phase instead of frequency
  //waveformMod1.phaseModulation(720.0);
}

void loop() {
  // Read the buttons and knobs, scale knobs to 0-1.0
  button0.update();
  button1.update();
  button2.update();
  float knob_A2 = (float)analogRead(14) / 1023.0;
  float knob_A3 = (float)analogRead(15) / 1023.0;

  // use Knobsto adjust the amount of modulation
  sine1.amplitude(knob_A2);
  sine2.amplitude(knob_A3);

  // Button 0 or 2 changes the waveform type
  if (button0.fallingEdge() || button2.fallingEdge()) {
    switch (current_waveform) {
      case WAVEFORM_SINE:
        current_waveform = WAVEFORM_SAWTOOTH;
        Serial.println("Sawtooth");
        break;
      case WAVEFORM_SAWTOOTH:
        current_waveform = WAVEFORM_SAWTOOTH_REVERSE;
        Serial.println("Reverse Sawtooth");
        break;
      case WAVEFORM_SAWTOOTH_REVERSE:
        current_waveform = WAVEFORM_SQUARE;
        Serial.println("Square");
        break;
      case WAVEFORM_SQUARE:
        current_waveform = WAVEFORM_TRIANGLE;
        Serial.println("Triangle");
        break;
      case WAVEFORM_TRIANGLE:
        current_waveform = WAVEFORM_TRIANGLE_VARIABLE;
        Serial.println("Variable Triangle");
        break;
      case WAVEFORM_TRIANGLE_VARIABLE:
        current_waveform = WAVEFORM_ARBITRARY;
        Serial.println("Arbitary Waveform");
        break;
      case WAVEFORM_ARBITRARY:
        current_waveform = WAVEFORM_PULSE;
        Serial.println("Pulse");
        break;
      case WAVEFORM_PULSE:
        current_waveform = WAVEFORM_SAMPLE_HOLD;
        Serial.println("Sample & Hold");
        break;
      case WAVEFORM_SAMPLE_HOLD:
        current_waveform = WAVEFORM_SINE;
        Serial.println("Sine");
        break;
    }
    waveformMod1.begin(current_waveform);
  }
  
}
 
Hello,

I'm not sure on the answer to this question, I have a minijack connecting to the DAC on the teensy, should I also attach the ground of the jack to the ground on the teensy?.. and as I haven't done this when using it over the last few days, could that be responsible for not getting any signal out of the dac anymore?

I was working all last night and half of today, and have come back to the project in the same situation now not working. I'm wondering if me not grounding the dac had any influence.

Is there a way I can check with a multimeter to see if the dac is outputting anything?

With a one-line sketch (analogWrite(A14,128); in setup()), your meter should show 1.6v on A14 pin. DAC can only source about 1 ma so you shouldn't hook a speaker directly to A14, instead use with an audio amp. you should connect the GND of T3.2 to audio amp GND.

Or jumper A14 to A0 and test with
Code:
// jumper A14 to A0
void setup() {
  Serial.begin(9600);
  while (!Serial);
}

void loop() {
  for (int i = 0; i < 256; i++) {
    analogWrite(A14, i);
    delay(500);
    Serial.printf("%d out  %d in\n", i, analogRead(A0) / 4);
  }
}
 
Last edited:
With a one-line sketch (analogWrite(A14,128); in setup()), your meter should show 1.6v on A14 pin. DAC can only source about 1 ma so you shouldn't hook a speaker directly to A14, instead use with an audio amp. you should connect the GND of T3.2 to audio amp GND.

Or jumper A14 to A0 and test with
Code:
// jumper A14 to A0
void setup() {
  Serial.begin(9600);
  while (!Serial);
}

void loop() {
  for (int i = 0; i < 256; i++) {
    analogWrite(A14, i);
    delay(500);
    Serial.printf("%d out  %d in\n", i, analogRead(A0) / 4);
  }
}

Thank you so much for the helping on debugging, I'm afraid when I jumper A0 and A14 together and run the code, I see the same values as when there is no jumper, and flickers between 30 and 31.

So seemingly I've blown the DAC from over use in the last three(!?) days. Which seems insane to have a functioning board except the dac. Seems insance to even blow the dac from only using wavetable synthesis.

Something else has got to be going on. I refuse to believe the dac die as fast as this.

I've got a decent soundcard, it can pick up the output of the teensy easily, so I haven't been amp'ing the signal. The sound card (Apogee duet) wouldn't have allowed any signals to feed backwards into the device using the line-in right? (Trying to rule out every possibility, the only variable was dusting my room, that was the pause in development, could a mass exodus of dust be responsible? Static maybe? Clutching at straws here trying to think of one solid reason)
 
Something else has got to be going on. I refuse to believe the dac die as fast as this.

Agreed, this does seem unlikely.

Maybe there's some sort of misunderstanding about how to connect the hardware? Can you show us photos of what you're really doing? Maybe we'll be able to spot something you've missed.
 
I'm wondering if me not grounding the dac had any influence.

Re: "grounding the dac"

If you actually tried connecting A14 to GND whilst driving the DAC, then you likely damaged A14 and possibly more of the T3.2
 
Re: "grounding the dac"

If you actually tried connecting A14 to GND whilst driving the DAC, then you likely damaged A14 and possibly more of the T3.2

I haven't attached the ground of the mini jack to the ground of the 3.2.

I built a board for the audio adapter and 3.2 as shown:

audiB.jpg

Usually the Audio board is in there as well, and Audio Ground is routed to ground of the jack, nothing else, when not using the audio board, you have to manually bridge with a wire to get the dac out, which you see with the red wire (originally I had only intended it's use with the audio board)

I tested what Manitou said by using a standard dupont style jumper wire, and was careful not to touch any other pins while doing so.

I've tested the points between the DAC out and the minijack in and the connection is working fine.

I'm running out of options of what to test. But I did get a 2nd 3.6 in the post, I shouldn't really be chasing this loss when there are wins to be had with the new board! At the same time I really really don't like loosing things, or loosing things in such a random fashion!

Also before anyone points out, I know I shouldn't be using 100k pots now, next build I'll put 10k in there.
 
Status
Not open for further replies.
Back
Top