cancel
Showing results for 
Search instead for 
Did you mean: 

Anyone have a working sdcard(FATFS) with DMA on the stm32f7?

con3
Senior

Hey!

I used HAL and I've tried to get the DMA going, although It doesn't seem to work and I'm not sure where the bug is at this point, I've realized that when I replace BSP_SD_WriteBlocks_DMA with the standard BSP_SD_WriteBlocks in sd_diskio.c the sdcard works fine, so I know the error has to be somewhere in the function but I can't track it down.

I've looked for templates or examples using FATFS and DMA for the stm32f7 but I couldn't find any so Just want to see if anyone has encountered this and has any solutions?

Thanks in advance!

1 ACCEPTED SOLUTION

Accepted Solutions

To the top level question, Yes, have it working, works fine. Don't have notes with me, but think I can get 20MBps reads.

STM32Cube_FW_F7_V1.12.0\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio_dma_template.c

STM32Cube_FW_F7_V1.12.0\Projects\STM32746G-Discovery\Applications\USB_Device\MSC_Standalone\Src

IRQ Handlers and DMA must be correctly configured.

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

View solution in original post

5 REPLIES 5

To the top level question, Yes, have it working, works fine. Don't have notes with me, but think I can get 20MBps reads.

STM32Cube_FW_F7_V1.12.0\Middlewares\Third_Party\FatFs\src\drivers\sd_diskio_dma_template.c

STM32Cube_FW_F7_V1.12.0\Projects\STM32746G-Discovery\Applications\USB_Device\MSC_Standalone\Src

IRQ Handlers and DMA must be correctly configured.

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

Hi @Community member​ ,

Thank you, as always, for the detailed reply!

I completely missed that and went directly to the processor based examples.

Could you possibly expand on this: "IRQ Handlers and DMA must be correctly configured.

Is there anything to watch out for ?

Thank you!

That the BSP macro's expand to the correct names in the vector table, and are consistent with the BSP MSP code initializing the pins/interface.

extern SD_HandleTypeDef uSdHandle;
 
/**
  * @brief  This function handles SDMMC1 global interrupt request.
  * @param  None
  * @retval None
  */
void BSP_SDMMC_IRQHandler(void)
{
  HAL_SD_IRQHandler(&uSdHandle);
}
 
/**
* @brief  This function handles DMA2 Stream 6 interrupt request.
* @param  None
* @retval None
*/
void BSP_SDMMC_DMA_Tx_IRQHandler(void)
{
  HAL_DMA_IRQHandler(uSdHandle.hdmatx);
}
 
/**
* @brief  This function handles DMA2 Stream 3 interrupt request.
* @param  None
* @retval None
*/
void BSP_SDMMC_DMA_Rx_IRQHandler(void)
{
  HAL_DMA_IRQHandler(uSdHandle.hdmarx);
}

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

Thank you @Community member​!

I'll implement this and might have a few follow up questions.

Thank you for all the help

con3
Senior

Hi @Community member​ ,

I forgot I asked you about the DMA on the sdcard interface, it seems like I'm having issues and can't get the implementation correct. Did you experience any issues with write failures ?

I made a forum post : https://community.st.com/s/question/0D50X00009sTkwTSAS/cube-generated-sd-card-with-dma-broken-transfer-complete-for-write

I've gotten it to do single block writes, but multi-block writes completely fail