MicroSD Card Adapter Not Working for Arduino 33BLE

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.



Please draw a labelled schematic, take a picture and post. Also post ALL code in code tags using ^^^^^^

What voltage does the SD card module run at ?

It is impossible to see from your pictures which is one reason for asking you to post a schematic. A 'photo of a hand drawn circuit is good enough

Here's the code and schemeatic:

/*
  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) {
}

Apologies, the SD module uses a 3.3V regulator but also supports 5V.

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

1 Like

You are creating a rod for your own back using a breakout designed for interfacing to a 5V board with a 3.3V board.

With a 3.3V board all you want is something that breaks out the signals w/o all the level shifting stuff. Something like:

1 Like

Thing is, I've seen arduino nano used with my sd card module and it works fine, are you sure the level shifting is the problem?

Never mind then. Please disregard everything I said.

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?

1 Like

This is the card, I'm pretty sure the code works for all nano's but I'll have to do more research.

That card should work fine.

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.

Ah thanks for the reply, there's a couple different SD card libraries that I will try such as SdFat

You're missing the point.

What point?

The voltage point that no library yet has overcome.

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