# RTC：TAMP1引脚检测到篡改，系统已停止

- **ID:** `embedded/rtc-tamper-detection-triggered`
- **领域:** embedded
- **类别:** system_error
- **错误码:** `RTC_TAMP_FLAG`
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

RTC篡改引脚（TAMP1）检测到外部事件，导致硬件级系统停止以保护敏感数据。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| STM32CubeFW_L4 v1.18.0 | active | — | — |
| HAL_RTC v2.0.3 | active | — | — |
| ARM Cortex-M4 r0p1 | active | — | — |

## 解决方案

1. ```
   Disable the tamper pin in the RTC configuration after detecting the event: HAL_RTCEx_DeactivateTamper(&hrtc, RTC_TAMPER_1);
   ```
2. ```
   Implement a debounce mechanism in firmware to filter out spurious tamper events: if (HAL_GPIO_ReadPin(TAMP1_GPIO_Port, TAMP1_Pin) == GPIO_PIN_RESET) { HAL_RTCEx_DeactivateTamper(&hrtc, RTC_TAMPER_1); }
   ```

## 无效尝试

- **** — The tamper detection is edge-triggered; clearing the flag without reconfiguring the pin leaves the system in an unstable loop. (90% 失败率)
- **** — Tamper detection is independent of the backup domain reset; it only depends on the TAMP pin configuration. (70% 失败率)
