Comments (7)
Did you edit SdFatConfig.h and modify SPI_DRIVER_SELECT
here?
The error SD_CARD_ERROR_INVALID_CARD_CONFIG
happens when SPI_DRIVER_SELECT
is >= 2 and no spi pointer is provided in SdSpiConfig(
).
Here is where the error occurs.
from sdfat.
Thank you Greiman for the quick response.
I did not modify SPI_DRIVER_SELECT in SdFatConfig.h.
Something I forgot to mention is the library version, 2.2.3., which should be the latest as I pulled it straight from git.
The error
SD_CARD_ERROR_INVALID_CARD_CONFIG
happens whenSPI_DRIVER_SELECT
is >= 2 and no spi pointer is provided inSdSpiConfig(
).
The error is not triggered in SdSpiCard.cpp.
The error comes from here instead.
Proof
Changes made to the code:
/** \return SD card error code. */
uint8_t sdErrorCode() {
if (m_card) {
return m_card->errorCode();
}
return 123; //SD_CARD_ERROR_INVALID_CARD_CONFIG;
}
Serial output with the format32 card:
SdFat version: 2.2.3
Assuming the SD is the only SPI device.
Edit DISABLE_CS_PIN to disable an SPI device.
Assuming the SD chip select pin is: 4
Edit SD_CS_PIN to change the SD chip select pin.
type any character to start
init time: 488 ms
Card type: SDXC
sdSpecVer: 3.00
HighSpeedMode: true
Manufacturer ID: 0X74
OEM ID: JE
Product: USDU1
Revision: 0.2
Serial number: 0XC8105DF6
Manufacturing date: 9/2014
CID HEX: 744A45555344553102C8105DF600E955
cardSize: 63383.27 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true
dataAfterErase: zeros
CSD HEX: 400E00325B590001D83D7F800A4000A5
OCR: 0XC0FF8000
SD Partition Table
part,boot,bgnCHS[3],type,endCHS[3],start,length
1,0X0,0XA,0X9,0X2,0XC,0XFE,0XFF,0XFF,32768,123762688
2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
Scanning FAT, please wait.
Volume is FAT32
sectorsPerCluster: 64
fatStartSector: 32800
dataStartSector: 63010
clusterCount: 1933319
freeClusterCount: 885415
Serial output with the exFat card:
type any character to start
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is there a wiring/soldering problem?
Is SD_CS_PIN set to the correct value?
Does another SPI device need to be disabled?
SD errorCode: SD_CARD_ERROR_UNKNOWN = 0X7B
SD errorData = 0X0
from sdfat.
There is a bug for the error code when SdFs fails.
Please change this function to:
SdCard* newCard(SdSpiConfig config) {
m_spiCard.begin(config);
return &m_spiCard;
}
Rerun the Sdinfo example and post the error code.
from sdfat.
The above had the wrong function. I edited it and hope it is correct.
from sdfat.
Serial output after proposed modifications:
SdFat version: 2.2.3
Assuming the SD is the only SPI device.
Edit DISABLE_CS_PIN to disable an SPI device.
Assuming the SD chip select pin is: 4
Edit SD_CS_PIN to change the SD chip select pin.
type any character to start
SD initialization failed.
Do not reformat the card!
Is the card correctly inserted?
Is there a wiring/soldering problem?
Is SD_CS_PIN set to the correct value?
Does another SPI device need to be disabled?
SD errorCode: SD_CARD_ERROR_ACMD41 = 0x17
SD errorData = 0x1
type any character to start
from sdfat.
The failure is here. This is the most common failure for SD sockets with marginal level shifters or marginal wiring.
CMD8 may have failed first which causes miss identification of the card. At this point I would use a microSD sniffer and a scope to checkout the SPI signals.
I used this setup with an old nano and a proven SD breakout with level shifters. The photo is at an angle but CS is pin 4 and SCK is pin32.
I tested with these exFAT cards:
All worked. Here is typical output:
SdFat version: 2.2.3
Assuming the SD is the only SPI device.
Edit DISABLE_CS_PIN to disable an SPI device.Assuming the SD chip select pin is: 4
Edit SD_CS_PIN to change the SD chip select pin.type any character to start
init time: 132 ms
Card type: SDXC
sdSpecVer: 6.00
HighSpeedMode: trueManufacturer ID: 0X1B
OEM ID: SM
Product: FD4Q5
Revision: 3.0
Serial number: 0X9287551E
Manufacturing date: 9/2021
CID HEX: 1B534D4644345135309287551EA159BDcardSize: 128177.93 MB (MB = 1,000,000 bytes)
flashEraseSize: 128 blocks
eraseSingleBlock: true
dataAfterErase: zeros
CSD HEX: 400E0032DB790003BAFF7F800A40002DOCR: 0XC0FF8000
SD Partition Table
part,boot,bgnCHS[3],type,endCHS[3],start,length
1,0X0,0XA,0X9,0X2,0X7,0XFE,0XFF,0XFF,32768,250314752
2,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
3,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0
4,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0X0,0,0Scanning FAT, please wait.
Volume is exFAT
sectorsPerCluster: 256
fatStartSector: 49152
dataStartSector: 65536
clusterCount: 977664
freeClusterCount: 977619
I can't recommend any other things to try since the failure is long before reading the card. Can't be the format and ACMD41 happens at low clock speed.
I will post a fix so the correct error code is returned for SdFs.
from sdfat.
Thanks!
I'll close the issue until I can test this with other sd card adapters/sniffers.
from sdfat.
Related Issues (20)
- ESP32 S3 always fails to mount card HOT 10
- Unable to format flat Spiflash module with ESP8266 HOT 4
- Mount issues for a Windows-formatted card HOT 35
- SD NAND XTSD01G (surface mounted chip) not formating HOT 1
- Unable to share the same SPI bus with TFT_eSPI on ESP32 HOT 3
- Problems with multiple SD card HOT 3
- Long timeout calling begin() on Teensy 4.1 when no card present HOT 5
- SdFat 2.22 with USER_SPI1 pin + another USER_SPI2 in SPI_Mode3 HOT 2
- Arduino-Pico: huge slowdown with v2.2.2 (vs.2.1.1) HOT 5
- Problem with SdFat and TwoWire instance. HOT 3
- sd.begin(SPI_CONFIG) breaks my DMA ADC datalogger on the SAMD51 HOT 5
- Issue after latest update. HOT 17
- Allocating bin file with 0s HOT 2
- CS_Pin has to be driven high on ESP32 (to be low at the SDCARD) because of some logic inbetween HOT 3
- Initialization fails with ESP32 HOT 1
- FsFile::isSystem() is missing. HOT 1
- 2.2.3 fails to compile HOT 10
- Request for SDIO 4-bit Support in Adafruit_Sdfat Library for SAMD51
- QuickStart fails to compile on ESP32 V3.0.3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sdfat.