cancel
Showing results for 
Search instead for 
Did you mean: 

SDMMC does not work after power cycle

serhat1
Associate

Hi,

I am using STM32H747. I have successfully write&read micro sd card over SDMMC2 peripheral while debugging. But after debugging, when I power cycle or reset the board, I am not able to use sd card. I see FatFS open file failing. The board is arduino portenta H7, which has its own custom bootloader, so I flash my code on address 0x08040000 and it boots ok. I use CubeIDE. The only thing which does not work after reset is SDMMC strangely. Anyone has encountered this issue?

Best regards

1 ACCEPTED SOLUTION

Accepted Solutions
serhat1
Associate

I have finally found the solution. This board has custom bootloader and it seems it enables cache memory. After disabling it at the start of main function, BSP read and write functions with DMA works successfully. Or second alternative: leave cache enabled. After each BSP_SD_ReadBlocks_DMA function call SCB_InvalidateDCache_by_Addr. Similarly, before each BSP_SD_WriteBlocks_DMA function, call SCB_CleanDCache_by_Addr. 

View solution in original post

1 REPLY 1
serhat1
Associate

I have finally found the solution. This board has custom bootloader and it seems it enables cache memory. After disabling it at the start of main function, BSP read and write functions with DMA works successfully. Or second alternative: leave cache enabled. After each BSP_SD_ReadBlocks_DMA function call SCB_InvalidateDCache_by_Addr. Similarly, before each BSP_SD_WriteBlocks_DMA function, call SCB_CleanDCache_by_Addr.