Arduino DUE and Sparkfun MP3 shield: SD issue

Dear all,
currently I'm dealing with SD card issue with Arduino DUE and the Sparkfun MP3 shield.
Before moving on DUE I played with Arduino UNO + Sparfun and everything worked.
Now due to short of I/O on UNO I've decide to buy Arduino DUE.
I'm facing issue in access to the SD Card.
I've wired SPI pins to Sparkfun as follow:

SPI MISO <-> pin 12
SPI MOSI <-> pin 11
SPI SCK <-> pin 13

Chip select is 9

I've tried different SDFat library (Bill Greiman, SDFast master and SDFat-beta), with:
#define USE_ARDUINO_SPI_LIBRARY 1
#define DUE_SOFT_SPI 1

in SDFatConfig.h

but anytime I got back the error:
Can not access to SD card, or error initializing CD card:
SD errorCode: 0X1,0XFF

I'm using minimal code for testing:

#include <SPI.h>
#include <SdFat.h>
#include <SdFatUtil.h>

SdFat sd;

void setup() {

Serial.begin(9600);

//start the shield
//Initialize the SdCard.

if( ! sd.begin(9, SPI_HALF_SPEED ))
sd.initErrorHalt();
if( ! sd.chdir( "/" ))
sd.errorHalt( "sd.chdir" );
Serial.println("OK");

}
//do something else now
void loop() {

Serial.println("I'm bored!");
delay(2000);

}

Can anyone help me in troubleshooting ?

I've seen than DUE+Sparkfun MP3 (should) works (gallegojm, Summary of mysteries about SPI and extended SPI library with Due - #4 by gallegojm - Arduino Due - Arduino Forum), so any tips are welcome.

Thank you in advance,
PF

SPI MISO <-> pin 12
SPI MOSI <-> pin 11
SPI SCK <-> pin 13

Hint:- the Due does not use those pins for SPI. It uses the signals on the 6 pin ICSP programming header.

Hi Grumpy,
it is correct. What's why I've wired SPI pins (see photo attached) to pins 11,12 and 13 of the Sparkfun MP3 shield.

PF

Due-pinout_pdf__1_pagina_.jpg

I'm having the same issue Pfanelli, have you solved your problem yet? also you said it worked on the uno because i might just as well do it on it the UNO..

Had you isolated the pins between the Due and the MP3 shield?

In a project that need an ethernet shield I use this one to make the connections between the SPI connector of the Due and the pins 11, 12 and 13 of the shields (see the photos)

You can too use a 'Arduino proto'. The advantage is that it comes with the connections between SPI and pins. See a complete description (in french) on my web site: http://larocola.net/?e=20#body-anchor

Hi iKhmaiFoSho,
unfortunately the issue is still there.

Gallegojm,
I think you mean to isolate pins 11,12 and 13. Yes, I had. See the picture.
Which SDFat are you using ?
Did you changed the following #define as:

#define USE_ARDUINO_SPI_LIBRARY 1
#define DUE_SOFT_SPI 1

?

Question: is the code posted at the beginner correct ? It is minimal just to test the SD even if my target is to play music with it.

It is really make me crazy :frowning:

Thank you,
PF

Hi Pfanelli

is the code posted at the beginner correct ?

I think so. You can try to add those 4 lines before the call to sd.begin()

  pinMode( 9, OUTPUT );  // set Chip Select of VS1053 chip to high
  digitalWrite( 9, HIGH );
  pinMode( 4, OUTPUT );  // set Chip Select of SD Card to high
  digitalWrite( 4, HIGH );

this is to ensure than devices connected to SPI bus (VS1053 chip and SD card) are inactive before initialization.

Which SDFat are you using ?

I use the archive sdfatlib20131225.zip
Yes I define USE_ARDUINO_SPI_LIBRARY to 1
But constant DUE_SOFT_SPI does not exists in that version of SdFat
And I use IDE 1.5.6-r2 (I have some problems with 1.5.8 and W5200 ethernet module)

I hope this would help you

Hi Gallegojm,
I've followed your suggestions (added the four rows, sdfat20131225, IDE 1.5.6-r2), but unfortunately it still not working :cry:

I'll buy a proto shield following what you did, although I don't think the problem is that.
Any other tips are welcome.

Thank you,
PF

Hi Gallegojm,
by chance do you have the possibility to replicate my scenario ? Just to figure out where the problem is.

Thank you

There's nothing obviously wrong there.

The first thing I would check is is your wiring modification working on the old UNO? This will check that you got MISO wired up to the right pin on the ICSP connector and the SD card is still OK.

Next, the DUE uses different values for constants like SPI_HALF_SPEED. Open up the SdFat library and check that it doesn't redefine those constants back to the old AVR values. Lazy library authors can sometimes copy-paste in stuff which should be set elsewhere by the Arduino environment. (Don't look at any libraries I've written - none of them are portable to the DUE.)

Hi P Fanelli
I can not replicate exactly the condition of your test because I don't have with me the Sparkfun MP3 shield for these days.
I copy and paste your test program. It works on a Due with a shield made by myself and a Sparkfun MP3 breakout VS1063
So I think your problem is not software, but hardware.
A way to check 'your wiring modification' as says MorganS would be to run a little program to test the VS1053 chip. It can be the library of Bill Porter or one of the examples you can download on the sparkfun site.
If the VS1053 test is ok, you will be sure that the SPI bus and your wiring modification work fine.
Then you can test the continuity between the SD socket and the rest of the shield with an ohmmeter (see the picture)

As I look closer at your picture IMG_1065_.jpg I see your solders can be the source of your problems. There are many sites on that subject. I found this one where you can see what you have to improve (the picture says "poor or failed solder joint")

PinsSdSocket.jpg