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.
61 REPLIES 61
nooshin_1382
Associate II
Posted on October 14, 2015 at 15:32

Hello Erwan

Thanks so much I try this example as soon as possible.

Best Regards

Nazerian Vanima

nooshin_1382
Associate II
Posted on October 15, 2015 at 12:44

Hello Erwan

Thanks so much for your help in this issue to me.

I test the code in my application it ok for me but have some RESET issue when wakeup from RAM .

is exist any way to save the flash address and when wakeup from ram jump to this address?

Best Regards

Nazerian Vanima

Erwan YVIN
ST Employee
Posted on October 15, 2015 at 17:09

Hello Vanima ,

Could you send me your full application not only the main.c file ? if there is some company restricted code you can send directly by email anyway could you relocate the code halSPCSetRunMode in RAM ? like below :

_attribute__ ((section (
''.codeinram''
))) 
void
gotoStandbyMode(
void
) {
WKUP.WISR.R = 0x00000008; 
//Clear interrupt flag
if
((ME.GS.B.CURRENTMODE < SPC5_RUNMODE_RUN3)
|| (ME.GS.B.CURRENTMODE > SPC5_RUNMODE_RUN0)) {
/* Clearing status register bits I_IMODE(4) and I_IMTC(1).*/
ME.IS.R = 5;
/* 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) {
} 
}
}
__attribute__ ((section (
''.codeinram''
))) 
void
gotoRunMode(
void
)
{
/* Clearing status register bits I_IMODE(4) and I_IMTC(1).*/
ME.IS.R = 5;
/* Starts a transition process.*/
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;
/* Waits for the mode switch or an error condition.*/
while
(TRUE) {
} 
}

there is an important thing. if a WAKEUP Event is pending, you can not enter in Sleep Mode (STANDBY). Best Regards Erwan
nooshin_1382
Associate II
Posted on October 27, 2015 at 10:14

Hi Erwan

Sorry For my late answer.

I test this code but MCU is reset when the wakeup signal is generated.

I use this mode permanently for my project i should save my parameters status in Virtual eeprom.

i don't know what happen for this mode.

i send my test project for you this project have the same response on my real project.

thanks so much For your kind attention Erwan.

Best Regards

Nazerian Vanima

________________

Attachments :

Led_Blinker.rar : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006I0TZ&d=%2Fa%2F0X0000000bZP%2F4PqXUNXUncH4B3LhBZuYd8YTlaAXTlMG7_ax0B14jFA&asPdf=false
nooshin_1382
Associate II
Posted on October 27, 2015 at 13:18

Hi Erwan

I send You an email for this issue .

this is an example for standby mode enter and exit .

Best Regards

Nazerian Vanima

Posted on November 17, 2015 at 09:13

Hi Community

I have some trouble with the reset after wakeup. I try to enter Run from Standby. During this mode transition, the microcontroller gets a reset and the data in the SRAM are lost. Functions were stored in the .codeinram section and the Boot from BKUPRAM FLAG is active.

Is there a solution for this?

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on November 17, 2015 at 10:46

Hello Philipp ,

Did you use PLS Debugger ?

In our configuration , by Default , Hardware Reset Mode is set.

could you disable this mode please and retest ?

(cf cfg file in UDE directory)

Use Hardware Reset Mode

When this option is enabled the normal mechanism setting the startup program counter to the start symbol of the loaded program by the debugger is disabled. There are two modes selectable:

(the 2 modes are not selectable in PLS 4.02+ with SPC57 patches)

• Simulate boot code: The flash is searched for a valid reset configuration halfword (RCHW). If a valid word is found, the address is read from the correct and used as the start address. The behavior is similar to the BAM flow during power on reset.

• Execute boot code: The PC is set to the entry point of the bootcode if there is boot code available

This option is especially helpful if programs are debugged where an additional loader program is already flashed into the target. That option is also needful to check, if the application starts correctly when the debugger is not connected.

Be aware that if the target processor is not correctly configured, e.g. there is no boot code or buggy bootcode, using the Hardware Reset Mode can result in unpredictable behavior.

Load in Ram issue with PLS will be solved in SPC5Studio 4.0.

      Best Regards

                

                   Erwan

Posted on November 17, 2015 at 12:27

Hi Erwan

Thank you for your fast reply. Yes I’m using the PLS integrated Debugger, which is delivered on board.

The Hardware Reset Mode is already deselected, but I’m using 4.04 PLS UDE so have no selectable modes.

I did some changes in my application. Boot from BKUP Ram is disabled. I need for my application some data in the SRAM, which should be still valid after wake up. (Boot from BKUP RAM is not necessary, it was a disaccord from me)

The new behavior is the behavior before. The microcontroller goes into STANDBY and if the SW2 is pressed it wakes up. During the wakeup process the microcontroller get a reset. The stored data in the SRAM corrupt through this reset. The difference to the behavior before is that the reset doesn’t occur during debugging with PLS. It only occurs if the UDE platform is closed and application is running without the debugger.

Is there another solution to store data before the reader goes into STANDBY? (Data Flash has not enough write cycles. The configuration/timings must be stored on very switch into standby).

Used Hardware: SPC560D Discovery Board

kind regards

Philipp

Erwan YVIN
ST Employee
Posted on November 25, 2015 at 10:04

Hello Philip,

Please use PLS 4.02, this version is more stable

According to the RM, (D Bolero)

the first 8K SRAM could be still ON.

''The only parts of the device that are still powered during this mode are pads

mapped on wakeup lines and power domain #0 which contains the MC_RGM, MC_PCU,

WKPU, 8K RAM, RTC_API, SIRC, FIRC, and device and user option bits.''

Warning , after STANDBY entry, the debugger loses connection to the target due to

power gating.

    Best regards

                        Erwan

Erwan YVIN
ST Employee
Posted on November 25, 2015 at 17:14

Philipp ,

Full answer in [DEAD LINK /public/STe2ecommunities/mcu/Lists/SPC56/Flat.aspx?RootFolder=/public/STe2ecommunities/mcu/Lists/SPC56/Using%20SRAM&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000C7B65FFB6DB42540A4DAECE852348058&TopicsView=https://my.st.com/public/STe2ecommunities/mcu/Lists/SPC56/AllItems.aspx&currentviews=49]https://my.st.com/public/STe2ecommunities/mcu/Lists/SPC56/Flat.aspx?RootFolder=%2fpublic%2fSTe2ecommunities%2fmcu%2fLists%2fSPC56%2fUsing%20SRAM&FolderCTID=0x01200200770978C69A1141439FE559EB459D758000C7B65FFB6DB42540A4DAECE852348058&TopicsView=https%3A%2F%2Fmy.st.com%2Fpublic%2FSTe2ecommunities%2Fmcu%2FLists%2FSPC56%2FAllItems.aspx&currentviews=49

  Best regards

                  Erwan