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
Erwan YVIN
ST Employee
Posted on July 08, 2015 at 15:58 Hello Mike , Yes, this application has been tested and is working for STANDBY. Did you have this patch in hal_lld.h ?

<diff><![CDATA[--- components/spc560dxx_hal_drivers_component/lib/include/hal_lld.h
+++ components/spc560dxx_hal_drivers_component/lib/include/hal_lld.h
@@ -599,8 +599,7 @@
* @note Not defined, available to application-specific modes.
*/
#if !defined(SPC5_ME_LP_PC7_BITS) || defined(__DOXYGEN__)
-#define SPC5_ME_LP_PC7_BITS (SPC5_ME_LP_PC_HALT0 | \
- SPC5_ME_LP_PC_STOP0)
+#define SPC5_ME_LP_PC7_BITS (SPC5_ME_LP_PC_STANDBY0)
#endif
/**
@@ -737,7 +736,8 @@
SPC5_RUNMODE_RUN2 = 6,
SPC5_RUNMODE_RUN3 = 7,
SPC5_RUNMODE_HALT0 = 8,
- SPC5_RUNMODE_STOP0 = 10
+ SPC5_RUNMODE_STOP0 = 10,
+ SPC5_RUNMODE_STANDBY = 13
} spc5_runmode_t;

After importing the project , you should regenerate in order to apply the patch ? the Wakeup event is served in :

/*
* Interrupt_wakeup ISR function (vector 46).
*/
OSAL_IRQ_HANDLER(vector46) {
uint32_t wisr;
OSAL_IRQ_PROLOGUE();
/* ISR code here.*/
wisr = WKUP.WISR.R;
WKUP.WISR.R = wisr;

//Clear interrupt

gotoRunMode();

//Put device to run mode

OSAL_IRQ_EPILOGUE();
}

The configuration could be done in the init :

void

configureWKPU(

void

) {
INTC_PSR(46) = 7;
WKUP.WIPUER.R = 0x0003ffff;

//Enable pullups on all wakeup pins

WKUP.WISR.R = 0x00000008;

//Clear interrupt flag

WKUP.WRER.R = 0x00000008;

//Enable WKUP[3]for wakeup event

WKUP.WIREER.R = 0x00000008;

//Enable WKUP[3]for wakeup event

WKUP.WIFER.R = 0x00000008;

// Enable Filter

}

Best Regards Erwan
ssk
Associate II
Posted on July 09, 2015 at 15:00

Hello Erwan,

Thank you very much for your quick reply.

I am attaching my test application herewith. Please verify if the implementation is correct as I am not seeing the expected behavior with this.

My application uses,

- PE0/WKUP6 as wakeup signal

- PA12/EIRQ17 as switch/button signal

When I run this code on target, I do see transition to 'STANDBY' mode but I do not get wakeup interrupt and hence no further code execution. Even the debugger looses the control when target enters the STANDBY mode. I have verified the behavior even with debugger removed but it is same.

Thanks in advance for all your help.

Mike.

________________

Attachments :

Test_Wakeup_09Jul15.zip : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I09M&d=%2Fa%2F0X0000000bZX%2FqhZNCfWAITxmtJ7lfbTMcvzcpyXbcN.XJtRC_Dfl4SU&asPdf=false
Erwan YVIN
ST Employee
Posted on July 09, 2015 at 17:45

Hello Mike ,

Ok , the transition RUN ==> STANDBY is working well.

The behavior is normal, you are losing the debug control because in low power because the CPU is going to shut off the debugger connection.

Did you trigger a Falling Edge on WKPU[6] PE[0] ?

                Best Regards

                               Erwan

ssk
Associate II
Posted on July 10, 2015 at 08:24

Hello Erwan,

Yes, I am triggering falling edge on wakup signal.

Mike.

ssk
Associate II
Posted on July 10, 2015 at 16:03

Whether using falling edge for wakeup signal needs any additional configuration - internal pull up/down? Whether external pull up/down is required?

Thanks.

Mike.

Erwan YVIN
ST Employee
Posted on July 13, 2015 at 11:21

Hello Mike ,

if you set WIPUER, you do not need to put an external pullup.

It could be good to check with oscilloscope your Wakeup signal.

    Best Regards

               Erwan

ssk
Associate II
Posted on July 13, 2015 at 12:41

The same wakeup signal works well in STOP mode. What could be going wrong in STANDBY mode?

Mike.

ssk
Associate II
Posted on July 13, 2015 at 15:50

Hello Erwan,

Have you checked my test application? It uses falling edge for wakeup signal. Is it working at your end as expected?

The same wakeup signal works well in STOP mode. What could be going wrong in STANDBY mode?

I checked the wakeup signal (PE0) over oscilloscope and I am able to receive the falling signal when MCU is in STANDBY mode. My device goes to STANDBY mode when this signal (PE0) is pulled high.

Please let me know the solution at the earliest as only this implementation has held up my project release. Thanks.

Mike.

Erwan YVIN
ST Employee
Posted on July 15, 2015 at 12:02

Hello Mike ,

You are right ..

There is a problem in your STANDBY Application.

You can not switch from STANDBY Mode to RUN0 Mode

You have to switch to DRUN Mode First. (CF Reference Manual)

I am sending you a new application this afternoon.

          Best Regards

                      Erwan

Erwan YVIN
ST Employee
Posted on July 15, 2015 at 13:57

Hello Mike ,

You can find in the attachment the Test Application in STANDBY mode.

1) From STANDBY State, you have to switch in DRUN mode

2) After STANDBY State , i have to stub spc_clock_init() function

Best regards

Erwan

________________

Attachments :

SPC560Dxx_OS-Less_WKPU_STANDBY_LPM_Test_Application_for_Discovery.7z : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0UD&d=%2Fa%2F0X0000000bZW%2Fq_19Gr4AFHhJopz4h0wB3mK5UtydKabrBlN8nbLOO.4&asPdf=false