trouble accessing SD card on TFT 2.8" UNO V3 shield

Members

Ive tried a few combinations(like SD_cs or SD_ss etc) and I even swopped screens but are unable to get the SD card reader to read the card.

At first I tried to use 2 different bmp examples and all I got was ‘file not found’

Now Im down to the bare minimum- read and write to sd.

/*
  SD card read/write
****For Due and 2.8" TFT UNO V3 shield multi wire shield
 This example shows how to read and write data to and from an SD card file
 The circuit:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13
 ** CS - pin 10 (for MKRZero SD: SDCARD_SS_PIN)

 created   Nov 2010
 by David A. Mellis
 modified 9 Apr 2012
 by Tom Igoe

 This example code is in the public domain.

 */

#include <SPI.h>
#include <SD.h>

#define SD_cs 10     // _CS  Set the chip select line to whatever you use
#define SD_clock 13
#define SD_MISO 12
#define SD_MOSI 11

File myFile;

void setup() {
  // Open serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for native USB port only
  }


  Serial.print("Initializing SD card...");

  if (!SD.begin(10)) {
    Serial.println("initialization failed!");
    while (1);
  }
  Serial.println("initialization done.");

  // open the file. note that only one file can be open at a time,
  // so you have to close this one before opening another.
  myFile = SD.open("test.txt", FILE_WRITE);

  // if the file opened okay, write to it:
  if (myFile) {
    Serial.print("Writing to test.txt...");
    myFile.println("testing 1, 2, 3.");
    // close the file:
    myFile.close();
    Serial.println("done.");
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }

  // re-open the file for reading:
  myFile = SD.open("test.txt");
  if (myFile) {
    Serial.println("test.txt:");

    // read from the file until there's nothing else in it:
    while (myFile.available()) {
      Serial.write(myFile.read());
    }
    // close the file:
    myFile.close();
  } else {
    // if the file didn't open, print an error:
    Serial.println("error opening test.txt");
  }
}

void loop() {
  // nothing happens after setup
}

Any help would be appreciated. Thanks in advance

Is this the same problem as http://forum.arduino.cc/index.php?topic=560592

Yes, it is related. The pin layout has since been confirmed as correct. The SS = CS =10

To avoid confusion please confirm which Arduino board you are using and the pins being used for MOSI, MISO and SCK

I assume that it is not

 ** MOSI - pin 11
 ** MISO - pin 12
 ** CLK - pin 13

as in the code if you are still using a Due

Its the DUE with a 2.8" UNO tft shield. Picture attached in 1st post

fnb111: Its the DUE with a 2.8" UNO tft shield. Picture attached in 1st post

Is that the picture where nothing appears to be connected to the shield ?

It was the details of which pins on the Due that you are using for MOSI, MISO and CLK that I was asking about

The penny has dropped and I feel so embarrassed. I looked at the wrong schematics. The UNO CS=10 and this shield's SD card will not work with the DUE.

Whilst you may not be able to use it as a shield, ie by plugging it into the Due, you may be able to use it by using jumper wires so that the correct pins are connected.

I've tried this hard wire connection without any success:

TFT DUE

GND GND GND GND 5V 5V 3.3V 3.3V

SD_ss 10 SD_D1 MISO2 or MOSI2 ICSP SD_D0 MOSI2 or MISO2 ICSP SD_SCK SCK2 ICSP

The ISP socket is already connected to nRF24L01. ONLY 'test.txt ' loaded onto SD card. Any ideas would be appreciated. Thanks in advance

Members I used the SPI connections and the SD card worked. Why cant it work when the ICSP pins are connected? Do I need to define the pins?

The circuit DUE and 2.8" UNO shield multi wire:
 * SD card attached to SPI bus as follows:
 ** MOSI - pin D1
 ** MISO - pin D0
 ** CLK - pin SCK
 ** CS - pin  (SDCARD_SS_PIN) 10

SD card attached to ICSP bus as follows:
** MOSI2 - pin   
 ** MISO2 - pin   
 ** CLK2 - pin  SCK
 ** CS - pin  (SDCARD_SS_PIN) 10
[code]

Had you correctly identified the pin numbers on the ICSP header I wonder ?

This is the schematic I followed. The schematic label MISO2 MOSI2 and SCK2. Is that correct?

icsp.jpg

This is the schematic I followed

I cannot read any of the text

There is a much better image on this page https://www.arduino.cc/en/Hacking/Upgrading16U2Due that puts the pin layout in the context of the Due

Thanks. That is what I've got as well. So it should work? I'll double check the hard wiring.

Ive soldered the leads to the ICSP MOSI2(white) MISO2(blue) SCK2(brown)

Its still not working with the ICSP. The card work when connected to the SPI.

Untitled 1.pdf (70.5 KB)

I found this link: http://21stdigitalhome.blogspot.com/2013/02/arduino-due-hardware-spi.html

ICSP on the DUE is NOT for MISO MOSI or SCK use.