RTC_ERR_ALARM_MISSED embedded runtime_error ai_generated true

RTC:闹钟中断丢失,VBAT低电压标志已置位

RTC: Alarm interrupt missed, VBAT low flag set

ID: embedded/rtc-alarm-missed-due-to-battery-loss

其他格式: JSON · Markdown 中文 · English
90%修复率
82%置信度
1证据数
2023-11-20首次发现

版本兼容性

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

根因分析

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

English

The backup battery (VBAT) voltage dropped below the threshold, causing the RTC registers to reset and the alarm to be missed.

generic

官方文档

https://www.st.com/resource/en/application_note/an4759-rtc-usage-with-stm32l4-series-stmicroelectronics.pdf

解决方案

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

无效尝试

常见但无效的做法:

  1. 85% 失败

    If VBAT is low, the RTC registers will reset again after the next power loss, and the alarm will be missed repeatedly.

  2. 90% 失败

    Disabling the flag only hides the symptom; the RTC data integrity is still compromised and alarms will fail silently.