cancel
Showing results for 
Search instead for 
Did you mean: 

SPC560D - power control modes

ssk
Associate II
Posted on June 30, 2015 at 16:50

Hello,

I am using standby mode for SPC560D MCU. The datasheet mentions about using DRUN or software reset for exiting this mode. Can you please explain on,

1. How to configure the DRUN mode? I tried using API 'halSPCSetRunMode' for switching between modes. But when used for DRUN mode, it does not exit the standby mode correctly and a power reset is required. Is any thing missing for this?

2. Which are the ways to use software reset for SPC560D? Can I use watchdog reset as a software reset? Is there any other means for software reset?

Thanks in advance for any help.

Mike.
This discussion has been locked for participation. If you have a question, please start a new topic in order to ask your question
61 REPLIES 61
Posted on November 27, 2015 at 13:17

Hi Erwan,

Thank you for your reply. I hope the SRAM Testapplication will included in the next SPC5 Studio Release.

The reset behvoir during the wakeup phase is not explainable for me. I figured out that the Software Watchdog Reset Flag (RGM.DES.B.F_SWT) is active after Wakeup. Some time the Reset Flags are External Reset and SWT_Reset after wakeup or only SWT reset.

Has anyone an explanation for this strange behavior?

Some Information:

GotoStandby:

WKUP.

WISR

.

R

= 0x00000008;                                          

//Clear interrupt flag

 

if

((ME.

GS

.

B

.

S_CURRENTMODE

<

SPC5_RUNMODE_RUN3

) || (ME.

GS

.

B

.

S_CURRENTMODE

>

SPC5_RUNMODE_RUN0

)) {

    ME.

IS

.

R

= 5;                                                     

// Clearing status register bits I_IMODE(4) and I_IMTC(1).

   

/* Starts a transition process.*/

    ME.

MCTL

.

R

= SPC5_ME_MCTL_MODE(

SPC5_RUNMODE_STANDBY

) | SPC5_ME_MCTL_KEY;

    ME.

MCTL

.

R

= SPC5_ME_MCTL_MODE(

SPC5_RUNMODE_STANDBY

) | SPC5_ME_MCTL_KEY_INV;

   

/* Waits for the mode switch or an error condition.*/

   

while

(TRUE) {

      uint32_t r = ME.

IS

.

R

;

     

if

(r & 1)

       

break

;

     

if

(r & 4)

       

break

;

    }

GotoRun:

OSAL_IRQ_HANDLER(vector46) {

  uint32_t wisr;

  OSAL_IRQ_PROLOGUE();

  wisr = WKUP.

WISR

.

R

;

  WKUP.

WISR

.

R

= wisr;

  ME.

IS

.

R

= 5;

  ME.

MCTL

.

R

= SPC5_ME_MCTL_MODE(

SPC5_RUNMODE_DRUN

) | SPC5_ME_MCTL_KEY;

  ME.

MCTL

.

R

= SPC5_ME_MCTL_MODE(

SPC5_RUNMODE_DRUN

) | SPC5_ME_MCTL_KEY_INV;

 

while

(TRUE) {

    uint32_t r = ME.

IS

.

R

;

  

if

(r & 1)

    

break

;

  

if

(r & 4)

    

break

;

  }

  OSAL_IRQ_EPILOGUE();

}

I tested it with the debugger and without the debugger. So there is the same behavior.

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on November 27, 2015 at 16:34

Hello Philipp ,

the next release 4.0 will not contain the SRAM STANDBY Application. (in progress)

First, we need to implement for a small change request to permit to the developer to create his own linker file. (*.ld)

maybe for 4.1.

because after each generation application.ld is overwritten.

anyway , in my application, i can see the ''core inactive'' when i push the button SW2

i will check the Watchdog Reset Flag (RGM.DES.B.F_SWT).

   Best Regards

                           Erwan

Posted on November 30, 2015 at 09:04

Hi Erwan,

Thank you for your reply. I did a mistake by disabling the Watchdog. Now I  disabled the watchdog correctly and I had another behavior.

If the Watchdog is disabled, the microcontroller, will not wake up correctly. I figured out that the blocking part is the

SPC5_CLOCK_FAILURE_HOOK

() Macro in the hal_lld_init() function. It look like, that the transition from DRUN to RUN0 failes.

I think that’s the reason for the watchdog reset.

Have you any idea, why this transition fails. 

Preclock initialization Code:

if

(ME.GS.B.S_CURRENTMODE == SPC5_RUNMODE_DRUN) {

And Post code

}

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on November 30, 2015 at 10:35

Hello Philipp ,

In my example, i have no problem and F_SWT is not set. (still 0)

after STANDBY ==> DRUN ==> RUN0

Could you send me your application ?

After updating the PreClock Init code ,

i am in DRUN state.

                Best regards

                                     Erwan

Posted on November 30, 2015 at 11:30

Hi Erwan

It is not easy for me to send you the application, but I will build a demo application to reproduce this issue.

Have you removed the reset flag initialization from spc_clock_init?

//  RGM.FES.R         = 0xFFFF;

//  RGM.DES.R         = 0xFFFF;

Otherwise the Watchdog reset flag is always zero.

Thank you for your reply.

kind regards

Philipp

Posted on November 30, 2015 at 14:31

Hi Erwan

You find can the demo application for the watchdog issue in the attachment.

Please connect PA11 with PA2. The SW2 button generates the Wakeup event.

kind regards

Philipp

________________

Attachments :

Watchdog_issue.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0FT&d=%2Fa%2F0X0000000bZN%2FvkcR1mriEXxSwQOyULUjxb3UbwX3NOyxvOgo6ZLaeqY&asPdf=false
Erwan YVIN
ST Employee
Posted on November 30, 2015 at 16:05 Hello Phillip , when the system boots from flash on STANDBY Exit , the issue can happen. Maybe , the flash is not ready after the standby exit i recommend you to boot from BAckup RAM on STANDBY Exit. 2 Advantages : 1) Lower Power Consumption 2) Faster startup time Reason.

/* Configure WKPU in order to enter in RUN Mode */
configureWKPU();
RGM.STDBY.B.BOOT_FROM_BKP_RAM=1;

Best Regards Erwan
Posted on November 30, 2015 at 16:27

Hi Erwan

Thank you for your fast fix. It works very well in my application.

The microcontroller still generates an external reset during wakeup. This behavior occurs only if the JTAG Debugger is closed and the discovery board run as standalone, You can also see that the reset pin is set to low and the red led lights up very shortly. This occurs only without the debugger. 

Have you also solution for this behavior?

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on November 30, 2015 at 17:41

Hello Philipp ,

for the red led D2. It seems to be linked to the reset mode.

I have checked the documentation. I do not know how to disable it.

               Best Regards

                            Erwan

Posted on December 01, 2015 at 08:05

Hi Erwan

Thank you for your reply.

In my opinion it is a strange behavior, because when I am running the application with the debugger the external reset event doesn't occur and also the LED is not blinking. 

I searched in the errata sheet, but found nothing about this behavior. 

Please let me know, if you have any idea to fix this issue.

kind regards

Philipp