SD card problem with M0 lora

I've been trying to use my adafruit micro sd breakout board with my M0 feather rfm9x lora, but there has been problems with getting the sd module to work. I'm using the example code for the SD card library, but with the cs pin for the sd card as d5, yet the sd card fails to initialize, despite it being able to initialize on my arduino nano. Code posted below.
`/*
SD card basic file example

This example shows how to create and destroy an SD card file
The circuit:
SD card attached to SPI bus as follows:
** MOSI - pin 11
** MISO - pin 12
** CLK - pin 13
** CS - pin 4 (for MKRZero SD: SDCARD_SS_PIN)

created Nov 2010
by David A. Mellis
modified 9 Apr 2012
by Tom Igoe

This example code is in the public domain.

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

File myFile;

void setup() {
// Open serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}

Serial.print("Initializing SD card...");

if (!SD.begin(5)) {
Serial.println("initialization failed!");
while (1);
}
Serial.println("initialization done.");

if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}

// open a new file and immediately close it:
Serial.println("Creating example.txt...");
myFile = SD.open("example.txt", FILE_WRITE);
myFile.close();

// Check to see if the file exists:
if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}

// delete the file:
Serial.println("Removing example.txt...");
SD.remove("example.txt");

if (SD.exists("example.txt")) {
Serial.println("example.txt exists.");
} else {
Serial.println("example.txt doesn't exist.");
}
}

void loop() {
// nothing happens after setup finishes.
}

`

According to the Adafruit docs, your feather operates at 3.3v. I think your SD board should be one something like this one:


Note the lack of additional components that are normally required for 5V systems.

Thanks for the reply, but my breakout board is 5v capable, I'll attach the link MicroSD card breakout board+ : ID 254 : $7.50 : Adafruit Industries, Unique & fun DIY electronics and kits. Also the m0 feather runs on 3.3v not 5v

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.