HAL TAMP How to Use

group TAMP_How_To_Use

The antitamper detection circuit is used to protect sensitive data from external attacks. Detection occurs on events from the different tamper I/O or from internal monitors detecting out-of-range device conditions.

The TAMP driver provides:

  • external tampers that can operate in:

    • passive mode with ultra-low power edge or level detection.

  • internal tampers to protect against transient or environmental perturbation of the microcontroller.

  • backup register read/write.

  • configuration of device secrets protection.

TAMP operating condition

The TAMP clock, also used by the RTC driver, is called RTCCLK and can come from different sources:

  • HSE

  • LSE

  • LSI

RTC domain reset

The RTC domain reset sets all TAMP registers and the RCC_RTCCR register to their reset values. An RTC domain reset occurs when:

  • triggered by setting the RTCDRST bit in the RCC RTC domain control register (RCC_RTCCR).

  • totally powering off the microcontroller.

RTC domain access

After reset, the RTC domain (RCC RTC domain control register (RCC_RTCCR), RTC registers, TAMP registers and backup registers) is protected.

To enable access to the TAMP domain and TAMP registers, do the following:

  • Enable the clock driving the power controller interface using the HAL_RCC_PWR_EnableClock function

  • Enable access to RTC 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 low power mode by a tamper event.