{
  "id": "embedded/nvm-bad-block-manager-failure",
  "signature": "NVM: Bad block manager failed to initialize on chip 0",
  "signature_zh": "NVM：坏块管理器在芯片0上初始化失败",
  "regex": "NVM: Bad block manager failed to initialize on chip \\d+",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "NAND flash bad block table (BBT) is corrupted or the reserved block area is worn out, preventing the BBT from loading.",
  "root_cause_type": "generic",
  "root_cause_zh": "NAND闪存坏块表损坏或保留块区域磨损，导致坏块表无法加载。",
  "versions": [
    {
      "version": "NAND flash driver v2.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "FreeRTOS+IO v1.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "STM32CubeFW_F4 v1.27.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "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.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The configuration change only affects future BBT creation; the existing corrupted BBT is still loaded and fails.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Force BBT rebuild by erasing the reserved block area and reinitializing: `nand_erase(dev, reserved_block_start, reserved_block_count); nand_bbt_init(dev);`",
      "success_rate": 0.75,
      "how": "Force BBT rebuild by erasing the reserved block area and reinitializing: `nand_erase(dev, reserved_block_start, reserved_block_count); nand_bbt_init(dev);`",
      "condition": "",
      "sources": []
    },
    {
      "action": "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);`",
      "success_rate": 0.85,
      "how": "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);`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Force BBT rebuild by erasing the reserved block area and reinitializing: `nand_erase(dev, reserved_block_start, reserved_block_count); nand_bbt_init(dev);`",
    "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);`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/application_note/an3320-nand-flash-management-on-stm32-microcontrollers-stmicroelectronics.pdf",
  "official_doc_section": null,
  "error_code": "NVM_ERR_BBT_INIT",
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2023-08-15",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}