greiman / SdFat

Arduino FAT16/FAT32 exFAT Library
MIT License
1.07k stars 502 forks source link

The SD initialization failed #241

Open loliconce opened 3 years ago

loliconce commented 3 years ago

I do not know how to deal with this problem. The error code:

SD errorCode: SD_CARD_ERROR_CMD0 = 0x1 SD errorData = 0xff

greiman commented 3 years ago

Try running the QuickStart example. Reply with the results as printed, a description of your board, SD module, wiring, and any other useful info.

Post the results like this:

SPI pins:
MISO: 12
MOSI: 11
SCK:  13
SS:   10

Be sure to edit DISABLE_CHIP_SELECT if you have
a second SPI device.  For example, with the Ethernet
shield, DISABLE_CHIP_SELECT should be set to 10
to disable the Ethernet controller.

SD chip select is the key hardware option.
Common values are:
Arduino Ethernet shield, pin 4
Sparkfun SD shield, pin 8
Adafruit SD shields and modules, pin 10

Enter the chip select pin number: 5

Assuming the SD is the only SPI device.
Edit DISABLE_CHIP_SELECT to disable another device.

SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is chipSelect set to the correct value?
Does another SPI device need to be disabled?
Is there a wiring/soldering problem?

errorCode: 0x1, errorData: 0xff

Restarting

Enter the chip select pin number: 
loliconce commented 3 years ago

@greiman

The info:

SPI pins: MISO: 12 MOSI: 11 SCK: 13 SS: 10

Be sure to edit DISABLE_CHIP_SELECT if you have a second SPI device. For example, with the Ethernet shield, DISABLE_CHIP_SELECT should be set to 10 to disable the Ethernet controller.

SD chip select is the key hardware option. Common values are: Arduino Ethernet shield, pin 4 Sparkfun SD shield, pin 8 Adafruit SD shields and modules, pin 10

Enter the chip select pin number: 4

Assuming the SD is the only SPI device. Edit DISABLE_CHIP_SELECT to disable another device.

SD initialization failed. Do not reformat the card! Is the card correctly inserted? Is chipSelect set to the correct value? Does another SPI device need to be disabled? Is there a wiring/soldering problem?

errorCode: 0x1, errorData: 0x9

Restarting

Enter the chip select pin number:

greiman commented 3 years ago

Can't help you. You didn't give me info I asked for.

Reply with the results as printed, a description of your board, SD module, wiring, and any other useful info.

Do you have the SD module connected to the required pins?

SPI pins:
MISO: 12
MOSI: 11
SCK: 13
Enter the chip select pin number: 4
loliconce commented 3 years ago

@greiman

board :Arduino UNO SD module: https://chinese.alibaba.com/product-detail/SD-Card-Module-Slot-Socket-Reader-62484062968.html

I did connect the SD module to the require pins.

greiman commented 3 years ago

The board will never work. It does not have level shifters to convert from the Uno 5 V signals to the SD 3.3 V requirement.

loliconce commented 3 years ago

@greiman

What about this one : https://shopee.ph/Micro-SD-Card-Module-i.18252381.255216867?gclid=EAIaIQobChMIlrfLqKGC7gIVI4ZLBR0mkADgEAQYAiABEgIlgPD_BwE

greiman commented 3 years ago

You need a module like this. The part labled U1 is the level shifter.

loliconce commented 3 years ago

@greiman 👍 Thank you !

greiman commented 3 years ago

Look like it should work. It has a level shifter.