ESP32 SD card in SPI mode issues

rodorojas
Posts: 1
Joined: Sat Mar 18, 2023 10:44 am

ESP32 SD card in SPI mode issues

Postby rodorojas » Sat Mar 18, 2023 11:19 am

Hello to everyone. I am trying to add storage support to my project (based on a Esp32-devkit v1) using a Kingstone SDHC memory (4 Mbit/s) with a SPI card adapter and mounted in a breadboard. GPIOs line are as follow:

Esp32 Card adapter
GPIO_4 MISO
GPIO_15 MOSI
GPIO_14 CLK
GPIO_13 CS
3V3 Vin (I also bypassed adapter regulator and feed 3V3 directly)
GND GND

All four data lines have 10K pull-up resistors.
esp-idf commit is ee882708, and even this is far away from master (indeed is v4.4), is required because project can not compile with master due to an error in and non required component (but that is another story). Before trying to ad sd support, project was running smoothly.

Several issues arose when initializing card:
It correctly detects version of standard (i.e. version 2), but misdetect card as SDSC instead SDHC (I track this problem to sdmmc_init_ocr() function).
A time-out in sdmmc_init_sd_scr()

A call to sdmmc_print_card_info() returns incorrect info:
Name: 16���
Type: SDSC
Speed: 20 MHz
Size: 243MB

I tried this very same SD card and the very same card adapter in the arduino SD card_info example project, and detects shows correct card info, also try card in an USB adapter in my ubuntu box that shows correct size.

Thanks for your support.

Who is online

Users browsing this forum: HighVoltage and 124 guests