In the SD card library, the call to SD.begin() returns only boolean that indicates success or failure.
How can one get more detailed information about the specific reason the card could not be accessed?
SD.begin() -- details on failure reason?
Moderators: adafruit_support_bill, adafruit
Please be positive and constructive with your questions and comments.
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: SD.begin() -- details on failure reason?
Are you running the adafruit/SdFat v2 (v2.2.1 is current) library fork?
https://github.com/adafruit/SdFat
If so some of the examples might help drill down to the failure. I would start with this SdInfo example
https://github.com/adafruit/SdFat/blob/ ... SdInfo.ino
If this fails please post the error and more info about your wiring, controller board, etc.
https://github.com/adafruit/SdFat
If so some of the examples might help drill down to the failure. I would start with this SdInfo example
https://github.com/adafruit/SdFat/blob/ ... SdInfo.ino
If this fails please post the error and more info about your wiring, controller board, etc.
- adavid7
- Posts: 120
- Joined: Fri Jul 04, 2014 7:32 pm
Re: SD.begin() -- details on failure reason?
Thanks for the hint; I'll go look at those.
But what I did was just use the Library Manager in the IDE Version: 2.0.3 and install the SD library from the Arduino installation available there, version 1.2.4, as attached.
Is that not the right one? I don't think the Datalogger tutorial for the Data Logging shield (adafruit.com/product/1141), which is what I'm using, mentions which library to install.
But what I did was just use the Library Manager in the IDE Version: 2.0.3 and install the SD library from the Arduino installation available there, version 1.2.4, as attached.
Is that not the right one? I don't think the Datalogger tutorial for the Data Logging shield (adafruit.com/product/1141), which is what I'm using, mentions which library to install.
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: SD.begin() -- details on failure reason?
You can use the Arduino SD library.
Are you using an Arduino UNO?
Does CardInfo.ino also fail?
https://github.com/arduino-libraries/SD ... rdInfo.ino
Are you using an Arduino UNO?
Does CardInfo.ino also fail?
https://github.com/arduino-libraries/SD ... rdInfo.ino
- adavid7
- Posts: 120
- Joined: Fri Jul 04, 2014 7:32 pm
Re: SD.begin() -- details on failure reason?
I am using a Metro (https://www.adafruit.com/product/2488) with the Adafruit Datalogging shield (https://www.adafruit.com/product/1141).
Cardinfo succeeds:
Cardinfo succeeds:
Code: Select all
12:36:33.951 ->
12:36:33.951 -> Initializing SD card...Wiring is correct and a card is present.
12:36:34.016 ->
12:36:34.016 -> Card type: SDHC
12:36:34.047 -> Clusters: 1935671
12:36:34.079 -> Blocks x Cluster: 8
12:36:34.079 -> Total Blocks: 15485368
12:36:34.111 ->
12:36:34.111 -> Volume type is: FAT32
12:36:34.143 -> Volume size (Kb): 7742684
12:36:34.175 -> Volume size (Mb): 7561
12:36:34.207 -> Volume size (Gb): 7.38
12:36:34.239 ->
12:36:34.239 -> Files found on the card (name, date and size in bytes):
12:36:34.317 -> DATALOG.TXT 2000-01-01 01:00:00 39247
12:36:34.334 -> BUTTON~2.TXT 2023-01-27 11:41:18 10
12:36:34.367 -> _BUTTO~2.TXT 2023-01-27 11:41:18 4096
12:36:34.431 -> FSEVEN~1/ 2023-01-27 14:03:44
12:36:34.463 -> 0000,560.,48/ 2004-01-16 06:09:34
12:36:34.495 -> 30,417,4.16,/ 2005-09-12 06:01:32
12:36:34.527 -> ,378,381.
12:36:34.559 -> 1/ 2005-09-19 06:25:24
12:36:34.559 -> 43
12:36:34.591 -> 1400.000/ 2005-09-12 06:49:40
12:36:34.623 -> 000000,3.49,/ 2007-01-17 01:16:26
12:36:34.655 -> FSEVEN~1 2023-01-27 20:33:32 36
12:36:34.687 -> DATA00.CSV 2023-01-01 00:00:00 210
- mikeysklar
- Posts: 13824
- Joined: Mon Aug 01, 2016 8:10 pm
Re: SD.begin() -- details on failure reason?
That is good that CardInfo works. The wiring and card formatting are all good.
You can also try the other examples.
https://github.com/arduino-libraries/SD ... r/examples
You can also try the other examples.
https://github.com/arduino-libraries/SD ... r/examples
Please be positive and constructive with your questions and comments.