Page 1 of 2
Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Sun Jun 08, 2025 1:54 pm
by johnsondavies
I can't get the MicroSD card slot to work on the ESP32-P4-EV board. I've tried:
Code: Select all
SPIClass myspi(HSPI);
SPI.begin(43, 39, 44, 42); // SCK, MISO, MOSI, SS
pinMode(45, OUTPUT);
digitalWrite(45, LOW); // SD_PWRn for MicroSD power
SD.begin(42, myspi);
but it still won't read an SD card. Any suggestions would be greatly appreciated!
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Sun Jun 08, 2025 4:29 pm
by lbernstone
I don't have a P4 to test on, but there is no need to create a new SPI object. The
example should work fine if you just reassign pins. Are you sure pin 45 is inverted? How are you gating the power? Force it "ON" while testing the driver. I don't have a P4 to test, but the
variant file includes this nugget:
// Use GPIOs 36 or lower on the P4 DevKit to avoid LDO power issues with high numbered GPIOs.
Code: Select all
SPI.begin(43, 39, 44, 42); // SCK, MISO, MOSI, SS
SD.begin(42);
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Tue Jun 10, 2025 10:02 am
by chegewara
I can't get the MicroSD card slot to work on the ESP32-P4-EV board. I've tried:
Code: Select all
SPIClass myspi(HSPI);
SPI.begin(43, 39, 44, 42); // SCK, MISO, MOSI, SS
pinMode(45, OUTPUT);
digitalWrite(45, LOW); // SD_PWRn for MicroSD power
SD.begin(42, myspi);
but it still won't read an SD card. Any suggestions would be greatly appreciated!
Are you trying to use on board SD card slot or connect own?
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Thu Jun 12, 2025 11:25 am
by johnsondavies
Thank you for the suggestions, but still not working.
there is no need to create a new SPI object.
I've tried:
SPI.begin(43, 39, 44, 42); // SCK, MISO, MOSI, SS
SD.begin(42);
but that doesn't help.
Are you trying to use on board SD card slot or connect own?
I'm trying to use the on-board MicroSD slot.
Are you sure pin 45 is inverted? How are you gating the power?
In the
pins_arduino.h file it's defined as:
#define BOARD_SDMMC_POWER_PIN 45
#define BOARD_SDMMC_POWER_ON_LEVEL LOW
I'm doing:
pinMode(45, OUTPUT);
digitalWrite(45, LOW);
Thanks!
David
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Thu Nov 27, 2025 12:43 pm
by andromeda92
I have the same problem with Waveshare ESP32-P4 dev kit basic
SD_MMC work fine, but not with SD.h (SD_Test.ino)
pins are the same that EV-BOARD.
Any solution ?
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Thu Nov 27, 2025 7:24 pm
by lbernstone
Works just fine for me. Remember to flip the switch on. On my board (P4-EYE), the switch is on pin 46, and must be held low to power the sd. I didn't test 4-bit. What's the use case where would you use SD instead of SD_MMC?
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Fri Nov 28, 2025 1:01 pm
by andromeda92
I wanted to test the functionalities of the Waveshare ESP32-P4 Dev Kit Basic board, and I noticed that the SD_mmc example worked fine, but SD_Test, which uses SD.h and SdFat, doesn't.
Many applications use SD.h or SdFat, such as RunCPM under Arduino, etc., so I'm limited to the level of these applications that don't work.
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Sat Nov 29, 2025 3:26 am
by lbernstone
Well, the
SD_Test sketch does work for me, just by setting the REASSIGN_PINS section. As mentioned above, make sure you turn on the SD switch, which on that
board appears to be gpio45, and low is on.
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Sat Nov 29, 2025 9:01 am
by andromeda92
with this it not work.
i have uncommented #define REASSIGN_PINS
Code: Select all
void setup() {
Serial.begin(115200);
#ifdef REASSIGN_PINS
//pinMode(46, OUTPUT);
//digitalWrite(46, LOW);
//SPI.begin(sck, miso, mosi); //, cs);
pinMode(45, OUTPUT);
digitalWrite(45, LOW);
SPI.begin(43, 39, 44,42); // SCK, MISO, MOSI, SS
if (!SD.begin()) {
#else
if (!SD.begin()) {
#endif
Serial.println("Card Mount Failed");
return;
}
can you put your code from SD_Test ?
Re: Can't get MicroSD working on ESP32-P4-Function-EV-Board
Posted: Sat Nov 29, 2025 9:22 am
by andromeda92
i have tested with two sdcard, and is the same.
https://imgur.com/a/5khT3wW