Go Down

Topic: SdFat library error codes (Read 453 times) previous topic - next topic

Ben_Laszkowski1

Could someone please help me find out what the problem here is.

Board: Arduino Uno
Sd card: SanDisk Ultra 128 GB microSDXC
Sd module: from 'waveshare' https://www.robotshop.com/uk/micro-sd-storage-module.html

The circuit:
3.3V pin to module.
pin 10 to CS
pin 11 to MOSI
pin 12 to MISO
pin 13 to CLK

SdInfo message:

Quote
Card type: SDXC

Manufacturer ID: 0X3
OEM ID: SD
Product: SC128
Version: 8.0
Serial number: 0X58D8091A
Manufacturing date: 8/2013

cardSize: 127865.46 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true
OCR: 0XC0FF8000

SD Partition Table
part,boot,type,start,length
1,0X0,0X6,4224,124864512
2,0X0,0X0,0,0
3,0X0,0X0,0,0
4,0X0,0X0,0,0
error:
File System initialization failed.
SdFormatter message:

Quote
All data set to 0x00
Erase done

Formatting
Blocks/Cluster: 128
FAT32
error: write MBR
SD error: 57,ca
QuickStart message:

Quote
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: 0x25, errorData: 0xff
Been at this for a while, any idea as to what the error messages imply?

The file systems seems to be correct (FAT32). The card is correctly inserted. The chip select is correct. The wiring is correct.

Could it be a hardware isssue with the SD card or the module?



sterretje

#1
Nov 07, 2019, 03:48 pm Last Edit: Nov 07, 2019, 04:06 pm by sterretje
I suspect that SDXC is not supported.

From the readme.md on https://github.com/greiman/SdFat
Quote
The Arduino SdFat library provides read/write access to FAT16/FAT32 file systems on SD/SDHC flash cards.
// Edit
Form https://forum.arduino.cc/index.php?topic=67424.msg496004#msg496004, the maximum support disk size is 32GB; the info might be outdated but that might also pose a problem.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

Ben_Laszkowski1

Thanks for the reply.

I believe SDXC is supported up to 512GB, just need to use SDFormatter example to change to FAT32. https://forum.arduino.cc/index.php?topic=357127.0

I've solved the problem by buying a new SD module, it works absolutely fine now wiht the same SD card. No idea what the problem was.

One thing I did change was that the new SD module had a 5V-3.3V level shifter and was connected to the 5V pin on the Arduino. The first SD module didn't have a level shifter although was connected to the 3.3V pin on the Arduino so should have worked right?

sterretje

5V signals from the Arduino Uno can damage the card.
If you understand an example, use it.
If you don't understand an example, don't use it.

Electronics engineer by trade, software engineer by profession. Trying to get back into electronics after 15 years absence.

ShermanP

The first module was only for 3.3V systems.  You were powering the SD card with 3.3V, but sending 5V from the Uno to the CLK, MOSI and CS pins, which violates the absolute maximum ratings for the card.

Ben_Laszkowski1


Each pin (CLK, MOSI, MISO, CS) takes it's voltage from the UNO directly and not from the SD module? What's the point of connecting the SD module to 3.3V, what does it need the power for?

My guess would be that the SD module takes it's voltage from the 3.3V pin and distributes it to it's other pins like the CLK and MOIS etc...

Where am I going wrong in that reasoning?

ShermanP

#6
Nov 13, 2019, 04:53 pm Last Edit: Nov 13, 2019, 04:56 pm by ShermanP
Each pin (CLK, MOSI, MISO, CS) takes it's voltage from the UNO directly and not from the SD module? What's the point of connecting the SD module to 3.3V, what does it need the power for?

My guess would be that the SD module takes it's voltage from the 3.3V pin and distributes it to it's other pins like the CLK and MOIS etc...

Where am I going wrong in that reasoning?
Your reasoning doesn't match the schematic of the first module, which is attached.  You will see that the I/O lines have 10K pullup resistors to 3.3V, but the signals originate from the Arduino, which is a 5V device generating 5V output on its output pins.  The pullup resistor are just a minor current sink for those outputs, which still send the full 5V to the SD card's pins.

The 3.3V pin on the module is to provide power to the SD card.  This module works fine for 3.3V microcontrollers, but is just completely wrong for a 5V MCU.  There are lots of full-size SD modules that are just like this except that they are powered by a 5V input and include a 3.3V regulator.  But they still do the pullup resistor nonsense, which is all wrong.

You can't send 5V signals to an SD card powered at 3.3V and expect good things.  Amazingly, it does actually work sometimes, but only because the card designer made the I/O pins 5V tolerant.  But that's not part of the SD spec, so you can't depend on it.

Your second module does it the right way - a voltage regulator to provide 3.3V to power the card, and a level shifter I/C so the right voltage is applied to the input pins.  The only problem with it is that it doesn't release the MISO line when CS is disabled.  So it doesn't play well with other SPI devices.  But as long as it's the only SPI device, it should work fine.


Go Up