Hi, I am wondering if this custom 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
Karosm
(Karosm)
February 18, 2025, 10:47am
2
Quite likely if any adapter works with “this library”.
That adapter has just voltage regulator and level shifters on board.
nickrout
(Nick Rout)
February 18, 2025, 6:15pm
3
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.
An SD card component for esphome
Karosm
(Karosm)
February 18, 2025, 8:07pm
5
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.
Karosm
(Karosm)
February 18, 2025, 8:33pm
7
But somehow you need to power that board.
Yea haha, I dont have any pins labelled “data”, data0 data1 etc.
zoogara
(Daryl)
February 18, 2025, 9:04pm
11
Looks like that library is written to drive the SD card directly, the SD interface has 4 data channels…
Karosm
(Karosm)
February 18, 2025, 9:06pm
12
ShadowFist:
Well, I warned you
Same boat, I can barely read english
1 Like
Karosm
(Karosm)
February 18, 2025, 9:08pm
13
The module doesn’t seem to have any driver either. Like most of them.
neel-m
(Neel Malik)
February 18, 2025, 11:08pm
14
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:
opened 12:25PM - 05 Dec 24 UTC
closed 09:59AM - 11 Dec 24 UTC
Error below:
```
Failed config
sd_mmc_card: [source /config/esphome/ip86_lv… gl1.yaml:146]
Pin XX is used in multiple places.
id: sd_card
mode_1bit: True
clk_pin:
number: 18
mode:
output: True
input: False
open_drain: False
pullup: False
pulldown: False
inverted: False
ignore_pin_validation_error: False
```
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
neel-m
(Neel Malik)
February 19, 2025, 10:01pm
16
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