Wakeup event S32k312

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

Wakeup event S32k312

Jump to solution
881 Views
sai-bodhanapu
Contributor I

Hello @danielmartynek,  i am working on corestandby, can you please provide me the example for core standby, for me the wakeup does not work for corestandby mode.

Regards,

Sai Praveen Bodhanapu

0 Kudos
Reply
1 Solution
869 Views
giraffe508
Contributor IV

Hello Sai Praveen Bodhanapu,

I understand you are working on core standby mode and facing issues with the wakeup event for the S32K312. Here's an example to help you implement core standby and configure the wakeup event:

   #include 'S32K312.h'   #include 'clocks_and_modes.h'
void SIRC_Init(void) { SCG->SIRCCSR = SCG_SIRCCSR_SIRCDIV(0) | SCG_SIRCCSR_SIRCLPEN_MASK | SCG_SIRCCSR_SIRCEN_MASK; }
void PORT_Init(void) { PCC->PORTC = PCC_PORTC_CGC_MASK; PORTC->PCR[12] = PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; }
int main(void) { SIRC_Init(); PORT_Init();
SMC->PMPROT = SMC_PMPROT_AVLLS_MASK; SMC->PMCTRL = SMC_PMCTRL_STOPM(3); SMC->STOPCTRL = SMC_STOPCTRL_PSTOPO(0) | SMC_STOPCTRL_LLSM(0);
NVIC_EnableIRQ(PORTC_IRQn); NVIC_SetPriority(PORTC_IRQn, 3);
PORTC->PCR[12] |= PORT_PCR_IRQC(0xA);
while (1) { S32_NVIC->ICPR[1] = 1 << (44 % 32); S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP_MASK; __asm('WFI'); } }
void PORTC_IRQHandler(void) { if (PORTC->ISFR & (1 << 12)) { PORTC->ISFR = (1 << 12); } }

In this example, the S32K312 is configured to enter core standby mode using the 'WFI' instruction. The wakeup event is configured using the PORTC interrupt. The PORTC_IRQHandler() function is the interrupt service routine that will be executed when the wakeup event occurs.

Make sure to configure the NVIC (Nested Vectored Interrupt Controller) to enable the PORTC interrupt. 

View solution in original post

0 Kudos
Reply
2 Replies
870 Views
giraffe508
Contributor IV

Hello Sai Praveen Bodhanapu,

I understand you are working on core standby mode and facing issues with the wakeup event for the S32K312. Here's an example to help you implement core standby and configure the wakeup event:

   #include 'S32K312.h'   #include 'clocks_and_modes.h'
void SIRC_Init(void) { SCG->SIRCCSR = SCG_SIRCCSR_SIRCDIV(0) | SCG_SIRCCSR_SIRCLPEN_MASK | SCG_SIRCCSR_SIRCEN_MASK; }
void PORT_Init(void) { PCC->PORTC = PCC_PORTC_CGC_MASK; PORTC->PCR[12] = PORT_PCR_MUX(1) | PORT_PCR_PE_MASK | PORT_PCR_PS_MASK; }
int main(void) { SIRC_Init(); PORT_Init();
SMC->PMPROT = SMC_PMPROT_AVLLS_MASK; SMC->PMCTRL = SMC_PMCTRL_STOPM(3); SMC->STOPCTRL = SMC_STOPCTRL_PSTOPO(0) | SMC_STOPCTRL_LLSM(0);
NVIC_EnableIRQ(PORTC_IRQn); NVIC_SetPriority(PORTC_IRQn, 3);
PORTC->PCR[12] |= PORT_PCR_IRQC(0xA);
while (1) { S32_NVIC->ICPR[1] = 1 << (44 % 32); S32_SCB->SCR |= S32_SCB_SCR_SLEEPDEEP_MASK; __asm('WFI'); } }
void PORTC_IRQHandler(void) { if (PORTC->ISFR & (1 << 12)) { PORTC->ISFR = (1 << 12); } }

In this example, the S32K312 is configured to enter core standby mode using the 'WFI' instruction. The wakeup event is configured using the PORTC interrupt. The PORTC_IRQHandler() function is the interrupt service routine that will be executed when the wakeup event occurs.

Make sure to configure the NVIC (Nested Vectored Interrupt Controller) to enable the PORTC interrupt. 

0 Kudos
Reply
850 Views
sai-bodhanapu
Contributor I
Thank you @giraffee508, now its working.
0 Kudos
Reply