This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

TMS570LS3137: Low Power Mode and CAN Wake Up

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?)

-  

  • Hello Erdem,

    The PC is at the 4th NOP (just after WFI) after the device is waked up.
  • Hello Wang;

    Thanks for the reply. Controller doesn't seem to wake up. Am I missing something with the "EnterLowPowerMode" function? What is the correct way to configure the controller for CAN Wake Up?

    Thanks for help.

    Regards

    Erdem

  • Hello Erdem,

    Since the CAN module is powered down, it should be waked up by wakeup signal on the CAN bus. The CAN bus activity detection circuit can be activated by setting the wake up on bus activity bit (WUBA) in CAN Control Register. This detection circuit is disabled at default.

    Note: The CAN message, which Initiates the bus activity, cannot be received. This means that the first message received in power down and automatic wake-up mode, will be lost.