apache / apache/nuttx

[BUG] SD card issue: Assertion failure in stm32_sdmmc.c on STM32 due to timeout

Open
#16,551 6 comments 0 reactions 0 assignees View on GitHub
Arch: arm Area: Specific Peripheral OS: Other Type: Bug
Dominant language
C
Stars
4k
Forks
1.7k
Avg merge
1d 17h
Merged PRs (30d)
237

Description

### Description / Steps to reproduce the issue

The easiest way to bring the SD card to get into a timeout is by doing:
1. You might want to try with a non-industrial grade sd card (higher chances of a timeout happening, I would suppose)
2. modify the value of `SDMMC_DTIMER_DATATIMEOUT_MS` from nuttx/arch/arm/src/stm32h7/stm32_sdmmc.c to have the value 10, instead of the default 250 (ms)
3. Make sure that assertions are enabled
4. You might want to enable error logs for filesystem and/or memory card
5. I have SDIO and DMA enabled for the sd card
6. Build NuttX -- arm 32 bit, stm32h7.
7. Issue sd_stress or sd_bench, or some other I/O intensive operation on the sd card, for 10 minutes (Usually 2 minutes should suffice)

What happens:
You get an assertion failure in stm32_sdmmc.c line 1108 (function stm32_dataconfig) because the STM32 sdmmc IDMA CTRLR register is enabled

### On which OS does this issue occur?

[OS: Other]

### What is the version of your OS?

NuttX 10.3 on STM32 board

### NuttX Version

10.3+

### Issue Architecture

[Arch: arm]

### Issue Area

[Area: Specific Peripheral]

### Host information

Host is STM32H7, with armv7-m. It's NuttX 10.3 with some fixes cherry-picked from later versions. Looking through the git history of NuttX 12, I didn't see changes in this area to suggest that this issue is fixed in NuttX 12.

[sdcard_timeout_explanation.md](https://github.com/user-attachments/files/20800140/sdcard_timeout_explanation.md)

### Verification

- [x] I have verified before submitting the report.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.