RTC_ALARM_MISS embedded runtime_error ai_generated true

RTC: Alarm A interrupt missed, trigger time 12:30:00 exceeded by 500ms

ID: embedded/rtc-alarm-interrupt-missed

Also available as: JSON · Markdown · 中文
78%Fix Rate
83%Confidence
1Evidence
2024-01-22First Seen

Version Compatibility

VersionStatusIntroducedDeprecatedNotes
STM32Cube_FW_H7 v1.11.0 active
STM32Cube_FW_L4 v1.18.0 active
RTC HAL Driver v2.0.0 active

Root Cause

The RTC alarm interrupt was not serviced in time because a higher-priority interrupt or task delayed processing beyond the alarm window.

generic

中文

RTC报警中断未能及时服务,因为更高优先级的中断或任务延迟了处理,超过了报警窗口。

Official Documentation

https://www.st.com/resource/en/reference_manual/rm0383-stm32f411xce-reference-manual-stmicroelectronics.pdf

Workarounds

  1. 80% success Set the RTC alarm interrupt priority to the highest level (e.g., NVIC_SetPriority(RTC_Alarm_IRQn, 0)) and ensure no other interrupt uses the same priority group.
    Set the RTC alarm interrupt priority to the highest level (e.g., NVIC_SetPriority(RTC_Alarm_IRQn, 0)) and ensure no other interrupt uses the same priority group.
  2. 75% success Use a polling-based approach instead of interrupts: check the RTC alarm flag in the main loop every 10ms with HAL_RTC_GetAlarmFlag() and handle the event there.
    Use a polling-based approach instead of interrupts: check the RTC alarm flag in the main loop every 10ms with HAL_RTC_GetAlarmFlag() and handle the event there.

中文步骤

  1. Set the RTC alarm interrupt priority to the highest level (e.g., NVIC_SetPriority(RTC_Alarm_IRQn, 0)) and ensure no other interrupt uses the same priority group.
  2. Use a polling-based approach instead of interrupts: check the RTC alarm flag in the main loop every 10ms with HAL_RTC_GetAlarmFlag() and handle the event there.

Dead Ends

Common approaches that don't work:

  1. Increase the RTC alarm prescaler to reduce interrupt frequency 90% fail

    The alarm is a one-shot event; changing the prescaler does not affect the interrupt latency for a single trigger.

  2. Disable all other interrupts to give RTC priority 85% fail

    Disabling other interrupts can break critical system functions like timers or communication; it is not a sustainable fix.