Can't read SD card on Arduino Due/Mega2560

Hi,

I am trying to load icons off of an SD card to display on my TFT LCD display. I am using Display 5 inch TFT Arduino Touch Shield w/SSD1963 for Mega/Due.

I am using UTFT_SdRaw supplied by ghlawrence2000 to do this. I have tried with both the Due and the Mega2560 but no matter what I always get this message:

"Initialising SD card...
Card failed, or not present
Retrying...."

I have spent 3 days now with this issue, reading forum post after forum post in an attempt to figure out what I am missing but to no avail.

Here is a sample of my code

#include <SPI.h>
#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_SdRaw.h>

#define SD_CHIP_SELECT 53 // SD chip select pin
// file system object
SdFat sd;

UTFT myGLCD(SSD1963_800480,38,39,40,41);
UTFT_SdRaw myFiles(&myGLCD);

void setup()
{
// Open serial communications and wait for port to open:
Serial.begin(115200);
while (!Serial) {
; // wait for serial port to connect.
}
Serial.println(F("Initialising SD card..."));
bool mysd = 0;
// see if the card is present and can be initialized:
while (!mysd)
{
if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
Serial.println(F("Card failed, or not present"));
Serial.println(F("Retrying...."));
}
else
{
mysd = 1;
Serial.println(F("Card initialised."));
}
}
Serial.println(F("Initialising LCD."));
myGLCD.InitLCD();
myGLCD.clrScr();
//myGLCD.setFont(SmallFont);
Serial.println(F("LCD initialised."));
myFiles.load(0, 0, 240, 240, "wait4gps.RAW", 1 , 1);
}

void loop()
{}

SRIntern:
Hi,

I am trying to load icons off of an SD card to display on my TFT LCD display. I am using Display 5 inch TFT Arduino Touch Shield w/SSD1963 for Mega/Due.

http://www.buydisplay.com/default/display-5-inch-tft-arduino-touch-shield-ssd1963-for-mega-due

I am using UTFT_SdRaw supplied by ghlawrence2000 to do this. I have tried with both the Due and the Mega2560 but no matter what I always get this message:

"Initialising SD card...
Card failed, or not present
Retrying...."

I have spent 3 days now with this issue, reading forum post after forum post in an attempt to figure out what I am missing but to no avail.

Here is a sample of my code

#include <SPI.h>

#include <SdFat.h>
#include <UTFT.h>
#include <UTFT_SdRaw.h>

#define SD_CHIP_SELECT  53  // SD chip select pin
// file system object
SdFat sd;

UTFT myGLCD(SSD1963_800480,38,39,40,41);
UTFT_SdRaw myFiles(&myGLCD);

void setup()
{
  // Open serial communications and wait for port to open:
  Serial.begin(115200);
  while (!Serial) {
    ; // wait for serial port to connect.
  }
  Serial.println(F("Initialising SD card..."));
  bool mysd = 0;
  // see if the card is present and can be initialized:
  while (!mysd)
  {
    if (!sd.begin(SD_CHIP_SELECT, SPI_FULL_SPEED)) {
      Serial.println(F("Card failed, or not present"));
      Serial.println(F("Retrying...."));
    }
    else
    {
      mysd = 1;
      Serial.println(F("Card initialised."));
    }
  }
  Serial.println(F("Initialising LCD."));
  myGLCD.InitLCD();
  myGLCD.clrScr();
  //myGLCD.setFont(SmallFont);
  Serial.println(F("LCD initialised."));
  myFiles.load(0, 0, 240, 240, "wait4gps.RAW", 1 , 1);
}

void loop()
{}

Are Jumpers J4, J5, J6 soldered? J1,J2,J3 need to be open, unsoldered.

Also the CS pin for the SDcard is 47, not 53

Make sure the rest of the Jumpers are correct, for you specific display, Resistor or Capacitor touch screen require different jumper combinations,

And Table 3.8 of the manual has errors, for the Mega you need Hardware SPI Jumpers J4,5,6 close, J1,2,3 open.

Chuck.