2

A device I had been testing for over two months suddenly started giving FR_DISK_ERR (I'm using Elm Chan's FAT-FS) [Link]. When I tried debugging, the command (CMD0) which must be clocked in to set the SD card into SPI mode (as described in the SD card spec sheet - SDcard.org [link]) return 0xFF and not 0x01, i.e. it failed. My question is:

*If CMD0 fails does that mean the SD card controller is not working?

*Will it still work in SDIO mode even if CMD0 fails? (I couldn't test it as my uC does not support SDIO)

*Can an OS (Linux, Windows, Mac) format this SD card to make it working again? If so how does it do it?

Chan's FAT-FS has no method to solve if we have an FR_DISK_ERR, so I need to find a way to solve this remotely.

clamentjohn
  • 386
  • 3
  • 15
  • Try two different cards and confirm with a logic analyzer what really happens on the bus. I have experienced several SD card failures. – filo May 11 '17 at 07:35
  • I tried with two different cards. They worked, except for this one. I tried this SD card in another device too, I get the same issue with the second device and failing SD card. How does a card become corrupted like this, how does the uC in the card stop responding? – clamentjohn May 11 '17 at 08:42
  • Even gparted (Linux) is not able to recognize the sd card. I get an error "input/output error during read on /dev/sdb". – clamentjohn May 11 '17 at 09:05
  • 1
    Just throw this card away. Card can also be counterfeit https://www.bunniestudios.com/blog/?page_id=1022 or this one just had less luck (I've killed once a Samsung card in a raspberry pi in a year without doing any writes). – filo May 11 '17 at 10:36
  • @filo, I have an SD card that does not respond to CMD9, which is to get the CSD register. But this command fails (timeout). Can this be because the card only supports SDIO (CMD9 not supported in SDIO). – clamentjohn May 12 '17 at 11:11
  • No, every single SD card supports good old SPI. Are you sending two dummy bytes between commands? Did you send ~80 clocks before starting anything with the card? – filo May 12 '17 at 15:39
  • Yes, right before we send CMD0 we sent 74 dummy bytes. But we are only sending one dummy byte before every command. I'm using a driver made by Ya Dan, powermcu.com, this worked for all the other devices, so the driver is in good condition. It might be the SD card. – clamentjohn May 12 '17 at 15:47

1 Answers1

1

If CMD0 fails, it's either the SPI/ SDIO pins are not connected properly (check your connections) or the controller is not actually working. In my case, the controller wasn't working. I tried using it in my Linux PC, even gparted was unable to detect it. I'm still unsure why CMD9 failed, I have tried to contact the manufacturer, let's see what they respond to that. And that answers my own question.

clamentjohn
  • 386
  • 3
  • 15