23.6.8.5.1 Timestamp
As part of tamper detection the RTC can capture the counter value (COUNT/CLOCK) into the
TIMESTAMP register. Three CLK_RTC periods are required to detect the tampering condition and
capture the value. The TIMESTAMP value can be read once the Tamper flag in the Interrupt Flag
register (INTFLAG.TAMPER) is set.
Note: In this case, the user should
not read the TIMESTAMP register from the CPU. The read access to the TIMESTAMP register must
be left to the DMA.
If the DMA Enable bit in the Control B register (CTRLB.DMAEN) is
‘1’, a DMA request will be triggered by the timestamp. In order to determine which tamper
source caused a capture, the Tamper ID register (TAMPID) provides the detection status of each
tamper channel and the tamper input event. A DMA transfer can then read both TIMESTAMP and
TAMPID in succession.A new timestamp value cannot be captured until the Tamper flag is cleared, either by reading the timestamp (CTRLB.DMAEN = 1) or by writing a ‘1’ to INTFLAG.TAMPER (CTRLB.DMAEN = 0). If several tamper conditions occur in a short window before the timestamp is read, only the first timestamp may be logged. However, the detection of each tamper will still be recorded in TAMPID.
The Tamper Input Event (TAMPEVT) will always perform a timestamp capture. To capture on the
external inputs (INn), the corresponding Input Action field in the Tamper Control register
(TAMPCTRL.INnACT) must be written to ‘1’. If an input is set for wake functionality it does
not capture the timestamp; however the Tamper flag and TAMPID will still be updated.
Note:
- The TIMESTAMP value should be read once, and INTFLAG.TAMPER must be cleared. The next value should be read only after the INTFLAG.TAMPER is set again.
- If an external reset occurs during a
tamper detection the TIMESTAMP register is permanently locked until the next power up.
To avoid that specific situation do not use the Ttimestamp register and DMA upload,
instead enable the RTC tamper interrupt, and in the tamper
irq
routine, copy the value from the RTC CLOCK register to one of the following destinations: SRAM, RTC GPx or BKUPx registers as the timestamp value. - The Timestamp capture feature is not functional in battery Backup mode.