2013-08-29 06:17 PM
hi guys i'm new to stm32, i got a problem that i used sdio and fatfs to test maximum speed of write sd card, its only around 330kb/s but when i try to use sd card reader its up to 2mb/s, so i want to figure out why its so different between them and how can i fix it?
(i tried two ways of test: first use f_write function write 10k data once, second separate 10k data into 64byte package to send, result looks similar )i use dma mode 4bits bus #sdio-fatfs2013-08-29 08:40 PM
Yes that would appear quite slow, but I know nothing about your board, clocks, software or cards.
2013-08-29 11:06 PM
2013-08-30 02:17 AM
What board? Is the card a MicroSD? What class?
Not much experience here with the STM32F103VE and SDIO. Looks to be running the card at 24 MHz, confirm. You could perhaps run it at 36 MHz, or 48 MHz if you run the processor at 48 MHz and use BYPASS mode. Code won't support cards >4GB Some bugs in USART output code2013-08-31 01:44 PM
Hello,
According to my experience, SD-card write speed is very depends of how the card was formatted. On order of increasing the write (and read) speed: - PC format disk under Windows - using FatFs command mkfs - PC format using ''sdformatter program The difference could be 10 tiimes or more! https://www.sdcard.org/downloads/formatter_4/ Also the writing speed depends of a chunk size you are writing - 4K-64K make the higher speed then 256-2048 bytes chunk(but if you are not use OS - higher chunk blocks your program for a longer time!) ___ Alex.2013-08-31 05:31 PM
Preformatted cards should be fine as delivered.
You would want to run CHKDSK on cards after being written on an embedded system to confirm nothing is going wrong, the 4GB (3.9 real) shouldn't have the 32-bit limit inherent in the ST code. On the F1 the SPI interface to the cards is very slow. I haven't built an F1 SDIO implementation, but on the F2/F4 I'd expect a Class 4 card to write at a few MBps, with some Ultra ones probably 7-8 MBps The speed is also very dependent on the SDIO clock, pretty sure the MicroSD are rated at 50 MHz, and significantly faster than the full size cards. Ideally you want sector or cluster sized interactions, at similarly aligned addresses. I'd expect 8KB to be a better multiple than 10KB which will more often than not fall awkwardly on the media.2013-09-01 12:21 AM
>Preformatted cards should be fine as delivered.
Should, but... At the same device (STM32F407 based) I have seen increasing the writing speed 5-10 times (depend of a block size) after formating using SDFORMATTER. HW/SW were not changed.2013-09-01 06:51 AM
Any particular brand that's not using the equivalent to SDFormatter to initialize cards?
Any before/after observation about FAT and cluster size variations?I've run into the odd camera that wants to reformat things.2013-09-01 10:28 AM
Hi Clive,
I don't know what the software used by brands. The card I have tested were Sandisk, Kingstone and PKI. I don't remember what the speed was before, but after SDFORMATTER I got these results: block_size write/read (MBytes/S) 512 0.26/1.53 1K 0.56/2.7 4K 2.1/6.6 16K 5.5/9.7 all with 4 bit @24MHz and Kingstone Class4 SDHC card. What is ineresting - that FatFs' command (mkfs) make better result then Windows' format, but worth then SDFormatter.2013-09-01 08:22 PM
yeah, its MicroSD sdhc, er i try to set SDIO_InitStructure.SDIO_ClockBypass enable but the whole program looks going wrong, it stack at SD_WaitReadOperation.
and i run chkdsk there is no error.finally, the 32-bit limit inherent in the ST code. I'm not sure whats this.
thinks your help