SD card Troubles with Arduino Mega

this works for me. I don't know WHY it works; I do know THAT it works:

#include <SD.h>
#include <SPI.h>
const int chipSelect = 53;

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

  //Init SD_Card

  pinMode(chipSelect, OUTPUT);    //<--- changed to 53 at Mega
  digitalWrite(chipSelect, HIGH); //<--- changed to 53 at Mega
  
  if (!SD.begin(chipSelect))
  {
    Serial.println("SDv");
  }
  else
  {
    Serial.println("SD^");
  }
}
1 Like