Page 3 of 3

Re: ESP32 4Bit SD-Mode Init problem

Posted: Tue Jun 10, 2025 2:07 pm
by stefan.erni
Hi Ben

Here a program to test the SD-Card:
Press a key to start (GPIO19 on my board)
The program write 10'000 line in a .csv file
Its write a string of 128Byte for each line (21 times a fix number 10000,)
If writing is finish it's write the time in line 10'001 in mSec and it send the time to USB
2025-06-10_12-05-58.PNG
2025-06-10_12-05-58.PNG (5 KiB) Viewed 50 times
Test_post_sd_0525.fcfx
(33.22 KiB) Downloaded 4 times
I tested with different setting for the card
the setting from the clock to 1Mhz, 20Mhz, 80Mhz is no difference
the setting 1Bit or 4Bit mode=> 1Bit=2935mSec 4Bit=2551mSec :)

My wish is that the writing of 128Byte always takes the same time or that there is not such a big difference to write the string

test shows the time to write for 128Byte, you van see every 4te string is much longer ( with a 1mSec delay on)
here the 4te string
2025-06-10_11-28-39.PNG
2025-06-10_11-28-39.PNG (126.49 KiB) Viewed 50 times
and sometimes it's much longer...
2025-06-10_11-29-44.PNG
2025-06-10_11-29-44.PNG (196.96 KiB) Viewed 50 times

Re: ESP32 4Bit SD-Mode Init problem

Posted: Thu Jun 12, 2025 10:07 pm
by mnfisher
Hi Stefan,

Could you try 'buffering' the output and writing in larger blocks - probably a multiple of a sector size would be best.
Try 1 sector 10x and 100x for example and see how the times look - there should be less 'overhead' for a larger buffer size, but whether it will translate to a meaningful speed increase is another matter?

Martin

Re: ESP32 4Bit SD-Mode Init problem

Posted: Fri Jun 13, 2025 11:40 am
by stefan.erni
Hi Martin, Hi Ben

Yes I have a second program to write two buffer (array) of 12000 integer to wave file. Its working
The problem is in the csv Version to write csv file.
It's very easy to sample and save if I reduce the samplerate.
but if this different time would be less, the csv version would just work without buffer and second task/core

compare:
csv version
2025-06-13_11-59-06.PNG
2025-06-13_11-59-06.PNG (159.61 KiB) Viewed 8 times

wave version
2025-06-13_12-19-01.PNG
2025-06-13_12-19-01.PNG (462.28 KiB) Viewed 8 times