Noise on Due DAC when reading from MicroSD through SPI

Ok noblepepper, I've followed your advice and written a sketch that generates an infinite sine wave with a constant frequency, and run it without changing anything (clearly the sd card isn't read anymore).
Unfortunately, the noise was still there, just now it's plain white-ish noise, without the recognizable pattern of sd-card reads. It sounds like someone is frying something nearby.

So I've done the following things:

  • removed the sd card and all related wiring altogether
  • replaced the audio cables with twisted pairs (well, I've just twisted together each couple of cables :slight_smile: )
  • written a sketch that generates an infinite alternation of sine wave and pause; the program sends this signal to DAC0, and the inverse of this signal to DAC1
  • connected the amp's input + and - to DAC0 and DAC1 respectively
  • removed the breadboard, connecting everything together just with cables
    You can see the modified layout in the attached image (just the breadboard is still there but I removed it later).

The result is: STILL noise. You can hear the actual noise (both mixed to the sine wave and alone) in the attached arduino_amp.mp3

Then I've disconnected the amp's input from the arduino (leaving the amp's power connected to it though), and connected the amp's input to an external audio source.
Result: NO noise. Hear it in arduino_amp_external_audio_source.mp3 (the song is noisy because i've recorded it at home with crappy hardware, but the ground noise is definitely gone).

Finally, I've disconnected the amp altogether from the arduino, and connected the arduino's DACs to an external amplifier and speakers (my home hi-fi).
Result: NO noise. Hear it in arduino_external_stereo.mp3

I really don't know what's going on here. The DAC's output is ok, the sparkfun's amp is ok, but when the amp is plugged BOTH to arduino's power AND DACs, here comes that F****NG noise.
Any help is really, really appreciated. Thanks :~

arduino_amp.mp3 (372 KB)

arduino_amp_external_audio_source.mp3 (315 KB)

arduino_external_stereo.mp3 (242 KB)