AT32F425
Series Reference Manual
2022.03.30
Page 289
Ver 2.01
17.3.5 Time stamp function
When time stamp event is detected on the tamper pin (valid edge is detected), the current calendar
value will be stored to the time stamp register.
When a time stamp event occurs, the time stamp flag bit (TSF) in the ERTC_STS register will be set. If
a new time stamp event is detected when time stamp flag (TSF) is already set, then the time stamp
overflow flag (TSOF) will be set, but the time stamp registers will remain the result of the last event. By
setting the TSIEN bit, an interrupt can be generated when a time stamp event occurs.
Usage of time stamp:
1. How to enable time stamp when a valid edge is detected on a tamper pin
Select a time stamp in by setting the TSPIN bit
Select a rising edge or falling edge to trigger time stamp by setting the TSEDG bit
Enable time stamp by setting TSEN=1
2.
How to save time stamp on a tamper event
Configure tamper detection registers
Enable tamper detection time stamp by setting TPTSEN=1
Note: The TSF bit will be set after two ck_a cycles following a time stamp event. It is suggested that
users poll TSOF bit when the TSF is set.
17.3.6 Tamper detection
The ERTC has one tamper detection mode: TAMP1. It can be configured as a level detection with filter
or edge detection. TAMP1 can select either ERTC_MUX.
The TP1F will be set when a valid tamper event is detected. An interrupt will also be generated if a
tamper detection interrupt is enabled. If the TPTSEN bit is already set, a time stamp event will be
generated accordingly. Once a tamper event occurs, the battery powered registers will be reset so as
to ensure data security in the battery powered domain.
How to configure edge detection
1.
Select edge detection by setting TPFLT=00, and select a valid edge (TP1EDG)
2.
According to your needs, configure whether to activiate a time stamp on a tamer event (TPTSEN=1)
3.
According to your needs, enable a tamper detection interrupt (TPIEN=1)
How to configure evel detection with filter
1.
Select level detection with filter, and valid level sampling times (TPFLT
≠
00)
2.
Select tamper detection valid level (TP1EDG)
3.
Select tamper detection sampling frequency (through the TPFREQ bit )
4.
According to your needs, enable tamper detection pull-up (setting TPPU=1). When TPPU=1 is
asserted, tamper detection pre-charge time must be configured through the TPPR bit
5.
According to your needs, configure whether to activiate a time stamp on a tamper event
(TPTSEN=1)
6.
According to your needs, enable a tamper interrupt (TPIEN=1)
7.
Enable TMAP1 by setting TP1EN=1.
In the case of edge detection mode, the following two points deserve our attention:
1.
If a rising edge is configured to enable tamper detection, and the tamper detection pin turns to high
level before tamper detection is enabled, then a tamper event will be detected right after the tamper
detection is enabled;
2.
If a falling edge is configured to enable tamper detection, and the tamper detection pin turns to low
level before tamper detection is enabled, then a tamper event will be detected right after the tamper
detection is enabled;