Skip to content

SPI pin selection for SD #758

@bfgelectronics

Description

@bfgelectronics

I want to store some data on a SD card an i used this snippet of code to initialise the SD card, but it seems like the Pico freezes/crashes here :

  SPI.setRX(12);
  SPI.setCS(13);
  SPI.setSCK(10);
  SPI.setTX(11);
  SD.begin(13);

I know that the Pico freezes here because i also have an I2C OLED display connected that shoud display something in normal conditions, but with that snippet it stays black
For context, here is my setup() :

void setup() {
  Wire.setSDA(16);
  Wire.setSCL(17);
  Wire.begin();

  pinMode(18, INPUT_PULLUP);
  pinMode(19, INPUT_PULLUP);

  Serial.begin(9600);

  SPI.setRX(12);
  SPI.setCS(13);
  SPI.setSCK(10);
  SPI.setTX(11);
  SD.begin(13);

  if (!display.begin(SSD1306_SWITCHCAPVCC, SCREEN_ADDRESS)) {
    Serial.println(F("SSD1306 allocation failed"));
    for (;;) {}
  }

  display.setTextColor(SSD1306_WHITE);

  display.clearDisplay();

  attachInterrupt(digitalPinToInterrupt(19), increment, FALLING);
  attachInterrupt(digitalPinToInterrupt(18), decrement, FALLING);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions