due can't connect with SD card

Hello,

I have an Arduino DUE but I don't have a ethernet shield,
I have searched on the web how to assign a SD for playing a sound effect (I use a micro SD) and I found a picture (you can see it below) but it doesn't work (it is possible that the problem is in the code) and I don't know where I have to assign the pin. So my question is where do I put the pins (and how to assign them) on the Arduino or what is wrong with my code?

Luc

sound1.ino (1.27 KB)

no, no, NO,
that's wrong
use as CS pin N°4 to work with te arduino IDE 1.5.x example.
also, other connections are bad, and probably you burned the SD card, because you connected 5V as MOSI.
use this:

and this as reference:

Wow!! thank you!!

The speaker is working and is playing the right sound (I think),
because the speaker has a lot of 'snow', so the sound file cannot play clearly.

We have tried to adjust a few values in the code, but they make no difference.

Thanks in advance!

Luc

All SD cards and microSD are 3.3V maximum. You also need 10k pullups on
some lines IIRC.

10K pull up, are for open drain pins, as in I2C bus, in SPI there's no need of them.

Hello Erictronico,

thank you for your reaction but I'm a new bee and don't understand exactly what you mean by your answer and what I suppose to do now, can you please explain you answer more easily.

Thank you in advance,
Luc

well, first, English is not my native language, it may be why you do not understand.
what I mean is that you should only connect wires as shown in this image.
then use SD example to test the conections.
if you are using DAC as output, remember the offset of 1.65V dc, YOU CAN'T USE A SPEAKER DIRECTLY, you need to use a amplifier between the arduino and the speaker, and use a capacitor (10 uF, positive on DAC) between the arduino and the amplifier.

erictronico:
10K pull up, are for open drain pins, as in I2C bus, in SPI there's no need of them.

We're talking SDcards and microSD, pullups are needed I think. Found this:

The SD physical layer specification does not have much to say about pullup resistors, except that they should be used to prevent excessive current from floating inputs. That applies especially to pins 8 and 9 on the card (the ones on opposite ends), which are not used in SPI mode.

Basically any floating input is bad news, especially on ultra-high frequency inputs
like the native-mode bus. Given the large variety of SDcard makes out there, protect
yourself from the poorly compliant ones by being paranoid.

yes, you are right, it´s a precautionary measure.