{
  "id": "embedded/uart-overrun-error-sr-ore",
  "signature": "UART: overrun error (ORE flag set) on USART2",
  "signature_zh": "UART：USART2 上溢出错误（ORE 标志已设置）",
  "regex": "UART: overrun error \\(ORE flag set\\) on USART\\d+",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "UART receive data register was not read before the next byte arrived, causing data loss due to overrun.",
  "root_cause_type": "generic",
  "root_cause_zh": "UART 接收数据寄存器未能在下一个字节到达前被读取，导致数据因溢出而丢失。",
  "versions": [
    {
      "version": "STM32Cube FW_F4 V1.27.1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "STM32Cube FW_H7 V1.11.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Keil MDK-ARM 5.38",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increase UART baud rate to match incoming data speed",
      "why_fails": "Overrun occurs because the CPU cannot read data fast enough; higher baud rate makes the problem worse, not better.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disable UART interrupt and poll in main loop",
      "why_fails": "Polling without interrupt may miss data entirely or still overrun if main loop is slow.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Enable DMA for UART reception: HAL_UART_Receive_DMA(&huart2, rx_buffer, BUFFER_SIZE); This offloads data transfer from CPU.",
      "success_rate": 0.85,
      "how": "Enable DMA for UART reception: HAL_UART_Receive_DMA(&huart2, rx_buffer, BUFFER_SIZE); This offloads data transfer from CPU.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Implement double-buffering with interrupt: use HAL_UARTEx_ReceiveToIdle_DMA to capture data without overrun.",
      "success_rate": 0.8,
      "how": "Implement double-buffering with interrupt: use HAL_UARTEx_ReceiveToIdle_DMA to capture data without overrun.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Increase interrupt priority of UART handler to ensure preemptive reading.",
      "success_rate": 0.7,
      "how": "Increase interrupt priority of UART handler to ensure preemptive reading.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Enable DMA for UART reception: HAL_UART_Receive_DMA(&huart2, rx_buffer, BUFFER_SIZE); This offloads data transfer from CPU.",
    "Implement double-buffering with interrupt: use HAL_UARTEx_ReceiveToIdle_DMA to capture data without overrun.",
    "Increase interrupt priority of UART handler to ensure preemptive reading."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/reference_manual/dm00031020.pdf",
  "official_doc_section": null,
  "error_code": "USART_SR_ORE",
  "verification_tier": "ai_generated",
  "confidence": 0.88,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}