Go Down

Topic: Mute DUE DAC1 or DAC0 (Read 274 times) previous topic - next topic

atlaikesbriedi

Hi guys,
is it even possible to mute/disable DAC1 or DAC0, keeping another DAC enabled and playing?
I have a project where some sounds must be played through another speaker.
I found this topic: https://forum.arduino.cc/index.php?topic=488106.0 but those command lines won't work for me. Is there any other way?

vffgaston

Hi,
What about outputting "0" to the non used one?
Regards.

atlaikesbriedi

Yes, but as I understand DUE plays wav through both DACs and there is no place to send 0 on one of them. At least it seems so looking at audio player tutorial. I am using code like this:
https://forum.arduino.cc/index.php?topic=558348.0

And two variables are available for wav file: frequency and prebuffering lenght. Maybe I am wrong and there is a way just select DAC0/1 when playing - that would solve everything.

ard_newbie


DACC_MR is the register you want to use to select whether you output on DAC0 or DAC1 or both and the two at the same time or one after the other.





atlaikesbriedi

I could only find these lines for controlling output of each DAC:
Code: [Select]
DACC->DACC_CHER = DACC_CHER_CH0 | DACC_CHER_CH1;     // Enable DACs 0 and 1

DACC->DACC_CHDR = DACC_CHDR_CH0 | DACC_CHDR_CH1;    // Disable DACs 0 and 1


Anyway, my program crashes if they are being used and .wav starts playing.

ard_newbie

#5
Jul 17, 2018, 10:36 am Last Edit: Jul 17, 2018, 11:01 am by ard_newbie
DACC_MR is NOT DACC_CHER. See page 1364, Sam3x datasheet.

Read DACC_MR once your program has initialized the DAC peripheral, then you will know what you have to modify to output a (stereo  ?) .wav file to a single DAC.

Go Up