{
  "id": "embedded/dma-configuration-busy-flag",
  "signature": "DMA: stream already enabled, cannot reconfigure while busy",
  "signature_zh": "DMA：流已使能，无法在忙时重新配置",
  "regex": "DMA: stream already enabled",
  "domain": "embedded",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "A DMA stream or channel is being reconfigured (e.g., changing source/destination address or transfer size) while the DMA peripheral is still active (EN bit set), causing a write to read-only registers or a bus error.",
  "root_cause_type": "generic",
  "root_cause_zh": "在DMA外设仍处于活动状态（EN位已置位）时重新配置DMA流或通道（如更改源/目标地址或传输大小），导致对只读寄存器的写入或总线错误。",
  "versions": [],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Calling HAL_DMA_Abort() and then immediately reconfiguring without waiting for the abort completion flag results in the same busy state.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Resetting the DMA peripheral via RCC reset does clear the busy flag but also loses all configuration, requiring full re-initialization.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Disable the DMA stream before reconfiguration. Example: hdma->Instance->CCR &= ~DMA_CCR_EN; while (hdma->Instance->CCR & DMA_CCR_EN); // Wait for disable confirmation",
      "success_rate": 0.9,
      "how": "Disable the DMA stream before reconfiguration. Example: hdma->Instance->CCR &= ~DMA_CCR_EN; while (hdma->Instance->CCR & DMA_CCR_EN); // Wait for disable confirmation",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a state machine to ensure DMA is only reconfigured after transfer completion interrupt. Check the Transfer Complete flag before calling HAL_DMA_Start_IT again.",
      "success_rate": 0.85,
      "how": "Use a state machine to ensure DMA is only reconfigured after transfer completion interrupt. Check the Transfer Complete flag before calling HAL_DMA_Start_IT again.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Disable the DMA stream before reconfiguration. Example: hdma->Instance->CCR &= ~DMA_CCR_EN; while (hdma->Instance->CCR & DMA_CCR_EN); // Wait for disable confirmation",
    "Use a state machine to ensure DMA is only reconfigured after transfer completion interrupt. Check the Transfer Complete flag before calling HAL_DMA_Start_IT again."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/reference_manual/dm00031020-stm32f405xx-stm32f407xx-stm32f415xx-stm32f417xx-reference-manual.pdf",
  "official_doc_section": null,
  "error_code": "HAL_DMA_ERROR_BUSY",
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.88,
  "resolvable": "true",
  "first_seen": "2023-09-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}