# RTC: alarm interrupt not triggering at configured time

- **ID:** `embedded/rtc-alarm-interrupt-not-triggering`
- **Domain:** embedded
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 85%

## Root Cause

RTC alarm interrupt failed to fire due to incorrect mask configuration or pending interrupt flag not cleared.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| STM32Cube_FW_H7 V1.11.0 | active | — | — |
| FreeRTOS V10.4.1 | active | — | — |

## Workarounds

1. **Check and clear RTC_ISR_ALRAF flag in RTC_ISR register before setting alarm, then enable alarm interrupt in RTC_CR: `RTC->CR |= RTC_CR_ALRAIE;`** (90% success)
   ```
   Check and clear RTC_ISR_ALRAF flag in RTC_ISR register before setting alarm, then enable alarm interrupt in RTC_CR: `RTC->CR |= RTC_CR_ALRAIE;`
   ```
2. **Ensure RTC alarm mask bits (ALRAE, ALRABIN) in RTC_CR are set correctly for desired alarm mode.** (85% success)
   ```
   Ensure RTC alarm mask bits (ALRAE, ALRABIN) in RTC_CR are set correctly for desired alarm mode.
   ```
3. **Use HAL_RTC_AlarmIRQHandler() which automatically clears pending flags and re-enables interrupt.** (95% success)
   ```
   Use HAL_RTC_AlarmIRQHandler() which automatically clears pending flags and re-enables interrupt.
   ```

## Dead Ends

- **** — Increasing RTC clock prescaler changes alarm timing but does not fix interrupt configuration. (90% fail)
- **** — Reinitializing RTC peripheral resets all registers, losing alarm settings. (80% fail)
- **** — Adding delay loops after alarm set does not address missing interrupt enable. (70% fail)
