2024-12-04 1:32 PM
Hello everyone,
I am using a custom board with STM32H750 and I am trying to develop a file system with FILEX.
The file system' s media is a uSD card with 10 MB/s baudrate which is communicating with the micro thanks to the SDMMC peripheral.
The SDMMC peripheral's configuration is copied from one of the many examples that are available in STMCubeMX ( it has a 50 Mhz clock, 4 bit mode, no power mode save and no transceiver).
The uSDcard has been formatted through the api given by FILEX (fx_media_format) following the information available during uSD card initialization ( for example sector size is 512 bytes, number of sectors and so on...).
I am using the drivers given by ST for FILEX (in my case SD with IDMA) and I am trying different media size buffer (512, 1024 and 4096) which I allocate in AXI SRAM ( SDMMC1 IDMA can access only in AXI SRAM).
I am experiencing two different behaviour: If I am doing a reading operation the SDMMC is very fast while writing operation is very slow( for transfer 512 bytes it could takes 4 ms).
What I have I seen until now is that FILEX seems tell every time SD card's driver to write only into 1 block and It never tries a multi blocks write ( so I don't understand if there are advantages from using a media buffer with size greater than 512 bytes) . I have also cache maintenace enable and all of my working buffers are 32 bytes aligned in order to avoid issues.
Since I would like to developing a recording audio application, so I cannot allow that writing operations take too much time for transfering data into uSD card, is there anything I can do? Maybe some define in fx_user.h file or I have to change my writing/reading HAL driver functions.( I am using HAL_SD_WriteBlocks_DMA/ HAL_SD_ReadBlocks_DMA).
Could erasing uSD card sectors before writing into them speed up the procedure?
Please if anyone has an advice I would be very grateful.
2025-07-21 12:36 AM
Hi @FCola.1 , Did you find any solution for that poor writing performance? I'm experiencing the same issue.
2025-07-27 1:28 PM
Hi JaserTTY, there are two things you could do:
1) Increase the buffer size. The larger the buffer size, the faster the writing speed. Remember to use multiples of 512 bytes for buffer's size.
2) Buy a SD card with the best performance ( I have done some test with different types of uSD card and the writing speed could change).
I hope those informations could help you, best regards
2025-07-27 5:22 PM
>>Could erasing uSD card sectors before writing into them speed up the procedure?
Generally NO, the cards manage the writing from a pre-erased list, as the blocks on the NAND are of the order of 128KB or larger. It can help on some brands of eMMC, at least telling the chip how large the write is, so it doesn't waste pre-erases resources.
The biggest efficiency is writing large, aligned groups, of 512-byte sectors, up to about 32 KB. Unaligned writes (file pointer sense) will require a lot of read-and-write combinations to splice the data and existing data in the blocks.
Doing a lot of small and unaligned writes will be very slow.