Using SD Cards on Arduino Giga?

Update:

I gave up on trying the SD slot on the CTE adapter shield. Ordered a 7" SSD1963 800x480, 40 pin TFT. I set it up on Due board, using the TFT's SD slot. Turns out the SD CARD settings printed on the CTE adapter worked first time on this slot. The adapter also has SPI flash settings printed on the board. Thinking that might be for it's SD slot.

Edit:
Now if we could use the MCUfriend Library that has an existing setup for a 16bit CTE adapter shield for Due and change port pins to run on a Giga R1, it would make a great (nearly) plug and play shield. A little above my pay grade, but when I have time, might try some trial and error. The late great David Prentice explained how to add one wire to CTE adapter to enable the read pin and it worked for me. The SSD1963 has a 1215Kb framebuffer so this addition could be very useful.

Hi KurtE,
I'm working in an idea and I plan to use the Giga and Micro SD. Do you have some idea of the write speed you are achieving? thx

Sorry, I mainly have just played with these boards... And have not done very little writing to the SD cards on the GIGA.

You might try looking at the thread:

@fat16lib - Might have additional follow-on information and advice. Things like, which SDCards work the best. Optimal write sizes and the like.

Good luck
Kurt

Hi garybdg,

I tried to run example 'CardInfo' with SPI 1, pins 10 to 13, but it doesn't work. May I ask do you have any solutions for this?

Many thanks.

Hello ys_nu
I have had good success when I use the 6-pin ICSP header for SPI to access micro-SD cards. See photo below. This connector on the GIGA R1 is in the same orientation as on the UNO. Connect your card's MISO, MOSI and SCLK points to the corresponding pins on the GIGA as in the photo. You can use any other IO pin for SD_CS (I use D5) and connect power to convenient pins on the GIGA. Hopefully you would be able to use the ICSP connector.

I found out that even if you call SPI1.begin() before initializing the SD card, nothing changes.
i tried to call both ports and none of them, the result is the same. the SD library already initializes and uses the SPI headers in the center of Arduino GIGA.
I found this out by connecting an LED to the clock of both ISP ports and then tried to initialize the SD card. Only the one connected to the ISP in the center of the board ever light up.

i personally dont want to use those pins due to preferences but i will have to until i figure out if there is a way to specify what pins or port to use in SD library.

For anyone still coming to this post.
Use the 6-pin ISP header located at the center of your Arduino GIGA R1 Wifi.

What have you tried?

Are you using SDFat library? if so you need to tell it to use SPI1
like:

#define SD_CONFIG SdSpiConfig(SD_CS_PIN, DEDICATED_SPI, SPI_CLOCK, &SPI1)

Or better yet:
#define SD_CONFIG SdSpiConfig(CS_SD, SHARED_SPI, SPI_CLOCK, &SPI1)

It is safer than DEDICATED, as dedicated means exactly that. There is nothing else on that SPI buss, such that the SDFat code does not need to worry about asserting and deasserting the CS pin, and the like.

you are quick to respond.
im using the SD.h library and i initialize the card like this:

while(! SD.begin(chipSelectPin){
  /*Report error and try again in a fiew*/
    SendError(1); //custom funcion to send error to hardware serial + OLED screen in a nice format
    delay(5000);
}

as of now im still experimenting sense i was not expecting any response.
ChipSelect goes low as expected from any assigned pin like normal.
But because its just the MISO, MOSI and clock pins that need to be connected to the center headers i think it is fine for my use case.

But if you know a way in software to change from using ISP to using ISP1 it would be nice so i can keep wires all next to each other. Thanks

Sorry, I don't use the Arduino version of SD library very often.

I wish they would have added simple mechanism to choose which SPI to use...
But I don't see it.

They only way I see it is to edit their library: On my Windows machine it is stored
at: C:\Users\kurte\AppData\Local\Arduino15\libraries\SD\src\utility

In that directory is the file Sd2Card.cpp

Toward the top of the file you will see:
#define USE_SPI_LIB

If you add right after this:
#define SDCARD_SPI SPI1
But it changes the SD library for every build of anything that uses this (except if
SOFTWARE_SPI is defined somewhere)..