Hi
SRAM doesn't seem to keep its state in LPM3.
Here's my code:
#include "driverlib.h"
#include <stdio.h>
#include <string.h>
uint8_t buffer[20000];
void main(void)
{
// init code
[...]
SYSCTL_SRAM_BANKEN |= SYSCTL_SRAM_BANKEN_BNK7_EN; // enable ALL the memory banks
SYSCTL_SRAM_BANKRET |= (SYSCTL_SRAM_BANKRET_BNK1_RET |
SYSCTL_SRAM_BANKRET_BNK2_RET |
SYSCTL_SRAM_BANKRET_BNK3_RET |
SYSCTL_SRAM_BANKRET_BNK4_RET |
SYSCTL_SRAM_BANKRET_BNK5_RET |
SYSCTL_SRAM_BANKRET_BNK6_RET |
SYSCTL_SRAM_BANKRET_BNK7_RET); // enable retention for ALL memory banks
__delay_cycles(1000000); // wait some time
memset(buffer, 0x7d, 20000);
Interrupt_enableMaster();
SCB_SCR |= SCB_SCR_SLEEPONEXIT;
// enter LPM4
SCB_SCR |= (SCB_SCR_SLEEPDEEP);
__sleep();
__no_operation();
// wake-up triggered
char tmp[32];
sprintf(tmp, "@0x%x: 0x%x ", (uint32_t)buffer, buffer[0]);
print_string(tmp);
sprintf(tmp, "@0x20001fff: 0x%x ", *(uint8_t*)(0x20001fff));
print_string(tmp);
sprintf(tmp, "@0x20002000: 0x%x ", *(uint8_t*)(0x20002000));
print_string(tmp);
while (1);
}
When I flash the program code and let it run, the output is 0x7d for all 3 memory addresses. However, after resetting the device, the output is different: I get 'random' values for the last print line, which tells me that bank 1 of SRAM (starts at 0x20002000) does NOT retain its state.
Regards,
keepcoding