{
  "id": "embedded/timer-output-compare-missed-event",
  "signature": "Timer: output compare event missed, counter value 0x1234 exceeds compare value",
  "signature_zh": "定时器：输出比较事件丢失，计数器值 0x1234 超过比较值",
  "regex": "Timer: output compare event missed, counter value 0x[0-9A-F]+ exceeds compare value",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Output compare event missed because interrupt latency or software delay prevented timely update of compare register.",
  "root_cause_type": "generic",
  "root_cause_zh": "输出比较事件因中断延迟或软件延迟导致比较寄存器未及时更新而丢失。",
  "versions": [
    {
      "version": "STM32Cube_FW_L4 V1.18.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "FreeRTOS V10.5.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing timer prescaler reduces resolution but does not fix missed event due to long ISR.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Adding more priority levels to NVIC does not address software delay in ISR.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use one-pulse mode (OPM) to automatically stop timer after compare match, avoiding re-arm issues: `TIMx->CR1 |= TIM_CR1_OPM;`",
      "success_rate": 0.9,
      "how": "Use one-pulse mode (OPM) to automatically stop timer after compare match, avoiding re-arm issues: `TIMx->CR1 |= TIM_CR1_OPM;`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Shorten interrupt service routine by moving heavy processing to task context, e.g., use semaphore to signal task.",
      "success_rate": 0.85,
      "how": "Shorten interrupt service routine by moving heavy processing to task context, e.g., use semaphore to signal task.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Preload compare register with shadow register enabled: `TIMx->CR2 |= TIM_CR2_CCDS;` to update at next update event.",
      "success_rate": 0.8,
      "how": "Preload compare register with shadow register enabled: `TIMx->CR2 |= TIM_CR2_CCDS;` to update at next update event.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "使用单脉冲模式（OPM）在比较匹配后自动停止定时器，避免重新使能问题：`TIMx->CR1 |= TIM_CR1_OPM;`",
    "缩短中断服务程序，将重处理移至任务上下文，例如使用信号量通知任务。",
    "使能影子寄存器预加载比较值：`TIMx->CR2 |= TIM_CR2_CCDS;` 在下一次更新事件时更新。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/reference_manual/dm00083598.pdf",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.82,
  "resolvable": "true",
  "first_seen": "2024-06-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}