What is the maximum speed to write to an SD card with SDIO in 4Bit mode and how to reach it
- August 25, 2017
- 5 replies
- 5151 views
Hi all,
I am trying to get a hight speed write to SD via SDIO as well. I use a project generated with Cube MX, 4bit SDIO and DMA. But I only get a write speed of about 300 kBytes/s. I write 1000 times a 100 byte block, because I need a write about every 100 us. With a 100 byte block I have a write time of about 25 us, but every fifth time over 1 ms. Weird...The time span to the 1 ms write decreases the less bytes I write.
When I look at the trace of TrueStudio, I see that more than 60% of the time is spend in the function SDMMC_GetCmdResp1, compared to only 0.05% in BSP_SD_WriteBlocks_DMA... (Screenshot attached)
I am running it on a STM32f429IGT at 180MHz with 8MHz external crystal. My clocksettings for the main clocks are 8MHz HSE, M=8, N=360, P=2, AHB Pre=1, APB1 Pre =4 and APB2=2 -> 90 MHz -> its this to high?.
Clocksetting for SDIO is 0, as CubeMX advises.
What would the max speed be for a write to SD card via SDIO?
I use a 16Gig SD card with SpeedClass 10 from SanDisk.
I have played around with some settings of FatFs, e.g. set the _MIN_SS and _MAX_SS to 4096, then I have a write speed of about 2MBit/s, but the card is not readable in Windows anymore.
I have tried another example from the CubeLib V1.16/Projects/STM324xx9I_EVAL/Applications/FatFs/FatFs_uSD, copied the write loop from the previous project and had a write speed of about 1 MByte/s - yesterday. Today I tried to compile it with optimize level 2 and now I have the same write speed like in the previous project, of about 300kByte/s. This is weird.
Has anyone an example?
Thanks a lot,
best regards
Andreas
