The syntax of the tamper_cfg application is:

~# tamper_cfg --help
Change tamper interface configuration

Copyright(c) Digi International Inc.

Version: 1.20

--cfg0 HEX           Set the value of the register TAMPER_CFG0
                         Bit 0: enable tamper detection (1 = enabled, 0 = disabled)
                         Bit 1: reconfigure tamper interface (1 = allowed, 0 = disallowed)
                         Bit 2: set active input level (1 = high, 0 = low)
                         Bit 3: reserved (write 0)
                         Bit 4: enable output if a tamper event occurs (1 = enable, 0 = disable)
                         Bit 5: set active output level (1 = high, 0 = low)
                         Bit 6: power off the device after a tamper event (1 = enable, 0 = disable)
                         Bit 7: clear tamper events (1 = allowed, 0 = disallowed)
                                Tamper events are cleared by writing 0 to the tamper event register
--cfg1 HEX           Set the value of the register TAMPER_CFG1
                         Bit 0-1: Averager (0: 1 sample; 1: 2 samples; 2: 4 samples; 3: 8 samples
                         Bit 2: Use internal Voltage Reference (1 = enabled, 0 = disabled).
                                WARNING: this affects all analog tampers and ADCs, see documentation for more details
                     This register is only used in Analog tampers
--help               Print this message.
--iface N            Tamper interface to which the command is applied.
                     This argument must be right after the program name
--input DEC          Select input pin for tamper detection
--output DEC         Select output for tamper event, if enabled
--ticks DEC/HEX      (Analog only) Number of tens of ticks every which the analog tamper must be sampled (1 tick = 1/1024 second)
--thres_l DEC/HEX    (Analog only) Lower threshold for the comparator window
--thres_h DEC/HEX    (Analog only) Higher threshold for the comparator window
--pwroff_delay DEC   Set delay (in tenths of a second) to power-off after
                     tamper event on interface N
--ack                Perform the acknowledgment of tamper event
--clear              Perform the clear of tamper event
--save               Save current settings to NVRAM
                     Before saving, all changes are volatile
--show               Show current settings of the tamper interfaces

HEX is a C-like 8-bit hexadecimal number.
DEC is a non-negative decimal number.
  • You can pass HEX numbers directly or with 0x prefix. They are case-insensitive (for example, 0x1A, 0X1a, 1a, and 1A are valid for the program). Invalid hexadecimal sequences or numbers larger than 8 bits are automatically rejected.

  • If two or more values are passed for the same option (for example, --input 0 --input 1), only the last argument takes effect.

  • Changes are kept in volatile memory until the option --save is passed. Perform this action after changing all settings.

Show tamper interface settings

The --show option prints the settings that currently apply. For registers that can contain bitfields, the meaning of individual bits is shown.

~# tamper_cfg --iface 0 --show
Tamper interface 0:

TAMPER0_CFG0: 0xff
        Tamper detection enabled          1
        Interface reconf allowed          1
        Tamper input active level         1
        Tamper output pin enabled         1
        Tamper output active level        1
        Tamper event powers device off    1
        Clear tamper events enabled       1
TAMPER0_CFG1: 0x00
        Averager mode (bit 0)           0
        Averager mode (bit 1)           0
        Internal voltage reference      0
MCA_TAMPER0_IO_IN: 1
MCA_TAMPER0_IO_OUT: 7
MCA_TAMPER0_DELAY poweroff: 0 (x 100 ms)
MCA_TAMPER0_EVENT: 0x00
        Tamper event signaled             0
        Event acknowledged                0

Change current settings

There is one option for changing each register of the tamper interfaces, as shown in the command line reference. See TAMPER_CFG0 and TAMPER_CFG1

If the Interface reconfiguration allowed option of a tamper interface is set to 0, it cannot be reconfigured.

New settings are kept in RAM (volatile) memory until saved with the --save option. This means that changes not saved to NVRAM will be lost when the device is powered off.

Once the new settings have been saved to NVRAM, you can restore factory defaults by updating the MCA firmware without option -k (this option would keep NVRAM settings). When the firmware restarts, it detects empty NVRAM sectors and restores its factory contents.

Example 1

Imagine a command like this:

~# tamper_cfg --iface 1 --cfg0 0xA0 --input 3

This command does the following for tamper interface 1:

  • Writes 0xA0 to CFG0:

    • Bit 7 = 1: allow clear tamper events

    • Bit 6 = 0: disable power off on a tamper event

    • Bit 5 = 1: set output level active high

    • Bit 4 = 0: disable output on a tamper event

    • Bit 3 = 0: reserved

    • Bit 2 = 0: set active input level low

    • Bit 1 = 0: disallow reconfiguration of the tamper interface

    • Bit 0 = 0: disable tamper detection

  • Selects input 3 as tamper detection pin.

When run, the command fails:

~# tamper_cfg --iface 1 --cfg0 0xA0 --input 3
Reconfiguration of the tamper interface 1 is not allowed
At least one operation could not be performed

Use the --show option to see the current status of interface 1:

~# tamper_cfg --iface 1 --show

Tamper interface 1:

TAMPER1_CFG0: 0xa0
        Tamper detection enabled        0
        Interface reconf allowed        0
        Tamper input active level       0
        Tamper output pin enabled       0
        Tamper output active level      1
        Tamper event powers device off  0
        Clear tamper events enabled     1
TAMPER1_CFG1: 0x00
        Averager mode (bit 0)           0
        Averager mode (bit 1)           0
        Internal voltage reference      0
MCA_TAMPER1_IO_IN: 0
MCA_TAMPER1_IO_OUT: 0
MCA_TAMPER1_DELAY poweroff: 0 (x 100 ms)
MCA_TAMPER1_EVENT: 0x00
        Tamper event signaled           0
        Event acknowledged              0

In this case, the tamper interface 1 CFG0 was set to 0xA0 as instructed. However, this value implicitly disables the reconfiguration (see bit 1), preventing input pin 3 from being selected. These settings are still volatile (since option --save has not been used) and will be lost when the board is powered off.

Save current settings

The --save option writes the current configuration into NVRAM.

~# tamper_cfg --iface 1 --cfg0 5F --input 3 --output 4 --pwroff_delay 35 --show --save
Configuration saved.

Tamper interface 1:

TAMPER1_CFG0: 0x5f
        Tamper detection enabled        1
        Interface reconf allowed        1
        Tamper input active level       1
        Tamper output pin enabled       1
        Tamper output active level      0
        Tamper event powers device off  1
        Clear tamper events enabled     0
TAMPER1_CFG1: 0x00
        Averager mode (bit 0)           0
        Averager mode (bit 1)           0
        Internal voltage reference      0
MCA_TAMPER1_IO_IN: 3
MCA_TAMPER1_IO_OUT: 4
MCA_TAMPER1_DELAY poweroff: 35 (x 100 ms)
MCA_TAMPER1_EVENT: 0x00
        Tamper event signaled           0
        Event acknowledged              0