S912ZVCA192 Sleep, Wake Issue

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

S912ZVCA192 Sleep, Wake Issue

1,430 Views
kiranbhat
Contributor III

Hi

I am Using S912ZVCA192 controller. I want the controller to go to sleep mode and then wake it up with Key Wake up Interrupt.

 

Note:1

I am Using

asm ANDCC #0x7F;  //clear S bit - enable the stop mode. If the S bit is not

                      //cleared then STOP instruction has no effect and is

                      //executed as a dummy instruction NOP.

 

    asm STOP;         //STOP mode

to go to sleep mode.

 

Note:2

I am configuring KWP interrupt before executing the above Instruction.

/*configure port AD for KWU feature*/

    DDRAD_DDRADL3 = 0;            /* Configure PAD3 as input */ 

  DIENADL_DIENADL3 = 1;         /* Pin is configured as digital input */

  PERAD_PERADL3 = 0;            /* Enable Pull Device on PAD3 */

  PPSAD_PPSADL3 = 1;            /* Configure interrupt for Rising Edge */

  PIEAD_PIEADL3 = 1;            /* Enable Interrupt on PAD3 (KWAD3) */

And In ISR of KWP

 

interrupt VectorNumber_Vportad HLUWAKE_INT(void)

{

     PIFADL_PIFADL3=1;

     CPMUCOP = 0x01;

     CPMUARMCOP = 0x50U;

     CPMUARMCOP = 0xA0U;

}

 

The problem is controller does not enters full stop mode.

 

 

 

Regards

Kiran Bhat

Labels (1)
Tags (2)
0 Kudos
3 Replies

705 Views
iggi
NXP Employee
NXP Employee

Hi,

Firstly what you can do is to disable interrupts prior to Stop Mode just to see if that works well.

It is good to scan the ECLK signal on pin PT7 which is the frequency of the bus clock so you can see if the MCU runs or not.

Just add the following codeline:

ECLKCTL = 0x00; //enable free-running clock on the ECLK pin

In the KWU interrupt routine your purpose of writing to CPMUARMCOP register is to trigger reset, right?

Note that write of 0x55 value following a write of 0xAA value in the CPMUARMCOP resets the time-out period. But still if this writes are not in loop (like in RESET_WATCHDOG function), the COP will cause a reset after time-out.

In this simple case flag clearing is okay, but recommendation is to do it like this:
PIFADL = 0x08;

Btw, ensure the switch or push button you use as key wakeup changes the logic level from 0 to 1, so you get rising edge.

Also you can test thisLow power mode example code for MagniV S12ZVC device

Regards,

iggi

705 Views
kexiangli
Contributor I

Hi,iggi

I don't know whether I can use this code in S12ZVL.I have only recently been in toch with this MCU.

And I want the controller just run in stop mode then waked up with Key Wake up Interrupt, as like Kiran bhat.

I saw the datasheet of MC9S12ZVL32.If I want it enter full stop mode,I think what i need to do is to set the bit PSTP or OSCE.

STOP_MODE-EN.jpg

So I write code like this:

//  CPMUCLKS_PSTP=1;

   CPMUOSC_OSCE=1;

but it does't use.And when I debug in Code Warrior 10.6,the bit does't set.

By the way,my board doesn't have the external OSC,does it matter?Thanks.

Regards

kexiangLi

0 Kudos

705 Views
kiranbhat
Contributor III

Hi Iggi

Thanks for the support Issue resolved

Regards

Kiran bhat

0 Kudos