cancel
Showing results for 
Search instead for 
Did you mean: 

Few questions about using IDMA of SDMMC (SD card) and FATFS of STM32H7 series...

HTajb.1
Associate III

Dear Sir/Madam,

I am going to use the internal DMA of SDMMC host interface(with FATFS) of one of the micro of STM32 H7 family, for SD cards .

Here are my questions:

1-Suppose we want to read "large binary byte" values from SD card into internal SRAM of micro by a function like this:

f_read(&fsrc, buffer, sizeof buffer, &br)

How fast does this function work and behave to transfer data ,exactly?

For example,if our IDMA settings, are capable of transferring 8 MBytes/s ,does this function work at this speed or NOT?(Or,We may expect some latency due to working of this function and the actual rate of data transfer will be less than 8 MBytes/s practically ???)

2- We have to assign an array(buffer) in the internal SRAM for storing data, read from SD card by the f_read(&fsrc, buffer, sizeof buffer, &br) . Can this buffer be a

multi-dimensional array or not?

I really appreciate your attention.

2 REPLIES 2

>>Can this buffer be a multi-dimensional array or not?

At the end of the day these are just a collection of bytes in memory, the file system neither knows nor cares what it represents or how it is represented to the user application.

The behaviour of f_read depends on the size, and how the data aligns on the clusters/sector on the media. The read speed will also depend on if secondary file system structures that need to be read, and how many different groups of blocks need to be read to fulfill the request.

To get optimal speed you need to read large aligned blocks, aligned with the media sectors/clusters.

Reading uniform blocks of 32KB will likely hit near-optimal numbers. Reading 8 or 16KB blocks would be fairly efficient.

Reading oddly sized or aligned blocks with be inefficient, reading lots of small groups of data will be extremely inefficient.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
HTajb.1
Associate III

Thank you @Community member​  for your reply.

So,if the total capacity of our file, would be a multiple of 8 KB,16 KB or 32 KB,that would be a great privilege and enhancement to reach to the optimal speed.

Am I right?

I really appreciate your attention.