S32K144: How to wake up from VLPS mode

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

S32K144: How to wake up from VLPS mode

1,765 Views
eafly
Contributor I

Hi, I'm working on the S32K144 and wish to find example to wake the controller up from VLPS using GPIO interrupts. I used the following code to install wakeup interrupt, but it doesn't work. Could you give me some advise how to get start? Regards! 

//use PTE 2 to wake up system

S32_NVIC->ICPR[PORTE_IRQn / 32] = 1 << (PORTE_IRQn % 32);

S32_NVIC->ISER[PORTE_IRQn / 32] = 1 << (PORTE_IRQn % 32);

S32_NVIC->IP[PORTE_IRQn] = 0x07;

PORTE->PCR[2] |= 0x000B0000; //config PTE2 as GPIO,rising and falling to trigger

Labels (1)
0 Kudos
2 Replies

1,636 Views
eafly
Contributor I

using  Example S32K144 RTC VLPS S32DS.R1  as reference code, Code was modified as following:

but still, it doesn't work.

void init_port(void)
{
   PCC-> PCCn[PCC_PORTE_INDEX] = PCC_PCCn_CGC_MASK; // Enable clock to PortE - BUS_CLK

   // PTE2
   PTE->PDDR &= ~(1 << 2); // Data Direction (input)
   PORTE->PCR[2] = 0x00098100;
   // [19?6] IRQC = 0b1001 ISF flag and Interrupt on rising-edge
   // [15] LK = 1 Pin Control Register fields [15:0] are locked
   // [10-8] MUX = 0b001 GPIO

   PORTE->DFCR = 0x00000001;
   // [0] CS = 1 Digital filters are clocked by the LPO clock

   PORTE->DFWR = 0x0000001F;
   // [4-0] FILT = 32 (1/32kHz) * 32 = 1ms

   PORTE->DFER |= (1 << 2);
   // Digital filter is enabled on the PTE2 pin,
}

void init_nvic(void)
{
   // PORTE_interrupt
   S32_NVIC->ICPR[1] = (1 << (63 % 32));
   S32_NVIC->ISER[1] = (1 << (63 % 32));
   S32_NVIC->IP[63] = 0x10; // Priority level 1
}

init_port();
init_nvic();
//enter vlps here
...

0 Kudos

1,636 Views
dianabatrlova
NXP TechSupport
NXP TechSupport

Hello, 

Do you have IRQHandler() for port E in your code?

Also, please, keep in mind that "when entering VLPR/VLPS mode, the system clock should be SIRC. The FIRC, SOSC,
and SPLL must be disabled by software in RUN mode before making any mode
transition."

So, you can use these functions before VLPS enter (which are located in that example):

init_SIRC();
switch_to_SIRC_in_RUN();
disable_FIRC_in_RUN();

You can also look at the example located in the S32 Design Studio File -> New -> S32DS Project from Example -> power_mode_switch_s32k144.

I hope it helps.

Best regard,

Diana

0 Kudos