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.

How to restore clock configuration and Flash registers after wake from sleep on TMS570LC4357

Other Parts Discussed in Thread: TMS570LC4357, TMS570LS0714

The Hercules Low Power Mode example code does not match my TMS570LC4357 which does not have FPAC2 and FBFALLBACK.  My best guess sleep mode initialization goes through the sleep mode, executes the WFI, continues on through the NOPS (presumably after waking up) and gets a data trap at the end of the NOPs.  After the wake do I have to re-initialize the PLL and wait for it to lock?  Do I have to wait after re-enabling the clock domains?  Is there a particular order needed to restore GHVSRC, VCLKASRC, RCLKSRC, FBAC, FMAC, etc?  Is it safe to make a copy of the assorted registers before sleep and simply restore them on wake?

  • Hello,

    1. Yes, you need to re-map the clock domain to the desired clock source after the PLL output becomes valid. The PLL needs to be re-locked.

    2. No particular order. The default clock source for GCLK/HCLK/VCLKx is OSCIN, and default clock source for VCLKAx/RTICLK is VCLK. After power up, the default clock sources will be used if no change is make to those registers.

    3. You can the backup data to restore the PLL settings after wake up. 

    BTW, Hercules MCUs are not suitable for use in applications with low-power requirements across the full temperature range over which operation is supported. 

  • Attached is an example used for TMS570LS0714 device:

    4786.sys_main.c

  • Thank you QJ for the quick response.  Unfortunately I had already seen that example code which is intended for a different Hercules part number and the registers are not the same.  I have not been able to make it wake up as it gets data error in post_wakeup() on the first access of systemREG1->PLLCTL1.  The TMS570LC4357 has a specific and complicated errata function _errata_SSWF021_45_both_plls()  for bringing up the PLLs and I fear that the workable method on the LC4357 will be dramatically different as a result.  Would it be possible to post_wakeup example code for the TMS570LC4357?

  • Hi Darry,

    As I said that TMS570LC43x is not suitable for use in applications with low-power requirements. I am sorry I don't have an example.

    Are you able to restart the main oscillator, LF/HF LPO in post_wakeup()?

  • QJ,

       Running entirely from RAM (stepping with the debugger), the first instruction of post_wakeup()  traps out at dataEntry.

    systemREG1->CSDISCLR = 0x31;

    Regarding the actual power, I have to first prove that the low power mode is too high before I can make a case for an alternative solution.  The temperature chamber awaits...

  • QJ,

        I now have some code that runs after a wake-from-sleep but it behaves badly.  According to the debugger (displaying the disassembled RAM), it ignores the trampoline that should jump it to the reset vector and ignores a while(1)  and continues to execute into uninitialized RAM.

        If I do a warm reset before sleep, it works, if i do one after, it is ignored (systemREG1->SYSECR = 0x8000;) If I call the PLL init _errata_SSWF021_45_both_pll()  from the main, it works, but if I call it after disabling the clocks, it hangs.  How can I make this processor sleep and wake so that I can do my test?

  • QJ, 

        We really need a working example of putting the TMS570LC4357 to sleep and waking up again.  The Dev board has all the jumpers needed to measure the power consumption for the core processor.  We will do the evaluation at high temperatures once we have some working code.  This MCU has some errata relating to the PLL startup and requires your expertise  to get this to work.  You guys are the experts and we need your help to exercise the SLEEP function.

  • Hi Darryl,

    Does your code make the device enter sleep mode? What is the current consumption at sleep mode? 

  • QJ,

       I can't tell if it actually entered sleep mode.  I have tried to disable all clocks but if I missed something, then it will not sleep but just proceed to the wake-up code where always it hangs.  I am not sure it will sleep when running from the debugger, but without the debugger I cannot tell if it is sleeping or stuck in the wake-up.  What I would like to do is have it wake up on a button press, blink an LED, and then go to sleep.  Then I could easily see the difference between wake and sleep.

       The TMS570LC4357 Dev board provides some convenient jumper locations for measuring the MCU core current and I/O current.  I have a temperature chamber available to test at elevated temperatures.  So I just need some code that will sleep and wake.

    Darryl

  • I did manage to get Sleep to work, after resolving several issues:
    1.) I thought I understood that the current CCS (I am using 9.3) would generate code to move the executable to RAM using ".TI.ramfunc" and indeed the disassembler showed the code in RAM, but when I invalidated the cache, there was actually no code there.
    2.) I used memcpy() to move the code to RAM, then I had to disable the cache in order to actually execute the code (which was probably sitting in the datacache).
    3.) After disabling clocks and powering down domains, I had to add a substantial delay for things to shut down otherwise it would skip right over the WFI instruction.
    Using the CCS debugger, when it would Sleep and I hit PAUSE, it was then executing the NOP right after the WFI. This is useful to understand, I was not certain what effect the debugger would have on Sleep.
    My particular sample of TMS570LC4357 consumed 35mA in Sleep at room temperature, and 75mA at 105C. I understand from other comments that these values could be even higher for some batches of MCUs.

  • 35mA in sleep mode at room temp is quite high, seems like all clock source and domains are not disabled.