# NVM：坏块管理器在芯片0上初始化失败

- **ID:** `embedded/nvm-bad-block-manager-failure`
- **领域:** embedded
- **类别:** runtime_error
- **错误码:** `NVM_ERR_BBT_INIT`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

NAND闪存坏块表损坏或保留块区域磨损，导致坏块表无法加载。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| NAND flash driver v2.1.0 | active | — | — |
| FreeRTOS+IO v1.3.0 | active | — | — |
| STM32CubeFW_F4 v1.27.0 | active | — | — |

## 解决方案

1. ```
   Force BBT rebuild by erasing the reserved block area and reinitializing: `nand_erase(dev, reserved_block_start, reserved_block_count); nand_bbt_init(dev);`
   ```
2. ```
   Use a fallback BBT stored in a separate NOR flash or EEPROM, then copy it to NAND: `memcpy(nand_bbt, fallback_bbt, bbt_size); nand_bbt_apply(dev);`
   ```

## 无效尝试

- **** — Mass erase removes all data including the BBT, but does not recreate the BBT structure; the manager will still fail because the reserved area is not reinitialized. (70% 失败率)
- **** — The configuration change only affects future BBT creation; the existing corrupted BBT is still loaded and fails. (80% 失败率)
