Jump to main content

##

# 3.42.25 TrustRAM (TRAM)

The TrustRAM (TRAM) is the controller interface for a 256-byte security RAM. This RAM is intended for volatile secret data.

The TRAM is capable of performing address map scrambling as well as data scrambling for both write and read access to the security RAM. The TRAM can perform silent access of the data stream to improve side-channel attacks resistance.

The TRAM can execute two automated tasks that are triggered by external events

- Remanence prevention and erase.

  - When a remanence periodic event occurs, the physical data stored in the RAM is inverted in order to prevent physical “burn-in” signatures.

- Tamper Event

  - When a tamper event occurs, the TRAM executes a full erase of the control signals as well as the data in the security RAM.

Both automated tasks do not require CPU interaction and can be performed in all sleep modes.

## Using The Library

TRAM Peripheral library allows user to configure the following options of the TRAM peripheral which are part of the initialization routine in MCC.

- Enable silent access

- Enable data remanence prevention

- Enable data erasure on tamper detection

The example code below demonstrates how to Write and read Data from TRAM.

    int main( void )
    {
        uint32_t rData = 0;
        uint32_t wData = 0;

        /* Initialize all modules */
        SYS_Initialize ( NULL );

        for(uint8_t i = 0; i < 10; i++)
        {
            wData = ~(1 << i);

            TRAM_RAMSet(i, wData);

            TRAM_RAMGet(i, &rData);

            if(rData != wData)
            {
                printf("\n\rTRAM register RAM[%d] value mismatch", i);
                break;
            }
        }
    }

## Library Interface

TrustRAM peripheral library provides the following interfaces:

Functions

Name | Description
--- | ---
TRAM_Initialize | Initializes the TrustRam
TRAM_DataScrambleEnable | Enable or Disable data scrambling of the TrustRAM
TRAM_DataScrambleKeySet | Sets the key for data scrambling of the TrustRAM
TRAM_RAMGet | Reads data from the TrustRAM RAMx register
TRAM_RAMSet | Write data into the TrustRAM RAMx register