Skip to main content
Associate II
January 9, 2024
Question

SDIO + DMA with micro SD card freezes at f_mount

  • January 9, 2024
  • 2 replies
  • 1500 views

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

2 replies

Visitor II
January 9, 2024

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
Super User
January 9, 2024
"If you feel a post has answered your question, please click ""Accept as Solution""."
Associate II
January 10, 2024

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