cancel
Showing results for 
Search instead for 
Did you mean: 

SDCard DMA to RAM, No Performance Improvement

ZThat
Senior

Hello All,

I recent implemented a DMA transfer for SD card data to RAM (technically an external SDRAM) on the STM32F765VI. Previously we had been using an IT transfer. In other words, we are now using SDCard_WriteBlocks_DMA rather than SDCard_WriteBlocks_IT. The original motivation for this change being the fact that 480,000 byte size IT transfers to an from the SD card cause roughly 20 thousand ISRs, whereas the DMA method only causes 4 ISRs total (2 SDMMC dataend ISRs and 2 transfer complete DMA ISRs). I expected a large performance increase, but ended up actually getting a slight decrease in performance. Both methods take roughly 0.5 seconds. This is with the clock running at 200MHz. All of this is single threaded without a kernel. I am using a 4 word burst on both the peripheral and memory side of the DMA.

I wanted to ask the community if these speeds are typical, and if not, does anyone have any recommendations on how to speed up the transfer?

I could add a double buffer, but it seems as thought the speed of the SD card is the limiting factor here. I say that because, for larger transfers, I have to poll the SD card with SD status commands to prevent data corruption. Am I right in assuming this?

If there is no method for speeding up the transfer (aka the SD card read and write speed is the limiting factor), I am considering real time RLE on transmit and receive in order to reduce the size of the transfer. These large transfers are bitmap images. Does anyone have experience with fast encoding and decoding methods (fast being a significant reduction in a 480,000 byte image size in small fractions of a second)?

Do I just need a better SD card?

I appreciate any and all suggestions.

Thanks!

1 ACCEPTED SOLUTION

Accepted Solutions
ZThat
Senior

Thanks Clive,

Upon looking into this further, I've realized that I was off by a decimal place. I am transferring about half a MB every 0.05 seconds. This actually lines up with the fact that I'm using a class 10 SD card. This is the physical limit for the speed at which I can write to the SD card.

Thanks for the help!

View solution in original post

2 REPLIES 2

The interface is certainly capable of 10's of MBps.

Single block transfers have ​significant overhead, for streaming apps here I use a 32KB spill buffer so I can do block aligned writes.

Write performance of cards varies widely. Remember the internal erase block size inside the card is likely at least 128KB​

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

Thanks Clive,

Upon looking into this further, I've realized that I was off by a decimal place. I am transferring about half a MB every 0.05 seconds. This actually lines up with the fact that I'm using a class 10 SD card. This is the physical limit for the speed at which I can write to the SD card.

Thanks for the help!