cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F4 SDIO high speed write to sd card

krestan
Associate II
Posted on April 07, 2016 at 14:15

I've a following problem. I'm using STM32F427VG connected to microSD card via SDIO interface. I'm using ST driver, configured for 4-bit data access and DMA tranfer. I need to reach continuous write speed above 3000kb/sec, but the write sometimes hangs and the transfer is interrupted for more than 200msec (sometimes even 500msec), which is a problem. I've a constant data stream and I can not allocate too large buffer in a memory, because I've only internal SRAM in STM32 available (I can only accept not more than 30-50msec delay). I'm using multiple block tranfer, each block in size of 16Kb. I've tried different sd cards, but still the result is the same. If I put the card to the computer, then the write speed is much higner than 3000kb/sec and I don't expect it's a timeout generated by the card, this is too long timeout I guess.

#stm32f4-sdio
13 REPLIES 13
Poonam Deoghare
Associate III
Posted on March 28, 2018 at 08:56

Hi team,

I used 1bit bus mode for DMA write for writing 1000 blocks in loop one at a time.

Time taken to complete this operation was 930 msec.

I changed bus mode to 4-bit mode for same operation and time observed was 900 msec.

I was expecting less time but its almost same. Do I need to do some other setting to make 4 bit bus mode work.

Steps I followed:-

selected 4 bit mode for sdio in cubemx and generated the code.

Posted on March 28, 2018 at 13:18

Not going to confirm timing, but single sector reads have significant overhead, basically worst case scenario. Read 1000 sectors not 1 sector 1000 times.

After the card connects at 400 KHz at 1-bit it usually negotiates up to 24-25 MHz at 4-bits

Not wading into issues with CubeMX code generation.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on March 28, 2018 at 15:41

Read 1000 sectors not 1 sector 1000 times.

>> I am incrementing read_addr by 512 bytes each time.

and loop goes on 1000 times so it means i am reading 1000 blocks.

Please let me know if I use 4bit bus mode then it should work like how it works for 1-bit mode but with more throughput.

Posted on March 28, 2018 at 16:16

Yes, I understand that, I'm saying using 1000 cars to delivery 1000 packages is less efficient that using 1 truck to deliver 1000 packages in a single trip. The media has several million addressable blocks.

The 4-bit vs 1-bit will give 4x performance in data transfer phase, however command/response phases dominate in single block access case. This is why you have a 'count' field.

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