Arduino Giga R1 and SD card

Dear all,
Again something that really should work out of the box.
I have a standard SD Card adaptor. Connect to the Arduino Giga R1. Tried different oil settings (switching MISO and MOSI). But SD.begin(10) keeps on giving a fail.
What am I doing wrong? Help is appreciated.
Tried a second adaptor on 5 Volt. Same results.

#include "Arduino.h"
#include "SD.h"
// Vcc to 3.3 volt
// miso to pin 11
// mosi to pin 12
// SCK to  pin 13
// CS to   pin 11

void setup() {
  Serial.begin( 115200 );

  while (!Serial && millis() < 5000);
    Serial.println("Begin");

    SPI.begin();
    if (!SD.begin(10))
    {
        Serial.println("SD card failed!");
    }
    else
    {
        Serial.println("SD card success!");
    }
    
}

void loop() {
  // put your main code here, to run repeatedly:

}
1 Like

If you are using 11-13 these are on SPI1 not SPI.

Not sure if the simple SD library supports SPI1 or not. I know there have been other threads talking about as option swapping, SP and SPI1.

Red sort of arrow pointing toward SPI pins
Blue circled the SPI1 object pins.

With SDFat you can specify SPI1.

Where:

#include <SdFat.h>
...
#define SD_CONFIG SdSpiConfig(SD_CS_PIN, DEDICATED_SPI, SPI_CLOCK,&SPI1)
...
      if (SD.begin(SdSpiConfig)) {
1 Like

Thanks,
Now tried this one (and switching MISO and MOSI). No luck so far. Any suggestions?
(*our doubts are seriously growing to use this Arduino product in our commercial product *).

#include "Arduino.h"
#include "SD.h"
// Vcc to 3.3 volt also tried 5 volt
// miso to pin D89 SPI
// mosi to pin  D90 SPI
// SCK to  pin D91 SPI
// CS to   pin 10

void setup() {
  Serial.begin( 115200 );

  while (!Serial && millis() < 5000);
    Serial.println("Begin");

    if (!SD.begin(10))
    {
        Serial.println("SD card failed!");
    }
    else
    {
        Serial.println("SD card success!");
    }
    
}

void loop() {
  // put your main code here, to run repeatedly:

}

Sorry, I have not use the OLD SD library in a long time.
On the Teensy, there is a newer version which is a thin wrapper onto the SDFat library.
Which gains you lots of stuff, like the ability for long file names, newer SD disks (ExFat)...

Not sure if it helps, but here is a quick and dirty setup I have on mine right now.
image

I am using pin 52 for CS.

Hi @MeandMrsJones. I just gave your sketch from post #3 a try and it works perfectly for me.

My connections are the same as you describe:

GIGA SD
89 MISO
91 SCK
90 MOSI
10 CS
GND GND
3.3V Vcc

image

1 Like

Thank you for checking. Either my module is broke, or it could be something related to this
In this link [Use code tags to format code for the forum](https://docs.arduino.cc/learn/communication/spi/) is see the following table :slight_smile:

Mode Clock Polarity (CPOL) Clock Phase (CPHA) Output Edge Data Capture
SPI_MODE0 0 0 Falling Rising
SPI_MODE1 0 1 Rising Falling
SPI_MODE2 1 0 Rising Falling
SPI_MODE3 1 1 Falling Rising

In SD2card.cpp that only SPI_MODE0 is used. Maybe that is the issue with my card. We I need to dive into that. Btw : In this reference [Use code tags to format code for the forum](https://www.arduino.cc/reference/en/libraries/sd/) Arduino clearly states that
This library is compatible with all architectures so you should be able to use it on all the Arduino boards.
So it would be weird if I have to make changes in the SD library. Keep you posted.

I used the release version 1.2.4 of the official "SD" library, without any modifications.

This is the module I am working with, also latest SD lib. we will order a few new one to try them. Maybe it is a SD card related issue.


Okay, apparently SD.begin also returns a False if there is no SD card insight the module. Ha Ha. I have put myself in a metal position.

Congratulations on finding the cause of the problem! I'm glad it is working now. Thank you for taking the time to post an update.

Regards,
Per