# SysTick: interrupt not serviced within rollover period, time base corrupted

- **ID:** `embedded/arm-systick-rollover-missed`
- **Domain:** embedded
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

SysTick interrupt was masked or delayed by higher-priority ISR, causing the 24-bit counter to wrap without handler execution, corrupting RTOS tick count.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| FreeRTOS v10.6.0 | active | — | — |
| ARM Cortex-M4 r0p1 | active | — | — |
| STM32CubeH7 v1.11.0 | active | — | — |

## Workarounds

1. **Ensure SysTick interrupt priority is lower than time-critical ISRs but never masked for longer than 1 SysTick period. In FreeRTOS, set configMAX_SYSCALL_INTERRUPT_PRIORITY to include SysTick and check that no ISR runs for > 1 ms (assuming 1 kHz tick).** (80% success)
   ```
   Ensure SysTick interrupt priority is lower than time-critical ISRs but never masked for longer than 1 SysTick period. In FreeRTOS, set configMAX_SYSCALL_INTERRUPT_PRIORITY to include SysTick and check that no ISR runs for > 1 ms (assuming 1 kHz tick).
   ```
2. **Add a guard to detect missed tick and manually increment RTOS tick count. Implement a high-priority timer that checks if SysTick counter wrapped without ISR.** (75% success)
   ```
   Add a guard to detect missed tick and manually increment RTOS tick count. Implement a high-priority timer that checks if SysTick counter wrapped without ISR.
   ```
3. **Reduce interrupt latency by splitting long ISRs into deferred tasks (e.g., using FreeRTOS task notifications or semaphores).** (90% success)
   ```
   Reduce interrupt latency by splitting long ISRs into deferred tasks (e.g., using FreeRTOS task notifications or semaphores).
   ```

## Dead Ends

- **Increase SysTick interrupt priority to 0 (highest)** — Setting SysTick to highest priority may break critical timing in other interrupts and does not address the root cause of long ISR masking. (60% fail)
- **Disable all other interrupts to ensure SysTick runs** — Disabling interrupts globally defeats the purpose of RTOS and can cause watchdog resets or data loss. (70% fail)
- **Increase SysTick reload value to extend rollover period** — SysTick reload is fixed at 24 bits (max 16,777,215 cycles); increasing it is impossible without changing clock source. (90% fail)
