ESP32 SD-Card can no longer be initialised

Any bugs you encounter with Flowcode should be discussed here.
stefan.erni
Valued Contributor
Posts: 758
http://meble-kuchenne.info.pl
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben

Still problem with the sd card.
All the cards are same type and works perfect few month ago.
In the EMG recorder with a pic32 the cards there are all ok ( the program there i did not compile this year)

With softwaremode SPI it's not working anymore and the program is freezing.

I startet a new ESP32 project and added Display and sc-card new. The display is working this way.
The Sd card not but one of the card is working.
The initial clock I set to 400kHz for the card
I have no idea what is going on
regards
Stefan

medelec35
Matrix Staff
Posts: 1451
Joined: Wed Dec 02, 2020 11:07 pm
Has thanked: 512 times
Been thanked: 472 times

Re: ESP32 SD-Card can no longer be initialised

Post by medelec35 »

Hi Stefan.
There have been some new updates recently.
Can you try again after doing a full database update?
Martin

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben, Hi Martin

I did also the last update, it's the same.

I checked the initial clock speed from the sd-card clock pin and it was 10Mhz (like the display clock)
I actually expected 400khz like the config from the sd-card. So i changed the clock from the display to 400kHz and the SD-card clock was 400khz
and all the 5pcs cards was working.
I put the display clock to 25Mhz and not one card from 5pcs was working.
So I put the display clock to back to 400Khz and all the cards was working.


But it's not so clear... if I set the SD-card 10Mhz and the the display to 400Khz it's not working.

As if the higher clock is used or the 400khz does not work at setup sd-card

regards

Stefan

test1
scope_0.png
scope_0.png (28.99 KiB) Viewed 8756 times
test2
scope_1.png
scope_1.png (33.01 KiB) Viewed 8756 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

...
I set all the clock to 5Mhz (also the initial clock SD-card) and then it's working :)


And it's a 5Mhz clock
Attachments
scope_4.png
scope_4.png (26.23 KiB) Viewed 8755 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben

It's look like the sd-card Initial speed properties has no effect to the card, if on the SPI bus are a display and a sd-card.
With the disadvantage, the display and sd-card are both slower, they cannot run at their maximum speed.
and the special thing is that it actually works with a wrong (80 Mhz) initial speed.
regards
Stefan

Testresult with different spi-speed
Snag_8c7045.png
Snag_8c7045.png (15.09 KiB) Viewed 8655 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben

On the ESP32 is still a problem with the (SPI) FAT for the sd-card.
The initial speed properties has no function, so I have to lower the highspeed to the initalspeed to 5Mhz

I get my PIC32 Board and made a test. There the initialspeed is working on the PIC32 nice.

Both PIC32 and ESP32 have the same version of FAT.

And I did the same test as with your new 4bit SD-component. Instead of 1 second it needs 120 seconds with the ESP32 and the (SPI) FAT!

Also a small problem, the oled display on the same SPI bus I have to run slowly with 5Mhz.

Could you look at why the ESP32 makes problems with the FAT initialspeed?

regards

Stefan

Snag_1a2baa4.png
Snag_1a2baa4.png (15.54 KiB) Viewed 5790 times
Snag_1a2eadb.png
Snag_1a2eadb.png (12.32 KiB) Viewed 5790 times

BenR
Matrix Staff
Posts: 1739
Joined: Mon Dec 07, 2020 10:06 am
Has thanked: 440 times
Been thanked: 603 times

Re: ESP32 SD-Card can no longer be initialised

Post by BenR »

Hi Stefan,

It sounds like the deisplay might be causing the headaches and stopping the SD card going into high speed mode. Can you attach your test project and I'll have a look.

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben

Here is my test
I reduce the number of test to 200....
It's need 1 second

regards

Stefan
sd_card_Test2.fcfx
(30.33 KiB) Downloaded 482 times
Snag_3df870.png
Snag_3df870.png (43.63 KiB) Viewed 5723 times
Snag_3afe3b.png
Snag_3afe3b.png (50.49 KiB) Viewed 5723 times

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben
and stopping the SD card going into high speed mode
It looks more like the initial prescaler with the ESP32 is no longer working. It has no influence on what I choose there.
This means that the speed cannot be reduced to initial the sd-card.
However, it has already worked with the FC9, with the same software and hardware.

regards
Stefan

stefan.erni
Valued Contributor
Posts: 758
Joined: Wed Dec 02, 2020 10:53 am
Has thanked: 149 times
Been thanked: 171 times

Re: ESP32 SD-Card can no longer be initialised

Post by stefan.erni »

Hi Ben

On the SPI Bus is a display and a File sd/sdhc.
The File sd/sdhc is just working
if i set set all the SPI Speed to 5Mhz
from the display
and File sd/sdhc InitialPrescalar
and File sd/sdhc Highg Speed Prescaler.

This makes the speed of the device too slow.
In FC9 there, was not a problem to run the Display and SD-Card with more than 20Mhz.
Is there a way to fix this in FC10?

regards
Stefan

Post Reply