cancel
Showing results for 
Search instead for 
Did you mean: 

SDIO + DMA with micro SD card freezes at f_mount

nicobari007
Associate II

Hi,

I have a Nucleo-L476RG development board that I am evaluating for my applications. I am trying to test SDIO + DMA interface with a 32 GB Class 4 HC micro SD card. I have followed the tutorial at https://www.youtube.com/watch?v=I9KDN1o6924 to setup the code. I have checked and verified that I have connected all the wire correctly between my Nucleo-L476RG board and the sd card adapter https://www.amazon.com/gp/product/B09K6XVS9R/ref=ppx_yo_dt_b_asin_title_o00_s00?ie=UTF8&psc=1. See the attached code with this issue. The code can detect the card because in line 24 of fatfs_platform.c my sd detect pin is read high. However, while mounting the sd card using f_mount(&SDFatFS, SDPath, 1) the code enters the while loop in line 3961 of stm32l4xx_hal_sd.c file and stays in the loop hence freezing my f_mountMy hsd->Instance->STA has a value of 0x200, what state does that value correspond to? Looking for some suggestions on how to proceed

3 REPLIES 3
liaifat85
Senior II

The fact that the code gets stuck in the while loop in the stm32l4xx_hal_sd.c file suggests that there might be an issue with the SDIO communication or initialization.

The value 0x200 in hsd->Instance->STA corresponds to the SDIO status indicating the SDIO static flags. In particular, it indicates that the SDIO hardware detected a start bit during the data transfer.

AScha.3
Chief II

SD not working = normal (at first). 🙂

read in forum about sd-card problems...

ie

https://community.st.com/t5/stm32cubemx-mcus/sdio-interface-not-working-in-4bits-with-stm32f4-firmware/m-p/625603#M26901

If you feel a post has answered your question, please click "Accept as Solution".

Yeah I found that solution and implemented that. Now the error is that HAL_SD_RxCpltCallback() is not getting triggered.