Question regarding SDCard integration

Hi, I am wondering if thiscustom integration will work with this SD card adapter.

The reason I ask is my module does not have this many pins.

sd_mmc_card:
  id: sd_mmc_card
  mode_1bit: false
  clk_pin: GPIO14
  cmd_pin: GPIO15
  data0_pin: GPIO2
  data1_pin: GPIO4
  data2_pin: GPIO12
  data3_pin: GPIO13

This is my module.

Thanks

Quite likely if any adapter works with “this library”.
That adapter has just voltage regulator and level shifters on board.

Which SD card integration are you talking about? There isn’t one afaik in esphome.

Sorry I messed up the wording.

Here is the custom integration.

Answer is same. If that custom comp generally works, it’s likely working with your module as well. Sd cards are connected directly through SPI (with level shifter), so in theory any module should work.

I see 6 pins defined in the code & 6 pins in the image you attached.

I’m no genius, but it seems to me those numbers are the same.

But somehow you need to power that board. :wink:

Yea haha, I dont have any pins labelled “data”, data0 data1 etc.

Well, I warned you

1 Like

HAHA! gold!

Looks like that library is written to drive the SD card directly, the SD interface has 4 data channels…

Same boat, I can barely read english :wink:

1 Like

The module doesn’t seem to have any driver either. Like most of them.

mode_1bit (Optional, bool): specify wether to use 1 or 4 bit lane

That is the magic you need to use and only set the data_0 pin

This issue suggests someone got it to work:

I have not tried it and there is no example with 1-bit mode, but that is likely what you need.

Ok sorry I am confused.

Am I replacing the SPI with data0 and data1?

So no SPI.

spi:
  clk_pin: GPIO18
  mosi_pin: GPIO23
  miso_pin: GPIO19

Instead like this?

sd_mmc_card:
  cs_pin: GPIO5
  id: my_sd_card
  clk_pin: GPIO18
  data0_pin: GPIO23
  data1_pin: GPIO19

Then I get this.

'cmd_pin' is a required option for [sd_mmc_card].

Thanks

sd_mmc_card:
  id: my_sd_card
  mode_1bit: true
  clk_pin: GPIO18
  cmd_pin: GPIO23
  data0_pin: GPIO19

was the config in the repo for the 1-bit mode, which I think your card needs, since it doesn’t have enough pins to use 4-bit mode.

Which GPIOs to use will depend on how you have it wired up.

This link seems helpful: How do i pinout 1 bit mode on SD? 3 different ways? - ESP32 Forum

Ok I finally got it compiled. But now I get this. I must be honest I have done very little with SPI.

Wired as follows.

CLK >> GPIO18
MISO >> GPIO19
CS >> GPIO5
MOSI >> GPIO13

[08:23:17][C][sd_mmc_card:020]: SD MMC Component
[08:23:17][C][sd_mmc_card:021]:   Mode 1 bit: TRUE
[08:23:17][C][sd_mmc_card:022]:   CLK Pin: 18
[08:23:17][C][sd_mmc_card:023]:   CMD Pin: 13
[08:23:17][C][sd_mmc_card:024]:   DATA0 Pin: 19
[08:23:17][E][sd_mmc_card:044]: Setup failed : Failed to set pins
[08:23:17][E][component:082]:   Component sd_mmc_card is marked FAILED