MKR1200FOX and MKR SD Proto Shield

Hi
I can’t get this to work together.
My code will not register that there is an SD card.
I have tried with 2 different SD cards it won’t work, but they both work in a PC. They are formatted in FAT32, I also tried FAT16.
Is it because the MKR SD Proto Shield does not work with an MKR1200FOX?
Or what could be wrong.
My test code is very simple:

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

void setup() {
// put your setup code here, to run once:
if (SD.begin(4)) {
Serial.println(“There is a SD card”);
} else
{
Serial.println(“There is no SD card”);
}
}

void loop() {
// put your main code here, to run repeatedly:
}

Best regards
Jan Pedersen

There’s an example sketch in the IDE that tests out the basics of the SD card and module. I think it’s name is cardinfo. What do you see when you run that?

Hi Mark
This is what the test programs gives:

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?

Any ideas??

I took a quick look at the schematic for the 2 boards and there doesn’t look to be a clash of pins. It looks like pin 4 is the correct CS pin. Did you format the SD card as per the pinned post at the top of the forum?

Yes, I have tried formatting, both in FAT32 and FAT16.
I suspect that the the MKR SD Proto Shield does not work with an MKR1200FOX, but on Arduino.cc they said that all MKR boards have the same pin setup?

Hmmm, ok, we might get a clue of what’s going on if you can print out the error code. I had a quick look at the SD library and it seems that there’s a function called errorCode() that should return a number indicating where the problem may lie.

It saids that the errorCode() is not declared??

Strange. I figured that altering the example code to something like:


  // 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(card.errorCode());
    while (1);
  } else {
    Serial.println("Wiring is correct and a card is present.");
  }

would compile and print out the error code. I’ve not tested it on an actual module - just going with what I can see in the source code to the library on github.

Wrong spelling :slight_smile:

I came back with errorcode 1 ?

According to the source code:

/** timeout error for command CMD0 */
uint8_t const SD_CARD_ERROR_CMD0 = 0X1;

The error is raised in response to the first attempt to communicate with the SD card in init(). Do you have another SD card that you can try?

There’s a discussion on the forums that I found. Reply #6 may be relevant, but I’d try other cards before considering a hardware problem.

I have tried with 3 card, and they give 3 different errorcode, 1, 2 and 8??

I have tried to measure between pin 3 on the SD card and GND, and there is connection?

Now I tried with a new MKR1200FOX, and now I get this error:
Card type: SD2
Could not find FAT16/FAT32 partition.
Make sure you’ve formatted the card

But it is already formatted as FAT32?

Your last post appears to indicate significant progress. The SD library is now communicating with the card. I would try various SD card formatting utils and even a small capacity card just to get a known working setup.

It might be worth buzzing out the connections between the MKR1200 and the SD board just in case there is an issue with the actual headers on the MKR1200. It’s a long shot but I have had a board where there was a problem.

Ok, now I order a new MKR MEM SHIELD, and now every things works, and there is no problems, so I think that there is an error on the MKR SD Proto Shield, just as the other discussion mention

This topic was automatically closed after 120 days. New replies are no longer allowed.