SD card with SPI adapter

vyo2003
Posts: 19
Joined: Fri Dec 22, 2017 8:36 am

SD card with SPI adapter

Postby vyo2003 » Sat Aug 18, 2018 2:07 pm

I've recieved this adapter some time ago and try to get it working with esp32. Hovever, with or without external pullup I always get one of that codes:
  • 0x108 — 5V
    0x107 — 3.3V
Is there any ideas how to fix it?

vyo2003
Posts: 19
Joined: Fri Dec 22, 2017 8:36 am

Re: SD card with SPI adapter

Postby vyo2003 » Sat Aug 18, 2018 2:42 pm

New results: 0x107 on both 5v and 3v.

vyo2003
Posts: 19
Joined: Fri Dec 22, 2017 8:36 am

Re: SD card with SPI adapter

Postby vyo2003 » Sat Aug 18, 2018 4:11 pm

Problem is solved by using another SD card. That one seems faulty…

weshouman
Posts: 2
Joined: Thu Jan 07, 2021 2:11 am

Re: SD card with SPI adapter

Postby weshouman » Thu Jan 07, 2021 2:28 am

When I use a couple of 16GB SD sards with an ESP32-WROOM-32 that I have an SD Card adapter connected externally I get the same issue (5v:0x107, 3v:0x108).
Following is tried GPIO connection and slot_config values

Code: Select all

slot_config.gpio_miso = 2
slot_config.gpio_mosi = 15
slot_config.gpio_sck = 14
slot_config.gpio_cs = 13
slot_config.dma_channel = 1

Code: Select all

slot_config.gpio_miso = 19
slot_config.gpio_mosi = 23
slot_config.gpio_sck = 18
slot_config.gpio_cs = 5
slot_config.dma_channel = 2
However when using the same 16GB SD cards with ESP32-DOWDQ6-based Lilygo T5 V2.3 they work.

How could I debug if that's a problem with the ESP32 or the adapter?

chegewara
Posts: 2364
Joined: Wed Jun 14, 2017 9:00 pm

Re: SD card with SPI adapter

Postby chegewara » Thu Jan 07, 2021 5:57 pm

I have thiis adapter connected in breadboard and 5V of course, and from time to time im having err 107 or 108 dont remember now. Its enough to move adapter a bit for better connection.

weshouman
Posts: 2
Joined: Thu Jan 07, 2021 2:11 am

Re: SD card with SPI adapter

Postby weshouman » Sat Jan 09, 2021 3:44 am

Fix is as following:

- Lower the communication frequency as the breadboard does not seem to be compatible with the default 20MHz
for example, use the following:

Code: Select all

    sdmmc_host_t host = SDSPI_HOST_DEFAULT();
    host.max_freq_khz = SDMMC_FREQ_DEFAULT/2; // <- added line, SDMMC_FREQ_PROBING could be used too
- Also, as @chegewara mentioned. Use 5 volts input (as the 3.3 volts input won't work)

Note: I didn't have to add any external pull-ups

Edit
Setting the max_freq_khz to any value less than the SDMMC_FREQ_DEFAULT and more than the SDMMC_FREQ_PROBING will enforce the use of SDMMC_FREQ_PROBING* which is a pretty low frequency, for example, for the a2dp_source example.
To go around that, one needs to set the sdmmc_types.h(line~135):SDMMC_FREQ_DEFAULT to a new value (may be 5000).

* Reference snippet from sdmmc_common.c(line~200):

Code: Select all

    uint32_t selected_freq = SDMMC_FREQ_PROBING;
    for (int i = 0; i < n_freq_values; ++i) {
        uint32_t freq = freq_values[i];
        if (card->max_freq_khz >= freq) {
            selected_freq = freq;
            break;
        }
    }

PeterR
Posts: 621
Joined: Mon Jun 04, 2018 2:47 pm

Re: SD card with SPI adapter

Postby PeterR » Sun Jan 10, 2021 10:22 pm

20 Mhz seems a lot. 10 Mhz might be pushing it.
Unfortunately there are a lot of clone cards.
I developed a product with an SD card & during reasearch bought many cards from a variety of suppliers from Amazon, ebay etc.
Each supposed OEM card bought either at different times or from different supplier had different; cases, labels, label colours etc.
Even major labels which led me to the conclusion that most cards were cheap copies.

Gate delays will really limit you're clock speeds & so cheap clones will not help. I would say that 6-8 MHz is probably a safer number.
& I also believe that IDF CAN should be fixed.

Who is online

Users browsing this forum: Bing [Bot], cdollar and 98 guests