# SDIO：命令 17 上 CRC 错误，响应超时

- **ID:** `embedded/sdio-crc-error`
- **领域:** embedded
- **类别:** protocol_error
- **错误码:** `SDIO_STA_CCRCFAIL`
- **验证级别:** ai_generated
- **修复率:** 78%

## 根因

SD 卡与主机之间在命令或数据传输期间 CRC 不匹配，通常由于电气噪声、时钟时序问题或卡初始化失败。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| STM32Cube_FW_L4 v1.18.0 | active | — | — |
| SDIO v2.0 | active | — | — |
| GCC ARM Embedded 10.3.1 | active | — | — |

## 解决方案

1. ```
   降低 SDIO 时钟分频器以降低频率：设置 SDIO_CLKCR_CLKDIV 为 2（例如，48 MHz 时钟输出 12 MHz），并确保时钟极性符合 SD 卡规格。
   ```
2. ```
   在 SDIO 数据线上启用内部上拉，并在每条线上添加外部 10-100 pF 电容到地，以过滤噪声。
   ```
3. ```
   使用较慢时钟重新初始化 SD 卡并重试命令 17：使用 SDIO_INIT_CLK_DIV 为 0x76 的 HAL_SD_Init()，成功读取后切换到高速模式。
   ```

## 无效尝试

- **Increase SDIO clock frequency to improve throughput** — Higher clock frequency worsens timing margins and increases CRC errors. (90% 失败率)
- **Replace SD card with a different brand without changing settings** — Different cards have varying timing requirements; the issue may persist without proper clock adjustment. (70% 失败率)
- **Disable CRC checking in SDIO peripheral** — CRC is mandatory for reliable data transfer; disabling it can cause silent data corruption. (95% 失败率)
