cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4 DMA read write multiple blocks problem

Yaroslav Kirillov
Associate II

Posted on August 03, 2017 at 12:36

I have a problem with DMA mode reading multiple blocks.

To simplify a problem i took an example from the

STM32Cube_FW_

L4_V1.8.0\Projects\STM32L476G_

EVAL\Applications\FatFs\FatFs_

uSD\ archive.

BSP_SD_ReadBlocks_DMA

is used.

Read blocks not worked good, it started to work after i separated rx and tx and added Init and Deinitto DMA each time that i use that channel.

The problem is witha write now. I can write only blocks that are less then 1k. from 1k to 4096 sometimes it can write and sometimes

f_writereturn 0x

It always fails to write blocks bigger then 4096, bsp_write_blocks always fails with MSD_ERROR .

The problem only in DMA mode, polling mode works great.

Note: this post was migrated and contained many threaded conversations, some content may be missing.

12 REPLIES 12
Posted on March 27, 2018 at 08:32

Could you please elaborate Clive ?

Posted on March 27, 2018 at 15:07

Think of this as an interview question, you need to learn to sight-read code

#include <stdio.h>

#include <windows.h>

int main(int argc, char **argv)

{

int i = 0;

volatile int txDone = 1;

while(txDone == 0 ){ i++; }

printf('Loop iterates %d time(s)\n', i);

return(1);

}

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Nikolay Brinken
Associate III
Posted on March 29, 2018 at 11:22

After invoked 

__SDMMC_DMA_DISABLE(SDMMC1);

I test is SD busy

while(!LL_GPIO_IsInputPinSet(GPIOC, LL_GPIO_PIN_8)){};

where port C pin 8 - SD data 0 pin