@PBR
(1) uboot steps
The previous setting is just an example of active tamper, the registers should be configured as needed.
For example, if you want to use TAMPER_IN0 to check that a tamper connected to ground trigger when the line is opened. The process is like following:
We connect ET1 (tamper 0) to ground, we configure the DGO to PULL UP the line. When the line is cut, we will detect the transition GND to VCC. So, we must configure the detector to detect HIGH voltage.
HW setup: Connect the tamper to ground.
SW Configuration:
- [IF LINE MUXED] Configure the IOMUX for the tamper pin: Set the IOMUX register for the pin 141 to 0xdc000060 (Open Drain input + no Pull)
- [IF DGO] Configure the pull in DGO: Set the DGO register “TAMPER_PULL_CTRL” to 0x00000401 (Pull enable + Pull up).
- [IF DGO] Enable the tamper pins in DGO: Set the DGO register “SNVS_TEST” to 0x20000000 (tamper enable bit).
- Enable the SNVS detector: Set the SNVS register “LPTDCR” to 0x00000a00 (ET1EN + ET1P to detect HIGH voltage).
- Enable the Glitch filtering: Set the SNVS register “LPTGFCR” to 0x00800000
Configuration in uboot:
=> tamper_pin_cfg 141 0xdc000060
=> snvs_dgo_cfg 0 401 20000000 0 0 0
=> snvs_cfg 0 0 0 0 0 800000 a00 0 0 0 0 0 0 0 0 0 0 0 0
=> snvs_sec_status <- in default state: tamper 0 connected to ground
Pins:
- Pin 141: 1c000060
- Pin 142: 00000040
- Pin 143: 00000040
- Pin 144: 00000040
- Pin 145: 00000040
- Pin 136: 00000040
- Pin 137: 00000040
- Pin 138: 00000040
- Pin 139: 00000040
- Pin 140: 00000040
Fuses:
- Fuse 14: 0000425f
- Fuse 30: 00000002
- Fuse 31: 1c00001d
- Fuse 260: 00000000
- Fuse 261: 00000000
- Fuse 262: 00000000
- Fuse 263: 00000000
- Fuse 768: 00000000
SNVS:
- SNVS 00(1): 000001c0
- SNVS 34(1): 00000000
- SNVS 0c(1): 00000000
- SNVS 10(1): 00000000
- SNVS 18(1): 00000000
- SNVS 40(1): 00000008
- SNVS 48(2): 00000a00 00000000
- SNVS 4c(1): 80000000 <-The bit “ET1D” in SNVS “LPSR” shall not be set (0x00000200).
- SNVS a4(1): 00000000
- SNVS 44(3): 00800000 00000000 00000000
- SNVS e0(1): 00000000
- SNVS e4(1): 00000000
- SNVS e8(2): 00000000 00000000
- SNVS 3c(1): 00000000
- SNVS 5c(2): 00000000 00000000
- SNVS 64(1): 41736166
- SNVS f8(2): 003e0103 06000400
DGO:
- DGO 00: 00000000
- DGO 10: 00000401
- DGO 20: 20000000
- DGO 30: 00000000
- DGO 40: 00000000
- DGO 50: 00000000
=> snvs_sec_status <- Open the line to trigger tamper
Pins:
- Pin 141: 1c000060
- Pin 142: 00000040
- Pin 143: 00000040
- Pin 144: 00000040
- Pin 145: 00000040
- Pin 136: 00000040
- Pin 137: 00000040
- Pin 138: 00000040
- Pin 139: 00000040
- Pin 140: 00000040
Fuses:
- Fuse 14: 0000425f
- Fuse 30: 00000002
- Fuse 31: 1c00001d
- Fuse 260: 00000000
- Fuse 261: 00000000
- Fuse 262: 00000000
- Fuse 263: 00000000
- Fuse 768: 00000000
SNVS:
- SNVS 00(1): 000001c0
- SNVS 34(1): 00000000
- SNVS 0c(1): 00000000
- SNVS 10(1): 00000000
- SNVS 18(1): 80000000
- SNVS 40(1): 00000008
- SNVS 48(2): 00000a00 00000000
- SNVS 4c(1): 80000200 <-The tamper was trigger and the bit “ET1D” in SNVS “LPSR” was set (0x00000200).
- SNVS a4(1): 00000000
- SNVS 44(3): 00800000 00000000 00000000
- SNVS e0(1): 00000000
- SNVS e4(1): 00000000
- SNVS e8(2): 00000000 00000000
- SNVS 3c(1): 00000000
- SNVS 5c(2): 00000000 00000000
- SNVS 64(1): 41736166
- SNVS f8(2): 003e0103 06000400
DGO:
- DGO 00: 00000000
- DGO 10: 00000401
- DGO 20: 20000000
- DGO 30: 00000000
- DGO 40: 00000000
- DGO 50: 00000000
(2) Linux steps
Have you ever configured LPTDCR(0x48) before in uboot? Because this register can only be written once. The register write access is marked as locked by SECO after the first write through the manage SNVS interface. If you try to write it again in Linux, there should be some error.