# Timer: output compare event missed, counter value 0x1234 exceeds compare value

- **ID:** `embedded/timer-output-compare-missed-event`
- **Domain:** embedded
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 82%

## Root Cause

Output compare event missed because interrupt latency or software delay prevented timely update of compare register.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| STM32Cube_FW_L4 V1.18.0 | active | — | — |
| FreeRTOS V10.5.0 | active | — | — |

## Workarounds

1. **Use one-pulse mode (OPM) to automatically stop timer after compare match, avoiding re-arm issues: `TIMx->CR1 |= TIM_CR1_OPM;`** (90% success)
   ```
   Use one-pulse mode (OPM) to automatically stop timer after compare match, avoiding re-arm issues: `TIMx->CR1 |= TIM_CR1_OPM;`
   ```
2. **Shorten interrupt service routine by moving heavy processing to task context, e.g., use semaphore to signal task.** (85% success)
   ```
   Shorten interrupt service routine by moving heavy processing to task context, e.g., use semaphore to signal task.
   ```
3. **Preload compare register with shadow register enabled: `TIMx->CR2 |= TIM_CR2_CCDS;` to update at next update event.** (80% success)
   ```
   Preload compare register with shadow register enabled: `TIMx->CR2 |= TIM_CR2_CCDS;` to update at next update event.
   ```

## Dead Ends

- **** — Increasing timer prescaler reduces resolution but does not fix missed event due to long ISR. (70% fail)
- **** — Adding more priority levels to NVIC does not address software delay in ISR. (60% fail)
