Author Topic: Recieved DigiX and have problem with DAC0.  (Read 4032 times)

mubase

  • Newbie
  • *
  • Posts: 11
Recieved DigiX and have problem with DAC0.
« on: December 30, 2013, 08:40:50 am »
Hi all. I recieved my digiX through the post yesterday with thanks.
I intend to use it for Audio and Wifi and have had success with connecting the Wifi to my Android tablet but am having problems with the DAC.
As a test I thought I would try this sketch from RCArduino:
Code: [Select]
/*
  Simple Waveform generator with Arduino Due

  * connect two push buttons to the digital pins 2 and 3
    with a 10 kilohm pulldown resistor to choose the waveform
    to send to the DAC0 and DAC1 channels
  * connect a 10 kilohm potentiometer to A0 to control the
    signal frequency

 */

#include "Waveforms.h"

#define oneHzSample 1000000/maxSamplesNum  // sample for the 1Hz signal expressed in microseconds

const int button0 = 2, button1 = 3;
volatile int wave0 = 0, wave1 = 0;

int i = 0;
int sample;


void setup() {
  analogWriteResolution(12);  // set the analog output resolution to 12 bit (4096 levels)
  analogReadResolution(12);   // set the analog input resolution to 12 bit

  attachInterrupt(button0, wave0Select, RISING);  // Interrupt attached to the button connected to pin 2
  attachInterrupt(button1, wave1Select, RISING);  // Interrupt attached to the button connected to pin 3
}

void loop() {
  // Read the the potentiometer and map the value  between the maximum and the minimum sample available
  // 1 Hz is the minimum freq for the complete wave
  // 170 Hz is the maximum freq for the complete wave. Measured considering the loop and the analogRead() time
  sample = map(analogRead(A0), 0, 4095, 0, oneHzSample);
  sample = constrain(sample, 0, oneHzSample);

  analogWrite(DAC1, waveformsTable[wave0][i]);  // write the selected waveform on DAC0
  analogWrite(DAC0, waveformsTable[wave1][i]);  // write the selected waveform on DAC1

  i++;
  if(i == maxSamplesNum)  // Reset the counter to repeat the wave
    i = 0;

  delayMicroseconds(sample);  // Hold the sample value for the sample time
}

// function hooked to the interrupt on digital pin 2
void wave0Select() {
  wave0++;
  if(wave0 == 4)
    wave0 = 0;
}

// function hooked to the interrupt on digital pin 3
void wave1Select() {
  wave1++;
  if(wave1 == 4)
    wave1 = 0;
}

I plugged in the headphones ( with great difficulty, it appears the phones socket on my board is ULTRA tight...) and have got sound coming out of only one channel where there should be waveforms coming out of both DAC channels. It appears that DAC0 is not working. I have done some measurements on both channels using a multimeter set to 20V DC and DAC1 reads a fluctuating voltage of between 1.3 and 1.6 Volts. This is fine. It is the working DAC channel. However, DAC0 only reads about 20mV or so and I get NO sound coming from it.
I have tried swapping the DAC channels in the code but the result I get is the same. No output on DAC A.  :'(
Please help. I was anticipating this amazing board for weeks and now it has arrived I am sad that I can't get the audio to work as I want it to...
Thanks,
Sad Steve.

mubase

  • Newbie
  • *
  • Posts: 11
Re: Recieved DigiX and have problem with DAC0.
« Reply #1 on: December 31, 2013, 05:29:39 am »
Anyone?

digistump

  • Administrator
  • Hero Member
  • *****
  • Posts: 1465
Re: Recieved DigiX and have problem with DAC0.
« Reply #2 on: January 01, 2014, 02:23:41 am »
Please try this test with DAC0: http://digistump.com/board/index.php/topic,1180.msg5331.html#msg5331

If that doesn't work please email us support at digistump dot com

mubase

  • Newbie
  • *
  • Posts: 11
Re: Recieved DigiX and have problem with DAC0.
« Reply #3 on: January 05, 2014, 08:38:22 am »
Hi and thanks for the link to the code. I have tested the DAC0 and it is not working. The reading on my multimeter for DAC0 is around 20mA. It doesn't move. Changing the code to DAC1 gives a healthy result of 0.0V, 1.7V and 2.6V for each increment in output.
So Ive sent an email to support at digistump dot com.
I hope you can help.
Thanks,
Steve (mubase).