AnsweredAssumed Answered

I can not configure "CubeMX SDIO DMA FatFS configuration"

Question asked by Alexandr Rychev on Sep 21, 2017

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:

SDIO+DMA+FatFS+CubeMX.pdf & SDIO_DMA.7z.zip

   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:      

   #pragma pack(4)
   FATFS SDFatFs;
   #pragma pack(4)
   FIL MyFile;
   #pragma 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?

Outcomes