RepRapDiscount Full Graphic Smart controller SD card reader to Arduino due.

I want to use the SD card slot on my ''RepRapDiscount Full Graphic Smart controller'' to read and write data to and from it to my SD card.

My question lays in the connection. I have connected the adapter and my arduino due as shown below (CONN1*), but the SD test program says it can't initialize the SD card. I think that i did something wrong in the connection between the "smart adapter"(S1*) and the arduino. in the SD test program it says i have to connect it as shown below(CONN2*), but those are not the SPI pins for ardriuno due. I have found some potential correct connections while looking on the internet, but i am not sure if they are correct and i could not find the correct connection for "SD DET".

Also where can i change the connection pins in the SD test program? I can't find the pins in the code it self. It seems like the default pins are for the Arduino UNO.

CONN1:
SMART Adaptor Arduino due
N/C -
SD CSEL Pin 4
MOSI Pin 109 (MOSI)
SD DET - (Could not find connection)
GND GND
SCK Pin 110 (SCK)
MISO Pin 108 (MISO)
VCC 3.3V

CONN2:
SD CARD Arduino Pin
MOSI - Pin 11
MISO - Pin 12
CLK - Pin 13
CS - Pin 4

SD card code:

/*
  SD card read/write

 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 4 (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>

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(4)) {
    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
}

S1:

S2:

Also where can i change the connection pins in the SD test program?

You can't. The SD card expects to be connected to the hardware SPI pins. Look them up. They are not the same on all Arduinos.

MOSI Pin 109 (MOSI)
SD DET - (Could not find connection)
GND GND
SCK Pin 110 (SCK)
MISO Pin 108 (MISO)

My Due doesn't have that many pins. I doubt yours does, either.

PaulS:
You can't. The SD card expects to be connected to the hardware SPI pins. Look them up. They are not the same on all Arduinos.
My Due doesn't have that many pins. I doubt yours does, either.

I found that the SD code changes it self to the pins of the adruino i use.

I also found the correct connections after playing around with the connections(CONN1*).

Also i first connected the ''RepRapDiscount Full Graphic Smart controllers'' VCC to 3.3V because i read that an SD can't take 5V, but because there are resistors inside the "RepRapDiscount Full Graphic Smart controller" it needs 5V to power the SD card. the resistors inside the "RepRapDiscount Full Graphic Smart controller" take the VCC down to 3.3V.

CONN1
Arduino Due Smart Adapter SD
1 VCC 5V VCC VCC pin 4
2 MISO MISO DO pin 7
3 SCK SCK SCK pin 5
4 GND GND GND pin 6
5 n/a n/a n/a pin 1
6 SD SS (D4*) SD CSEL CS pin 2
7 MOSI MOSI DI pin 3
8 GND SD DET CD pin 8

There connections for for me with the ''RepRapDiscount Full Graphic Smart controller'' attached to an ''Smart adapter'' that is connected with an adruino Due.

PaulS:
My Due doesn't have that many pins. I doubt yours does, either.

I took the wong pin numbers from the Arduino Due pinout diagram.
It should have been:

MISO D74
SCK D76
MOSI D75

Thank you for your time. :slight_smile: