Page 1 of 3
ESP32 SD-Card can no longer be initialised
Posted: Fri Jul 21, 2023 8:47 am
by stefan.erni
Hi Ben
I wanted to use an SD card in the current project with an ESP32.
The programme compiles without any problems
But when I started the hardware, it always stopped at the SD card initialisation.
So i compiled an older project, which worked fine, but now this also hangs at the sd card initialisation while loop.
regards
Stefan
always in the while loop....

- Snag_28589d.png (40.73 KiB) Viewed 16642 times
Re: ESP32 SD-Card can no longer be initialised
Posted: Fri Jul 21, 2023 3:58 pm
by BenR
Hello,
We are using an SD card here with ESP without any issues, please can you check the fast SPI rate property for the SD card component. We are using 20MHz I beleive and most cards are working fine with this but I have found a couple of cards that don't work at all.
Re: ESP32 SD-Card can no longer be initialised
Posted: Fri Jul 21, 2023 4:50 pm
by stefan.erni
Hi Ben
It's good to know that it should actually work. Thank you.
The card is aways the same type and the speed I did not change.
On the hardware is a display on the same SPI bus. Maybe I cached a problem with one of this both component.
The cards was working always fine even with the display.
In the schematic the display has no MISO pin A19
I will take a closer look where the problem is
regards
Stefan
Both on SPI bus was working....
Re: ESP32 SD-Card can no longer be initialised
Posted: Fri Jul 21, 2023 4:55 pm
by BenR
Initial prescaler needs to be 400KHz max. Hopefully this will solve things for you.
Re: ESP32 SD-Card can no longer be initialised
Posted: Mon Jul 24, 2023 8:18 am
by stefan.erni
Hi Ben
I tried with 400kHz but it does not work.
What is a little funny is that it has already worked half a year ago.
I have not changed anything in the hardware or at the program.
I will take a closer look
regards
Stefan
Re: ESP32 SD-Card can no longer be initialised
Posted: Mon Jul 24, 2023 2:28 pm
by stefan.erni
Hi Ben
I made a second testprogram (test_no_display) and with the USB I control the ret_sdcard byte.
It's working nice.
So I added the display to this programm and still working.
But I did the same commands in the test1 and there it's not working.
no idea what the difference is.
regards
Stefan
Re: ESP32 SD-Card can no longer be initialised
Posted: Wed Jul 26, 2023 10:13 am
by stefan.erni
Hi Ben
The File SD/SDHC and Display GLCD (ILI9341 SPI)
are not working on the same SPI Bus anymore.
If I change the File SD/SDHC component to SPI software mode then it's working again
regards
Stefan
Re: ESP32 SD-Card can no longer be initialised
Posted: Mon Jul 31, 2023 5:23 pm
by BenR
Hi Stefan,
It might be interesting to see how the C code differs between the two projects. Looking at the source there is nothing jumping out at me other then the order of components in the project file.
I'll try generating the C here and see if that's got any clues.
Re: ESP32 SD-Card can no longer be initialised
Posted: Tue Aug 08, 2023 10:51 am
by stefan.erni
Hi Ben
I guess there is still a problem with the Ili9341 SPI display, the File SD and ESP32.
When I load the File SD2 component I cannot select a pin like before File SD1. Also something is wrong with the display, in one program it's working but it does not work in another. Although same configuration and hardware.
regards
Stefan

- Snag_9c9870.png (34.94 KiB) Viewed 16467 times

- Snag_9c874a.png (41.53 KiB) Viewed 16467 times
Re: ESP32 SD-Card can no longer be initialised
Posted: Tue Aug 08, 2023 3:54 pm
by BenR
Hello,
Thanks for letting us know, hopefully all solved for you now.
You might want to switch the properties back to the titles rather then the variables unless your specifically using the variables.
To do this right click on the Properties text and select Show titles.

- ShowTitles.jpg (27.76 KiB) Viewed 16461 times