Hello Jan,
I am having a similar issue init’ing the SDBlockDevice. I have tried 6 different SPI SD Card adapters, and many microSDs of different sizes, and from different manufacturers and of different standards (SD/SDHC/SDXC). Still, the init() stage fails for me.
Switching the SPI Adapter VCC between 3V and 5V off the STM32 does not seem to make a difference. I have also experimented with different init frequencies (100KHz, 150KHz, 400KHz) but these did not seem to affect the init sequence eventual result either. They all seem to fail right after CMD9 in reading back the card-specific data.
Any thoughts on what could cause this? My debug logs (for 3 different configurations and runs) are below. Can you see anything amiss?
Similar to your setup, I am powering my NUCLEO F767ZI off the USB only.
Thanks
Nuertey
DEBUG LOGS:
============================================================
HiLetgo 5pcs Micro SD TF Card Adater Reader Module 6Pin SPI Interface Driver Module
init frequency of 150 KHz (and 400 KHz) gives same result.
micro SDCARD, 1GB => Connected its VCC to +3V GPIO on STM32.
Mbed OS version: 6.16.0
Built: Jul 30 2022, 12:17:52
Calling the SDBlockDevice init() method…
*Running SDBlockDevice::_initialise_card() … *
CMD:0 arg:0x0 Response:0x1
CMD:8 arg:0x1aa Response:0x1
V2-Version Card
R3/R7: 0x1aa
CMD:58 arg:0x0 Response:0x1
R3/R7: 0xff8000
Indicating to SDCard that we support HC/XC capacity cards in ACMD41…
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x0
Card Initialized: Version 2.x Card
CMD:58 arg:0x0 Response:0x0
R3/R7: 0x80ff8000
*Card Initialized: Standard Capacity Card: Version 2.x *
CMD:59 arg:0x0 Response:0x0
init card = 1
*Running SDBlockDevice::_sd_sectors() … *
CMD:9 arg:0x0 Response:0x0
Nuertey Expecting 0xFE here: 0x40
Nuerkie Expecting 0xFE here: 0x26
*Running SDBlockDevice::_read_bytes() … *
*Running SDBlockDevice::_wait_token() … *
_wait_token: timeout
Read timeout
Couldn’t read csd response from disk
CMD9 failed as: “0 == _sectors”
After SDBlockDevice init() method…
Error! SDBlockDevice Init failed: [-4001] → “device specific error”
============================================================
Same SPI adapter as previous, same init frequency of 150 KHz.
but rather microSDXC UHS-I CARD, 64GB => Connected its VCC to +3V GPIO on STM32.
Mbed OS version: 6.16.0
Built: Jul 30 2022, 12:17:52
Calling the SDBlockDevice init() method…
*Running SDBlockDevice::_initialise_card() … *
CMD:0 arg:0x0 Response:0x1
CMD:8 arg:0x1aa Response:0x1
V2-Version Card
R3/R7: 0x1aa
CMD:58 arg:0x0 Response:0x1
R3/R7: 0xff8000
Indicating to SDCard that we support HC/XC capacity cards in ACMD41…
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x0
Card Initialized: Version 2.x Card
CMD:58 arg:0x0 Response:0x0
R3/R7: 0x80ff8000
*Card Initialized: Standard Capacity Card: Version 2.x *
CMD:59 arg:0x0 Response:0x0
init card = 1
*Running SDBlockDevice::_sd_sectors() … *
CMD:9 arg:0x0 Response:0x0
Nuertey Expecting 0xFE here: 0x4f
Nuerkie Expecting 0xFE here: 0x20
*Running SDBlockDevice::_read_bytes() … *
*Running SDBlockDevice::_wait_token() … *
_wait_token: timeout
Read timeout
Couldn’t read csd response from disk
CMD9 failed as: “0 == _sectors”
After SDBlockDevice init() method…
Error! SDBlockDevice Init failed: [-4001] → “device specific error”
============================================================
Maxmoral 2PCS Micro SD Storage Board Memory Shield Expansion Module 6 Pin SPI Interface Mini TF Card Adapter Reader
init frequency of 150 KHz (and 400 KHz) gives same result.
micro SDCARD, 1GB => Connected its VCC to +5V GPIO on STM32.
Mbed OS version: 6.16.0
Built: Aug 9 2022, 19:59:53
Calling the SDBlockDevice init() method…
*Running SDBlockDevice::_initialise_card() … *
CMD:0 arg:0x0 Response:0x1
CMD:8 arg:0x1aa Response:0x1
V2-Version Card
R3/R7: 0x1aa
CMD:58 arg:0x0 Response:0x1
R3/R7: 0xff8000
Indicating to SDCard that we support HC/XC capacity cards in ACMD41…
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x1
CMD:41 arg:0x40000000 Response:0x0
Card Initialized: Version 2.x Card
CMD:58 arg:0x0 Response:0x0
R3/R7: 0x80ff8000
*Card Initialized: Standard Capacity Card: Version 2.x *
CMD:59 arg:0x0 Response:0x0
init card = 1
*Running SDBlockDevice::_sd_sectors() … *
CMD:9 arg:0x0 Response:0x0
Nuertey Expecting 0xFE here: 0x0
Nuerkie Expecting 0xFE here: 0x26
*Running SDBlockDevice::_read_bytes() … *
*Running SDBlockDevice::_wait_token() … *
_wait_token: timeout
Read timeout
Couldn’t read csd response from disk
CMD9 failed as: “0 == _sectors”
After SDBlockDevice init() method…
Error! SDBlockDevice Init failed: [-4001] → “device specific error”