{
  "id": "embedded/spi-dma-misaligned-buffer",
  "signature": "SPI DMA: misaligned buffer address 0x2000FF01, data transfer aborted",
  "signature_zh": "SPI DMA：缓冲区地址0x2000FF01未对齐，数据传输中止",
  "regex": "SPI DMA.*misaligned buffer address.*0x[0-9A-Fa-f]+.*data transfer aborted",
  "domain": "embedded",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "DMA buffer address is not aligned to the DMA controller's required boundary (typically 4 or 16 bytes), causing a transfer error or bus fault.",
  "root_cause_type": "generic",
  "root_cause_zh": "DMA缓冲区地址未对齐到DMA控制器要求的边界（通常为4或16字节），导致传输错误或总线故障。",
  "versions": [
    {
      "version": "STM32H743",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ARM Cortex-M7 r1p1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "HAL_DMA v2.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use memcpy to copy data to a temporary buffer before DMA transfer",
      "why_fails": "Adds latency and memory overhead; if the temporary buffer is also not aligned due to compiler padding, the error persists.",
      "fail_rate": 0.5,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable DMA and use polling SPI instead",
      "why_fails": "Reduces throughput significantly and may cause CPU starvation in high-speed applications.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Change DMA FIFO threshold to bypass alignment check",
      "why_fails": "FIFO threshold does not affect address alignment requirements; misalignment still causes AHB bus error.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Allocate DMA buffers using aligned memory macros. For GCC, use __attribute__((aligned(16))). For CMSIS, use DMA_BUFFER_ALIGNED.",
      "success_rate": 0.95,
      "how": "Allocate DMA buffers using aligned memory macros. For GCC, use __attribute__((aligned(16))). For CMSIS, use DMA_BUFFER_ALIGNED.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use dynamic memory allocation from a dedicated aligned heap, e.g., pvPortMallocAligned from FreeRTOS or memalign.",
      "success_rate": 0.9,
      "how": "Use dynamic memory allocation from a dedicated aligned heap, e.g., pvPortMallocAligned from FreeRTOS or memalign.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Allocate DMA buffers using aligned memory macros. For GCC, use __attribute__((aligned(16))). For CMSIS, use DMA_BUFFER_ALIGNED.",
    "Use dynamic memory allocation from a dedicated aligned heap, e.g., pvPortMallocAligned from FreeRTOS or memalign."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/reference_manual/rm0390-stm32h745x5-and-stm32h755x5-armbased-32bit-mcus-stmicroelectronics.pdf",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}