M2 cannot use SD card

I’m reasonably sure that the SD card slot is malfunctioning and my device will need to be replaced. Before we start, I’ve read both threads for similar problems.

The card in question is a SanDisk Ultra 16 GB microSDHC class 10.

Here is the timeline of events and my troubleshooting steps:

  1. Originally formatted card to FAT32 with macOS Disk Utility and used Arduino_Due_SD_HSMCI example code to build a program which writes to SD card.
  2. Yesterday, while debugging, I mounted the card to my laptop and deleted, confirming that the M2 could indeed write to the card.
  3. Today, every time I attempt to run my program I see:
    MS: Cannot initialize the SD card: MS: Card is unusable, try another one
    
  4. I mounted the card on my laptop again and confirmed I could write, eject, insert, and read the previously written file.
  5. I removed the SuperB. Still the same error.
  6. I reformatted the card again via Disk Utility in the following combinations: MBR FAT32, MBR ExFAT, GPT FAT32, GPT ExFAT. Each yielded the same error.
  7. I erased, unplugged, and flashed DataLogger_dif from the Arduino_Due_SD_HSMCI examples and tried again with each of the formats from (4). Each still yielded the same error.
  8. As per one of the previous threads, I downloaded the official SD Card Formatter from the SD Association and formatted the card with the Overwrite Format option. Still received the same error.
  9. I printed out digitalRead(SD_SW) with the card in the slot which read LOW, confirming that the SD switch is active.
  10. This time I attempted to run DataLogger_dif with no SD card inserted. Assuming the SD slot is functioning correctly and my understanding of Arduino_Due_SD_HSMCI is correct, I would expect to see an error such as:
    MS: Cannot initialize the SD card: MS: Card not found
    
    However, I again see:
    MS: Cannot initialize the SD card: MS: Card is unusable, try another one
    

This leads me to reasonable conclude there is a hardware issue with the SD functionality on my M2. The only troubleshooting effort I have not made is to attempt another card. I currently only have this card and two 128GB cards, which I’ve heard will not work with the M2. I would have to go buy a replacement card to test this. However, during the entire troubleshooting experience, I have still been able to mount, read, and write to the SD card from macOS.

Perhaps someone familiar with the hardware could instruct me on how to probe the PCB with a multimeter to confirm functionality?

Please read this article. The M2 driver, which is an Arduino Driver (Arduino Duo I believe?), is limited to the SD class of card only. If you want to use something bigger you will have to find a driver that can handle larger sd’s. Please note that formatting a card to the smaller format is not good enough. It may work erratic if at all.

I’m familiar with SD card type distinctions but I’m not sure I believe you on that one.

  1. I was able to read and write to this SD card with the M2 at one point. However you may argue that this is one of the erratic times where it happened to function correctly, so we continiue…

  2. @josh proved experimentally both here and here (via their pasted logs) that one can use an SDHC card with the library as did another user. In fact, Josh went so far as to say:

    It is possible that the library is only compatible with “microSDHC” (and not “SDXC”) cards which have a maximum capacity of 32GB. microSDXC capacities go up to 2TB !

  3. @CollinK suggested here:

    Thus, your best bet really is to stick with 16GB cards and smaller.

    Since it is impossible to have a 16GB non-SDHC card, one must assume he is describing an SDHC card.

  4. @josh says here that:

    For reference, we test every single M2 before it ships and this includes reading and writing to an SD several times.

    Our test rig uses a 16GB Lexar-branded MicroSD card.

    Given that plain SD cards are limited to 4 GB, this would imply that the Lexar card he is using is SDHC (since that is the SD card type for storage sizes between 4 and 32GB per your link). It does not make sense that Macchina would test their products for failures using an unsupported card type which you claim would work erratically, if at all, because the test would frequently fail with many false positives. Therefore I must assume the library supports SDHC cards.

You may simply want to try other brand of cards as well before you determine the reader is no good. Again you may get some functionality but not full functionality. You may also want to atleast try a smaller card. Also are you sure the M2 is properly working? I and others have had issues related to the USB cable. Normally it doesn’t connect properly or can’t get it to program but anything is possible.

I didn’t go back to my notes and look but if you saw others saying they used bigger cards then I was wrong there. You may still want to try a smaller card to check if it will work or not as they should be more compatible.

I don’t have any other cards aside from two 128 GB cards, so I’d have to go buy something and can’t do so immediately. I’m relatively certain that the M2 is functioning properly. I’m able to flash programs with no errors and my code changes are clearly taking effect and have had no issues with serial communication over the cable.

One thing that’s concerning to me is point (10) of my original post. I would expect that running the DataLogger_dif example from Arduino_Due_SD_HSMCI without an SD card inserted should yield:

MS: Cannot initialize the SD card: MS: Card not found

instead of

MS: Cannot initialize the SD card: MS: Card is unusable, try another one

However, I cannot test if the latter is truly the expected message. @redheadedrod would you be able to run that example sketch on your M2 and give me the resultant serial output? This should help narrow down the error domain.

@josh do you have any insight into this situation? I can try another SD card today, but without another M2 on hand, I’m nearing the limit of my debugging abilities.

Welp, I managed to co-opt an SD card from an existing project and found some interesting results. First, this other card is exactly the same model: SanDisk Ultra microSDHC 16 GB Class 10. Both cards can be mounted, written, and read from my laptop.

The other card, however, works with the M2. Why the first card, which should be identical, no longer works with the M2 but still works with my laptop is beyond explanation… Also, this would seem to confirm that the case in the SD library that should print:

MS: Cannot initialize the SD card: MS: Card not found

when an SD card is not present is never actually used, unless someone can prove otherwise.

@redheadedrod You may be interested to know why the error message in the above post is never printed. The answer is here and came up in my debugging of another issue.