cancel
Showing results for 
Search instead for 
Did you mean: 

SPC560C05L3 in Standby mode

mitchel
Associate II
Posted on June 30, 2016 at 13:43

Hi everybody,

I'm trying to get my SPC560C05L3 into Standby mode, but it's not working. I also tried other modes, and getting the controller into every RUN mode is no problem, but the other modes just don't work. 

I use this bit of code:

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY_INV;

if(ME.GS.B.S_MTRANS){

Send_CAN_message();

}

but it's not working. I also don't get my CAN message and the processor just continues running the rest of the code. I already checked my wake-ups, and all wake-ups are disabled except 1, and that one doesn't have an active trigger and isn't triggered at all.

Am I missing something to get the controller into standby mode?

Thanks,

Mitchel

#spc560-mcu #standby
9 REPLIES 9
mitchel
Associate II
Posted on June 30, 2016 at 15:03

Update: I changed some settings around, and when I try to go into STANDBY, the controller freezes. When stopping with the debugger, it shows that it is on the following line:

0x000000E0:   78 00 00 00  E_B       _IVOR1 (0x000000E0)

Anybody know how that can happen?

Erwan YVIN
ST Employee
Posted on June 30, 2016 at 15:40

Hello Mitchel ,

Could you confirm your device used ?

I think that your CAN configuration is preventing to go in Low Power modes (STANDBY)

This low power mode for CAN is entered when the MCR[MDIS] bit is asserted.

Maybe , you should send a CAN Message before entering in STANDBY Mode.

Best regards

                         Erwan

mitchel
Associate II
Posted on July 01, 2016 at 07:40

Hi Erwan,

Thank you for reply. I'm using a SPC560C50L3. 

I updated my code because I though the same thing. I now have the following:

WKUP.WISR.R = 0x200; // Status flag

ME.IS.R = 5;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY_INV;

With this code, I can see with the debugger that it goes into standby mode, but I still see that it goes to the line I copied before:

0x000000E0:   78 00 00 00  E_B       _IVOR1 (0x000000E0)

So what I can figure is that it does go into standby, but then freezes on that line. The only way to get the controller working again is with a power cycle.

Regards,

Mitchel

mitchel
Associate II
Posted on July 01, 2016 at 07:52

Ok, another update:

I added a loop to the switch to standby (copied and modified from the SPC5 studio function SetRunMode) to check if the mode transition is ok.

WKUP.WISR.R = 0x200; // Status flag

ME.IS.R = 5;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY_INV;

 for ( ; ; ) {

   uint32_t r = ME.IS.R;

   if ((r & 1U) == 1U) {

     break;

   }

   if ((r & 4U) == 4U) {

     break;

   }

 }

I now get the following results:

The target mode is STANDBY (0xD). ME.GS is indicating a transition is in progress. However, that's it. Nothing else happens. I waited 2 minutes, but it doesn't seem to go into standby mode. Do I have to disable all peripherals manually? I though that the CPU would handle that.

Thanks,

Mitchel

mitchel
Associate II
Posted on July 01, 2016 at 09:24

And another update.

I get the controller into low power mode (can't check if it's standby, but the debugger says ''Target has entered STOP state'', so at least something. However, now comes the next problem: getting it out. 

I have a wake-up event setup:

void setup_wakeup_trigger(void){

WKUP.WIPUER.R = 0xFFDFF; // enable all internal pull-up except the pad used (external pull-down)

WKUP.WIREER.R = 0x200; // Rising edge enable

WKUP.WISR.B.EIF = 0x200; // Status flag

WKUP.WIFER.B.IFE = 0x200; // Filter

WKUP.WRER.R = 0x200; // Enable wakeup

}

However, when I flip the switch on this pad (PB[10]), nothing happens. Anybody any ideas?
mitchel
Associate II
Posted on July 01, 2016 at 13:06

And another update (made great progress today :))

I'm now at the point where I can get the controller in STANDBY and wake it up. However, when waking it up, the boot doesn't work correctly. It doesn't run through my code, it just skips between disabling and enabling global interrupts. I also tried boot from SRAM, but that doesn't change anything.

As far as I understand, comming out of STANDBY should be equal to a reset right? Or it that assumption incorrect?
Erwan YVIN
ST Employee
Posted on July 01, 2016 at 14:41

Hello Mitchel,

Good News for your progress 😉

,

There is some interesting things in these document :

http://www.st.com/content/ccc/resource/technical/document/application_note/4d/3b/ac/a3/d4/c0/46/16/DM00074056.pdf/files/DM00074056.pdf/jcr:content/translations/en.DM00074056.pdf

After go out from STANDBY 

It is like a destructive reset.

You should check your state.

STANDBY ==> DRUN ==> RUN0

Could you check your RGM_STANDBY ?

Boot from Backup RAM indicator �? This bit indicates whether the system will boot from backup

RAM or flash out of STANDBY exit.

0 Boot from flash on STANDBY exit

1 Boot from backup RAM on STANDBY exit

        Best Regards

                      Erwan

mitchel
Associate II
Posted on July 01, 2016 at 14:53

Hi Erwan,

Thanks for the document. I'll take a look at is.

As for RGM_STDBY: 0x0000.

I also tried booting from backup ram = 1, but that didn't change anything. I got into the same loop as booting from flash.

As for the state, my debugger isn't fast enough. Minimum refresh time is 500ms, and then I only see the change from STANDBY to RUN0, so can't check what's in between besides DRUN

Regards,

Mitchel

mitchel
Associate II
Posted on July 04, 2016 at 13:50

Hi Erwan,

I still don't have the application working, but I did found something weird.

I updated my standby transition code to the following:

RGM.STDBY.B.BOOT_FROM_BKP_RAM = 0;

WKUP.WISR.R = 0xFFFFFFFF; // Status flag

ME.IS.R = 5;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY;

ME.MCTL.R = SPC5_ME_MCTL_MODE(STANDBY_MODE) | SPC5_ME_MCTL_KEY_INV;

 for ( ; ; ) {

 }

I don't really care what it does after going to STANDBY, so I just put it in an infinitive loop. After going to STANDBY, the debugger says ''Target has entered STOP state'' like before and when creating the wake up trigger, it says ''Target has left STOP state'' and doesn't continue properly. Nothing new so far.

However, when I stop the debugger to see where in the code it is running, it's still in the infinitive for loop. It seems like my SPC560 isn't resetting. How is that possible?

Thanks,

Mitchel