cancel
Showing results for 
Search instead for 
Did you mean: 

I can not configure ''CubeMX SDIO DMA FatFS configuration''

Alexandr Rychev
Associate
Posted on September 21, 2017 at 09:26

Hello!

I use the microcontroller STM32F205ret6, STMCubeMX v4.22.0, Firmware vSTM32Cube_FW_F2_v1.6.0. Configured to work with SD card in SDIO + FatFs mode without DMA. Recording to the card comes at a speed of 2.5 MB / s- it suits me perfectly. I write blocks of 25600 bytes, 1 block records 15 mSec. I need to save the processor from the work of transferring data to the SD card.

   For this example:

https://community.st.com/servlet/JiveServlet/download/1546-1-8967/SDIO+DMA+FatFS+CubeMX.pdf

 & 

https://community.st.com/s/contentdocument/0690X0000060Hm6QAE

   When unpacking an archive, you can not read its contents.

tuned SDIO + DMA. Here are my settings:

   hdma_sdio.Instance = DMA2_Stream6;

   hdma_sdio.Init.Channel = DMA_CHANNEL_4;

   hdma_sdio.Init.Direction = DMA_MEMORY_TO_PERIPH;

   hdma_sdio.Init.PeriphInc = DMA_PINC_DISABLE;

   hdma_sdio.Init.MemInc = DMA_MINC_ENABLE;

   hdma_sdio.Init.PeriphDataAlignment = DMA_PDATAALIGN_WORD;

   hdma_sdio.Init.MemDataAlignment = DMA_MDATAALIGN_WORD;

   hdma_sdio.Init.Mode = DMA_PFCTRL;

   hdma_sdio.Init.Priority = DMA_PRIORITY_LOW;

   hdma_sdio.Init.FIFOMode = DMA_FIFOMODE_ENABLE;

   hdma_sdio.Init.FIFOThreshold = DMA_FIFO_THRESHOLD_FULL;

   hdma_sdio.Init.MemBurst = DMA_MBURST_INC4;

   hdma_sdio.Init.PeriphBurst = DMA_PBURST_INC4;

main.c:      

   &sharppragma pack(4)

   FATFS SDFatFs;

   &sharppragma pack(4)

   FIL MyFile;

   &sharppragma pack(4)

   uint8_t capture_buf[25600];

Interrupts fulfills:

   void SDIO_IRQHandler(void)

       {

         HAL_SD_IRQHandler(&hsd);

      }

   void DMA2_Stream3_IRQHandler(void)

      {

         HAL_DMA_IRQHandler(&hdma_sdio);

      }

After exiting from HAL_SD_ReadBlocks_DMA. 

 Goes in cycles in anticipation: while ((HAL_SD_STATE_BUSY == state_return) && (SD_WAIT_TIMEOUT > timeout))

After the timeout, it goes out with an error.

Where is my mistake? Or is it not me?

null
1 REPLY 1

Review working examples and port F2=F4 for purposes of SDIO+DMA implementation

STM32Cube_FW_F4_V1.21.0\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio_dma_template.c

STM32Cube_FW_F4_V1.21.0\Drivers\BSP\STM324xG_EVAL\stm324xg_eval_sd.c

A custom demo can be built to order.

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