{
  "id": "embedded/arm-systick-timer-underflow",
  "signature": "Systick: timer underflow detected, system tick count corrupted",
  "signature_zh": "SysTick：定时器下溢检测到，系统滴答计数损坏",
  "regex": "Systick: timer underflow detected, system tick count corrupted",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "SysTick timer reload value set too low or clock divider misconfigured, causing counter to underflow before interrupt service routine can increment tick count.",
  "root_cause_type": "generic",
  "root_cause_zh": "SysTick定时器重载值设置过低或时钟分频器配置错误，导致计数器在中断服务程序递增滴答计数之前下溢。",
  "versions": [
    {
      "version": "CMSIS 5.9.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "FreeRTOS 10.4.6",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "ARM Cortex-M4 r1p1",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Increasing SysTick interrupt priority does not fix the underflow, as the issue is timer reload value, not priority masking.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Adding more delay loops in main loop does not prevent timer underflow; the problem is deterministic and timing-independent.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set SysTick reload value to (SystemCoreClock / 1000) - 1 for 1ms tick, and ensure CLKSOURCE bit selects processor clock. Example: SysTick_Config(SystemCoreClock / 1000);",
      "success_rate": 0.92,
      "how": "Set SysTick reload value to (SystemCoreClock / 1000) - 1 for 1ms tick, and ensure CLKSOURCE bit selects processor clock. Example: SysTick_Config(SystemCoreClock / 1000);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a guard in SysTick_Handler to check reload value: if (SysTick->LOAD == 0) { SysTick->LOAD = (SystemCoreClock / 1000) - 1; }",
      "success_rate": 0.85,
      "how": "Add a guard in SysTick_Handler to check reload value: if (SysTick->LOAD == 0) { SysTick->LOAD = (SystemCoreClock / 1000) - 1; }",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Set SysTick reload value to (SystemCoreClock / 1000) - 1 for 1ms tick, and ensure CLKSOURCE bit selects processor clock. Example: SysTick_Config(SystemCoreClock / 1000);",
    "Add a guard in SysTick_Handler to check reload value: if (SysTick->LOAD == 0) { SysTick->LOAD = (SystemCoreClock / 1000) - 1; }"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://developer.arm.com/documentation/dui0552/a/cortex-m3-peripherals/systick-timer",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-03-12",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}