HAL TAMP How to Use ¶
- group TAMP_How_To_Use
-
The antitamper detection circuit is used to protect sensitive data from external attacks. The detection is made on an event of the different tamper I/O or on internal monitors detecting out-of-range device conditions.
The TAMP driver provides:
-
external tampers that can work in two modes:
-
active mode that is a continuous comparison between a tamper output and input
-
passive mode that are ultra-low power edge or level detection
-
-
internal tampers to protect against transient or environmental perturbation of the microcontroller
-
monotonic counters
-
backup registers read/write
-
configuration of device secret protection
The TAMP driver is part of the backup domain. When clocked by the LSE and powered through the VBAT pin, it can be functional in all low-power modes.
TAMP operating condition ¶
The antitamper detection circuit is part of the backup domain and can be powered from VBAT when the main VDD supply is powered off. When VDD is turned off, it is possible to retain the content of the TAMP registers and supply the TAMP peripheral. To do so, the VBAT can be connected to an optional standby voltage supplied by a battery or by another source.
The TAMP clock also used by the RTC driver, is called RTCCLK and can come from different sources:
-
HSE with a prescaler
-
LSE
-
LSI with a prescaler
Backup domain reset ¶
The backup domain reset sets all TAMP registers and the RCC_BDCR register to their reset values. A backup domain reset occurs when:
-
triggered by setting the BDRST bit in the RCC backup domain control register (RCC_BDCR).
-
totally powering off the microcontroller.
Backup domain access ¶
After reset, the backup domains are protected against possible unwanted write accesses. To enable access to the TAMP domain and TAMP registers, proceed as follows:
-
Enable the clock driving the power controller interface using the HAL_RCC_PWR_EnableClock function
-
Enable access to backup domain using the HAL_PWR_DisableRTCDomainWriteProtection function
-
Select the RTC clock source using the HAL_RCC_RTC_SetKernelClkSource function
-
Enable RTCAPB clock using the HAL_RCC_RTCAPB_EnableClock function
TAMP and microcontroller low power modes ¶
The MCU can be woken up from a low power mode by a tamper or internal tamper event. These TAMP functions can wake up the system from the all low-power modes. Wake-up from stop and standby mode is possible only when the TAMP clock source is LSE or LSI. For shutdown mode it is only possible when the TAMP clock source is LSE.
-