earlephilhower / arduino-pico

Raspberry Pi Pico Arduino core, for all RP2040 boards
GNU Lesser General Public License v2.1
1.88k stars 394 forks source link

Can't get SD to initialize #2242

Closed TheLardos closed 3 weeks ago

TheLardos commented 3 weeks ago

Hi,

I'm trying to get my SD card module initialized, but no matter what I try, I just can't get it to work.

I've written a simple code:

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

// Definition der Pins
const int chipSelect = 1; // GP1 (CSn)

void setup() {
  Serial.begin(9600);
  while (!Serial) {
  }

  SPI.setRX(0); // GP0 als MISO
  SPI.setTX(3); // GP3 als MOSI
  SPI.setSCK(2); // GP2 als SCK
  SPI.begin();

  Serial.print("InitializeSD-Card...");
  if (!SD.begin(chipSelect)) {
    Serial.println("SD-card couldn't be initialized.");
    return;
  }
  Serial.println("succesfull");
}

void loop() {
}

I am using a Pimoroni tiny rp2040 (here is a photo of the pinout: 19278_5 ) I appreciate any help I can get on this.

Thanks in advance! Luca