SD Card testing

I am using the sketches to test a 16gb Fat formatted SD card but the pins returned from the print routine seem different than the ones shown on the schematics of the Autonomo Rev.5

I have changed the sketch to print out the SS_2 and the result is

MOSI 44
MISO 42
SCK 45
SS 46
Initializing SD card...initialization failed!

According to the variant file the code is correct

// SPI
#define PIN_SPI_MISO         (42u)
#define PIN_SPI_SS           (43u)
#define PIN_SPI_MOSI         (44u)
#define PIN_SPI_SCK          (45u)
 
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SS   = PIN_SPI_SS ;
static const uint8_t SS_DFLASH  = PIN_SPI_SS ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t SCK  = PIN_SPI_SCK ;

// SPI1
#define PIN_SPI1_MISO        (53u)
#define PIN_SPI1_SS          (54u)
#define PIN_SPI1_MOSI        (55u)
#define PIN_SPI1_SCK         (56u)

static const uint8_t MISO1 = PIN_SPI1_MISO;
static const uint8_t SS1   = PIN_SPI1_SS;
static const uint8_t MOSI1 = PIN_SPI1_MOSI;
static const uint8_t SCK1  = PIN_SPI1 _SCK;

// SD Card CS/SS pin
static const uint8_t SS_2 = (46u);
static const uint8_t CS_SD = (46u);

Is the schematic outdated?
If thi is not a pin configuration error, do you have any other suggestions?

The schematic is correct, however, the numbers listed next to the MCU pins are the physical pin numbers. (See the datasheet pp.33-35: http://ww1.microchip.com/downloads/en/DeviceDoc/40001882A.pdf)

These numbers are not related to how they are referenced with the Ardunio system.

For example:

  • D11 (referenced as 11) is PA16 which is physical pin 35.
  • MISO (referenced as MISO or 42) is PA22 which is physical pin 43.

@GabrielNotman, sorry for the late reply on this but since the schematic is correct, do you see any other point where this might fail? I have indeed used multiple SD cards with no luck. What could I be missing; :slight_smile: