2015-06-30 07:50 AM
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.2015-10-14 06:32 AM
Hello Erwan
Thanks so much I try this example as soon as possible. Best Regards Nazerian Vanima2015-10-15 03:44 AM
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 Vanima2015-10-15 08:09 AM
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
2015-10-27 02:14 AM
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=false2015-10-27 05:18 AM
Hi Erwan
I send You an email for this issue . this is an example for standby mode enter and exit . Best Regards Nazerian Vanima2015-11-17 12:13 AM
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
2015-11-17 01:46 AM
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 Erwan2015-11-17 03:27 AM
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
2015-11-25 01:04 AM
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 Erwan2015-11-25 08:14 AM
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¤tviews=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¤tviews=49 Best regards Erwan