# RTC：闹钟中断丢失，VBAT低电压标志已置位

- **ID:** `embedded/rtc-alarm-missed-due-to-battery-loss`
- **领域:** embedded
- **类别:** runtime_error
- **错误码:** `RTC_ERR_ALARM_MISSED`
- **验证级别:** ai_generated
- **修复率:** 90%

## 根因

备份电池电压降至阈值以下，导致RTC寄存器复位，闹钟丢失。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| STM32L4 RTC driver v1.3.0 | active | — | — |
| HAL RTC v1.2.5 | active | — | — |

## 解决方案

1. ```
   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);`
   ```
2. ```
   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'); }`
   ```

## 无效尝试

- **** — If VBAT is low, the RTC registers will reset again after the next power loss, and the alarm will be missed repeatedly. (85% 失败率)
- **** — Disabling the flag only hides the symptom; the RTC data integrity is still compromised and alarms will fail silently. (90% 失败率)
