microSD card module with Arduino DUE

Hi,

I am trying to config microSD module with my arduino DUE. Please find the attachment for the module i am using. I am not able to comprehend the SPI system of Arduino DUE. I read that ICSP pins are used. But it is not working for me with SD and sdfat library. A good explanation with illustration will be great help. Thanks:)

41PgyfbBLOL.jpg

The illustration you need is one of the pinned topics at the top of this sub-forum. "Due Pinout Diagram".

On the Uno, the SPI pins are hardwired to both the ICSP header and the 11-12-13 digital pins. The Due has a lot more pins so it isn't wired the same way. The SPI pins are only available on the ICSP header.

Two things to be aware of:

  1. The 5v line in the ICSP header is an historical artifact. Don't use that to power your SD card or any other SPI device which talks to the Due. That could put 5v on the Due input pins which will destroy them.

  2. You will still need a CS (card-select) line, chosen from any of the other digital outputs on the Due.

Do I need to change anything in the code except the CS pin? I am using the given SD card info example, but its not working.

I am also having trouble with this.

Here is what I have tried without success (card initialization fails):

  • from the IDE: examples/SD/ReadWrite
  • from https://github.com/greiman/SdFat-beta: BENCH with SPI at half and full speed and CS of 4
  • I considered trying with an UNO but assume it wont work because of the voltage levels.

Setup:

I’ve attached photos and the pin out diagram I’m using.

Any help is very much appreciated

WIRING:

BREAKOUT WIRE COLOR ARDUINO DUE
CD NOT CONNECTED NOT CONNECTED
DO YELLOW SPI MISO
GND GREEN AND BLK SPI GRN AND POWER RAIL GND
SCK WHITE SPI SCK
VCC RED 3.3V
DI LIGHT GREEN SPI MOSI
CS ORANGE 4

pinMap.jpg

20150207_191444.jpg

20150207_191500.jpg

Update:

I believe I had gotten a bad socket on the breakout board I purchased. The CS pin is connected to where the socket meets the board but there is a break in this connection between this point and the sd card! (it took a narrow probe and steady hand to find this)

Using a soldered up micro sd card adapter things work fine as expected.

VikasRoy, did you get going ok with this?