is it support sleep mode and wake-up function code in ProcessorExpert?

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

is it support sleep mode and wake-up function code in ProcessorExpert?

1,733 Views
byeongjinkim
Contributor II

is it support sleep mode and wake-up function code in ProcessorExpert?

if it supported, how can i use?

mcu : S12ZVMC128

Codewarrior 10.7 version

4 Replies

1,265 Views
RadekS
NXP Employee
NXP Employee

Hi Byeongjin,

Since you wrote about sleep mode, I suppose that you question is related to MSCAN module.

The PE have an option for CAN Wakeup, but this option just affects WUPE and WUPM bits configuration. No specific code is generated.

 

Please look at attached simple example code for CAN wake-up.

Note: this example code was created for older S12XE MCU, but the MSCAN module is still the same.

 

The important code is:

  //============

  CANCTL0_WUPE = 1;  //wake up enable

  CANRIER_WUPIE = 1; //wake up interrupt enable

  //============

and:

CANCTL0_SLPRQ = 1;         //sleep mode request

while(CANCTL1_SLPAK == 0); //wait for acknowledge of sleep mode

 

asm ANDCC #0x7F;  //clear S bit

asm nop;

asm STOP;         //STOP mode

You should also create a wake-up ISR like:
interrupt VectorNumber_Vcan0wkup void CAN_WAKE(void)
{
//your code

CANRFLG=0x80   //clear WUPIF flag

CANRIER_WUPIE = 0; //wake up interrupt disable
}

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply

1,265 Views
byeongjinkim
Contributor II

i will using external pin port. (P port)

could i view example for pin interrupt wake-up and low-power mode?

0 Kudos
Reply

1,265 Views
RadekS
NXP Employee
NXP Employee

Hi Byeongjin,

For example, wake-up by pin PP0

In main();

DDRP_DDRP0 = 0;   //set PP0 as input
PPSP_PPSP0 = 0;   //pull-up resistor is selected, falling edge selected
PERP_PERP0 = 1;   //pull-up resistor is enabled
PIEP_PIEP0 = 1;   //interrupt enabled
//…
EnableInterrupts;
//...
asm ANDCC #0x7F;  //clear S bit
asm STOP;         //STOP mode
//…You should here restore your configuration changed by stop mode enter like enable external oscillator or configure clock for RTI,… 
//…‍‍‍‍‍‍‍‍‍

 

You should also create a wake-up ISR like:

interrupt VectorNumber_Vportp void PortP_ISR(void)
{
  if(PIFP_PIFP0 == 1)
  {
     //your code 
    PIFP = 0x01; //clear the PIFP0 interrupt flag    
  }
}  

I hope it helps you.

Have a great day,
Radek

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

1,265 Views
byeongjinkim
Contributor II

thank you.

have a good day~

0 Kudos
Reply