I was tying to connect the MicroSD card adapter to my Arduino Nano 33 BLE and it has ot worked. I am using the default 'Card Info' example from the SD library and this error continues coming out:
Initializing SD card...initialization failed. Things to check:
is a card inserted?
is your wiring correct?
did you change the chipSelect pin to match your shield or module?
I have my chipSelect pin set to 10 which I think is what I have it connected to. The SD card is formatted to FAT32.
/*
SD card test
This example shows how use the utility libraries on which the
SD library is based in order to get info about your SD card.
Very useful for testing a card when you're not sure whether its working or not.
Pin numbers reflect the default SPI pins for Uno and Nano models.
The circuit:
SD card attached to SPI bus as follows:
** SDO - pin 11 on Arduino Uno/Duemilanove/Diecimila
** SDI - pin 12 on Arduino Uno/Duemilanove/Diecimila
** CLK - pin 13 on Arduino Uno/Duemilanove/Diecimila
** CS - depends on your SD card shield or module.
Pin 10 used here for consistency with other Arduino examples
created 28 Mar 2011
by Limor Fried
modified 24 July 2020
by Tom Igoe
*/
// include the SD library:
#include <SPI.h>
#include <SD.h>
// set up variables using the SD utility library functions:
Sd2Card card;
SdVolume volume;
SdFile root;
// change this to match your SD shield or module;
// Default SPI on Uno and Nano: pin 10
// Arduino Ethernet shield: pin 4
// Adafruit SD shields and modules: pin 10
// Sparkfun SD shield: pin 8
// MKR Zero SD: SDCARD_SS_PIN
const int chipSelect = 10;
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("\nInitializing SD card...");
// we'll use the initialization code from the utility libraries
// since we're just testing if the card is working!
if (!card.init(SPI_HALF_SPEED, chipSelect)) {
Serial.println("initialization failed. Things to check:");
Serial.println("* is a card inserted?");
Serial.println("* is your wiring correct?");
Serial.println("* did you change the chipSelect pin to match your shield or module?");
Serial.println("Note: press reset button on the board and reopen this Serial Monitor after fixing your issue!");
while (1);
} else {
Serial.println("Wiring is correct and a card is present.");
}
// print the type of card
Serial.println();
Serial.print("Card type: ");
switch (card.type()) {
case SD_CARD_TYPE_SD1:
Serial.println("SD1");
break;
case SD_CARD_TYPE_SD2:
Serial.println("SD2");
break;
case SD_CARD_TYPE_SDHC:
Serial.println("SDHC");
break;
default:
Serial.println("Unknown");
}
// Now we will try to open the 'volume'/'partition' - it should be FAT16 or FAT32
if (!volume.init(card)) {
Serial.println("Could not find FAT16/FAT32 partition.\nMake sure you've formatted the card");
while (1);
}
Serial.print("Clusters: ");
Serial.println(volume.clusterCount());
Serial.print("Blocks x Cluster: ");
Serial.println(volume.blocksPerCluster());
Serial.print("Total Blocks: ");
Serial.println(volume.blocksPerCluster() * volume.clusterCount());
Serial.println();
// print the type and size of the first FAT-type volume
uint32_t volumesize;
Serial.print("Volume type is: FAT");
Serial.println(volume.fatType(), DEC);
volumesize = volume.blocksPerCluster(); // clusters are collections of blocks
volumesize *= volume.clusterCount(); // we'll have a lot of clusters
volumesize /= 2; // SD card blocks are always 512 bytes (2 blocks are 1 KB)
Serial.print("Volume size (KB): ");
Serial.println(volumesize);
Serial.print("Volume size (MB): ");
volumesize /= 1024;
Serial.println(volumesize);
Serial.print("Volume size (GB): ");
Serial.println((float)volumesize / 1024.0);
Serial.println("\nFiles found on the card (name, date and size in bytes): ");
root.openRoot(volume);
// list all files in the card with date and size
root.ls(LS_R | LS_DATE | LS_SIZE);
root.close();
}
void loop(void) {
}
Test your code with the simulator used a common Nano and it worked correctly.
I had a lot of problems with these types of jumpers.
Test or change the jumpers and check on a PC if your card is ok.
Test printout:
Initializing SD card...Wiring is correct and a card is present.
Card type: SDHC
Clusters: 16160
Blocks x Cluster: 1
Total Blocks: 16160
Volume type is: FAT16
Volume size (KB): 8080
Volume size (MB): 7
Volume size (GB): 0.01
Files found on the card (name, date and size in bytes):
SKETCH.INO 1980-00-00 00:00:00 3806
DIAGRA~1.JSO 1980-00-00 00:00:00 631
LIBRAR~1.TXT 1980-00-00 00:00:00 113
I think his point is that you need the level shifters for it to work with a regular Nano, because it's a 5V processor, but you don't need level shifting to work with a 3.3V processor.
However, I think it should still work so long as you power the SD module with 5V, and that 5V supply can provide enough current. You will be translating 3.3V to 3.3V, but it should still work.
Do this specific card and this specific module work with a regular Nano? Is the card 32GB or less? Is there a CardInfo example specifically for the 33BLE?
But you can't just say "all Nanos". The original Nano used the Atmega328P microcontroller, but the 33BLE uses something completely different. It's a Nano only because the Arduino guys made a bad naming decision. I don't know if the original CardInfo works with the 33BLE. Maybe someone else can say if that's the case.