Part Number:TMS570LS3137
Hi;
I try to put TMS570LS3137 into sleep mode and wake up via CAN BUS. Right after wake up, i want CPU to reset itself. So, i wrote this function below:
#define SYS_DOZE_MODE 0x000F3F02U
#define SYS_SNOOZE_MODE 0x000F3F03U
#define SYS_SLEEP_MODE 0x000FFFFFU
void EnterLowPowerMode(uint32 mode)
{
/*Enable Wake Up Interrupts*/
vimREG->WAKEMASKSET0 = 0xFFFFFFFFU;
vimREG->WAKEMASKSET1 = 0x00000000U;
vimREG->WAKEMASKSET2 = 0x00000000U;
vimREG->WAKEMASKSET3 = 0x00000000U;
/*Power Down CAN Module to enable CAN activity detection circuit*/
canREG1->CTL |= ((uint32_t) 1U << 2 ) ; /* Enable Status Interrupts*/
canREG1->CTL &= ~(uint32)(0x00000041U);/*Clear Init Bit*/
pcrREG->PSPWRDWNSET1 &= ~(uint32)(0x00000003U); /*Power Down DCAN1*/
/*Put Flash Banks to Sleep*/
flashWREG->FBAC = 0x00000000U | (uint32) ((uint32) 15U << 8U) /*BAGP*/ | (uint32) ((uint32) 15U); /*VREADST*/
flashWREG->FBFALLBACK = 0x00000000U | (uint32) ((uint32) SYS_SLEEP << 14U) | (uint32) ((uint32) SYS_SLEEP << 2U) | (uint32) ((uint32) SYS_SLEEP << 0U);
flashWREG->FPAC2 = 0x0;
flashWREG->FPAC1 = 0x0;
/* Disable clock sources */
systemREG1->CSDISSET = mode & 0x000000FFU;
/* Disable clock domains */
systemREG1->CDDIS = (mode >> 8U) & 0x00000FFFU;
/*Execute ARM instructions with IDLE cycles to trigger CPU clock stoppage*/
asm( " NOP");
asm( " NOP");
asm( " NOP");
asm( " WFI");
asm( " NOP");
asm( " NOP");
asm( " NOP");
asm( " NOP");
asm( " NOP");
/*CPU Reset*/
if (systemREG1->CPURSTCR == 0x00000000U)
{
systemREG1->CPURSTCR = 0x00000001U;
}
else
{
systemREG1->CPURSTCR = 0x00000000U;
}
}
Controller seems to be in sleep mode after executing the function but doesn't wake up via CAN. Do you have any suggestions for that? Also, where does the program continue after wake up? ( or where should i put the CPU reset?)
-