{
  "id": "embedded/rtc-alarm-missed-due-to-battery-loss",
  "signature": "RTC: Alarm interrupt missed, VBAT low flag set",
  "signature_zh": "RTC：闹钟中断丢失，VBAT低电压标志已置位",
  "regex": "RTC: Alarm interrupt missed, VBAT low flag set",
  "domain": "embedded",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The backup battery (VBAT) voltage dropped below the threshold, causing the RTC registers to reset and the alarm to be missed.",
  "root_cause_type": "generic",
  "root_cause_zh": "备份电池电压降至阈值以下，导致RTC寄存器复位，闹钟丢失。",
  "versions": [
    {
      "version": "STM32L4 RTC driver v1.3.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "HAL RTC v1.2.5",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "If VBAT is low, the RTC registers will reset again after the next power loss, and the alarm will be missed repeatedly.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Disabling the flag only hides the symptom; the RTC data integrity is still compromised and alarms will fail silently.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Replace the backup battery and reinitialize the RTC with the correct time and alarm: `rtc_init(); rtc_set_time(&correct_time); rtc_set_alarm(&alarm_time);`",
      "success_rate": 0.95,
      "how": "Replace the backup battery and reinitialize the RTC with the correct time and alarm: `rtc_init(); rtc_set_time(&correct_time); rtc_set_alarm(&alarm_time);`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a VBAT monitoring routine to warn the user before the battery is critically low: `if (rtc_check_vbat_low()) { log_warning('VBAT low, replace battery'); }`",
      "success_rate": 0.8,
      "how": "Add a VBAT monitoring routine to warn the user before the battery is critically low: `if (rtc_check_vbat_low()) { log_warning('VBAT low, replace battery'); }`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Replace the backup battery and reinitialize the RTC with the correct time and alarm: `rtc_init(); rtc_set_time(&correct_time); rtc_set_alarm(&alarm_time);`",
    "Add a VBAT monitoring routine to warn the user before the battery is critically low: `if (rtc_check_vbat_low()) { log_warning('VBAT low, replace battery'); }`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://www.st.com/resource/en/application_note/an4759-rtc-usage-with-stm32l4-series-stmicroelectronics.pdf",
  "official_doc_section": null,
  "error_code": "RTC_ERR_ALARM_MISSED",
  "verification_tier": "ai_generated",
  "confidence": 0.82,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}