2020-07-23 11:17 AM
Hello everyone,
In CubeMX 5.3.0 I have configured FATFS+DMA+SDMMC for a card running STM32F777VI. i've been trying to save some data into a .txt file.
It works fine, but i can't write data to SD card as fast as I want. Requirement is to save 25 bytes every 3ms (which I receive from UART at 330Hz), but it seems doing so affects speed of other UART communications/ stops communication for a moment. What's the maximum write speed I can achieve without affecting other peripheral behavior?
I was playing with clock settings/SDMMC CLK divide factor to figure out if it's low clock setting issue. Attaching system clk config and SDMMC settings,can anyone see a potential problem in clock settings?
2020-07-23 11:32 AM
SDMMC gives no guarantees on execution speed. The first write typically takes much longer than 3ms, but even subsequent writes may take as long. Writing complete blocks (512 bytes) will be more efficient than writing 25 bytes at a time.
If you have hard timing requirements, you'll need to buffer the data you send to SDMMC and use DMA to transfer it. Using interrupts for UART communication is also an alternative.
2020-07-23 12:12 PM
Buffer data so you're writing large aligned blocks, calling f_write() with 25 bytes is going to murder performance
Would expect I could write blocks of 8 or 16KB, at 4-5 MBps all day, and not lose any data from the UART