How to retain SAM L11 Trust RAM data during reset

Go To Last Post
3 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hello

   I have trouble to retain the SAM L11 Trust RAM (TRAM) data after SAM L11 is reset (logic low at reset pin). It always clear the TRAM data to 0x00 what ever I put 0x55 or 0xaa into the first byte of TRAM.

 

int main(void)
{
    uint8_t *ptr;
    char a;
    ptr=(0x42003500);   // TRAM first data byte.
    atmel_start_init();

   TRAM->CTRLA.reg |= TRAM_CTRLA_ENABLE ;
    printf("\n\nTRAM test V1.1\n");

    while(1){
        printf("w-write; r-read; s-sleep standby; o-sleep off\n");
    printf("input:");
    a=getchar();
    printf("%c\n",a);
    if(a=='i')  *ptr=0x55; //store1=0x55;
    else if(a=='x')  *ptr=0xaa; // store1=0xaa;
    else if(a=='r')   printf("store1=%x \n",*ptr); //store1);
    }  // while(1)  
}
 

I just want to keep a password in TRAM  with Battery, if the TRAM is always cleared at hardware reset, the password can not be stored in the TRAM.

For my case, how can I use TRAM? Is the TRAM data cleared by hardware reset or by the start up code before main()? Since I directly operate TRAM with pointer, I don't think the start up knows that I will use TRAM. I can write 0x55 or 0xaa to TRAM and read back, but after reset, it becomes 0x00.

Thanks

Inlinebeginner

 

"31.6.2.2 Enabling, Disabling and Resetting
The TRAM is enabled by writing a one to the Enable bit in the Control A register (CTRLA.ENABLE). The
TRAM is disabled by writing a zero to CTRLA.ENABLE.
The TRAM is reset by writing a one to the Software Reset bit in the Control A register (CTRLA.SWRST).
All registers in the TRAM will be reset to their initial state, and the TRAM will be disabled. All data in the
secure RAM will be cleared to ‘0’."

lxiu

Last Edited: Wed. Mar 3, 2021 - 04:09 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From looking at the datasheet 31.8.10 "Security RAM n" this clear on reset is the expected behavior.

/Lars

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Lajon, You are right. I guess for security reason, it is forced to clear 0x00. 

Most of the firmware eventually will run into trouble and needs reset, after reset, the TRAM data will be ereased. i.e. the TRAM can not be used for my case, unless my firmware never gets any problem.

Thanks

Inlinebeginner

 

"31.8.10 Security RAM n
Name: RAM
Offset: 0x0100 + n*0x04 [n=0..63]
Reset: 0x00000000
Property: PAC Write-Protected, Enable-Protected"

 

 

lxiu