cancel
Showing results for 
Search instead for 
Did you mean: 

CubeMX: STM32F103 with FatFS and SDIO in DMA Mode

florian239955_st
Associate II
Posted on October 30, 2015 at 16:21

Hi,

I try again to get my STM32F103 working with FatFS and SDIO in DMA mode. I also use FreeRtos.

I got my SD Card working in blocking mode. So if I change in the sd_diskio file the BSP_SD_ReadBlocks to BSP_SD_ReadBlocksDMA, I will end in a while loop in the function HAL_SD_CheckReadOperation.

Do I have to add some callback functions or to change more code in the generated files?

Does anybody got the generated code working with FatFS and SDIO in DMA mode?

It would be great, if anybody can give me a hint.

Best regards,

Flo

#stm32 #sdio #fatfs #dma
2 REPLIES 2
Posted on November 02, 2015 at 14:50

Hi Flow,

Maybe the HAL_SD_CheckReadOperation() function is pending in while loop as it is waiting the transfer complete of DMA. To remedy to this, you have to check that the HAL_DMA_IRQHandler() is called in the stm32f1xx_it.c and the interrupt line is enabled.

Hope this can help.

-Shahrzad-

florian239955_st
Associate II
Posted on November 03, 2015 at 09:46

Hi Shahrzad,

thank you for your answer.

I checked the interrupt handler. It is called, but not immediately. The interrupt handler is called after 3 timeouts of the HAL_SD_CheckReadOperation().

Before the third call of HAL_SD_CheckReadOperation() is the NVIC ISPR0 register content changed (from 0x00800808 to 0x0080C808).

After that, in hangs on in the while loop in the SD_DMA_RxCplt() function - forever.

Do you have any idea why the interrupt handler is called after the third check read operation?

Thanks in advance.

Regards,

Flow

From: shahrzad

Posted: Monday, November 02, 2015 2:50 PM

Subject: CubeMX: STM32F103 with FatFS and SDIO in DMA Mode

Hi Flow,

Maybe the HAL_SD_CheckReadOperation() function is pending in while loop as it is waiting the transfer complete of DMA. To remedy to this, you have to check that the HAL_DMA_IRQHandler() is called in the stm32f1xx_it.c and the interrupt line is enabled.

Hope this can help.

-Shahrzad-