K22FX512 put in VLLS3 and weak-up

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

K22FX512 put in VLLS3 and weak-up

1,177 Views
ypkdani
Contributor III

Hello,

i have a problem to put in VLLS3 my K22FX512. I use this function:

//enable llwu
NVIC_EnableIRQ(LLWU_IRQn);
LLWU_SetExternalWakeupPinMode(LLWU, 15, kLLWU_ExternalPinFallingEdge);
//vlls3
BOARD_Clock_VLLP();
SMC_PreEnterStopModes();
SMC_SetPowerModeVlls(SMC, &vlls_config);

 where BOARD_Clock_VLLP is set as:

pastedImage_4.png

my event llwu is:

void LLWU_IRQHandler(void)
{
uint32_t llwu_pin=0;

SMC_PostExitStopModes();
PMC_ClearPeriphIOIsolationFlag(PMC);
LLWU_GetExternalWakeupPinFlag(LLWU, llwu_pin);
if(llwu_pin == 15){
PORT_SetPinInterruptConfig(POWER_BUTTON_GPIO, POWER_BUTTON_PIN, kPORT_InterruptOrDMADisabled);
PORT_ClearPinsInterruptFlags(POWER_BUTTON_GPIO, (1U << POWER_BUTTON_PIN));
LLWU_ClearExternalWakeupPinFlag(LLWU, 15);
}
NVIC_ClearPendingIRQ(LLWU_IRQn);
NVIC_SystemReset();
}

but the system not weak-up or not entern in the vlls completely. My power consumption after the

SMC_SetPowerModeVlls(SMC, &vlls_config);

is 500uA (i have other peripherical that consume) so i think the cpu is vlls state.

Thanks!!

Tags (2)
0 Kudos
3 Replies

774 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Daniele Cortellazzi

I don't see the configuration of your PTD6 as input GPIO with interrupt enable, do you have it included in your code? Also, do you set power mode VLLS to allow you to enter in this mode in SMC register?

checking your code I saw that in your LLWU_IRQHandler you are using LLWU_GetExternalWakeupPinFlag(LLWU, llwu_pin); thinking that llwu_pin will be fill up, actually this API receive the LLWU base and the index you want to check, and it return true or false depending if this flag is set. So I think what you want is:

if(LLWU_GetExternalWakeupPinFlag(LLWU, 15))
{
PORT_SetPinInterruptConfig(POWER_BUTTON_GPIO, POWER_BUTTON_PIN, kPORT_InterruptOrDMADisabled);
PORT_ClearPinsInterruptFlags(POWER_BUTTON_GPIO, (1U << POWER_BUTTON_PIN));
LLWU_ClearExternalWakeupPinFlag(LLWU, 15);
}

Finally, if you want to verify that you are entering into VLLS state you could set a signal in your LLWU_IRQHandler, if you don't get into VLLS state correctly, it will not get in the handler when you wake it up with the pin.

Hope this information could help you.

Best Regards

Jorge Alcala

774 Views
ypkdani
Contributor III

Hello,

i have tried but the cpu stop in the function when wake up:

pastedImage_1.png

i have to unlock some register? 

Thanks

0 Kudos

774 Views
jorge_a_vazquez
NXP Employee
NXP Employee

Hi Daniele Cortellazzi

This is because you haven't cleared the ACK Isolation flag to releases the state of your clock. You do this with PMC_ClearPeriphIOIsolationFlag(PMC);

I noticed in your code that you have this function in your interrupt handler, maybe the problem is that you are calling initialization clock (BOARD_InitBootClocks();) before enable LLWU interrupt. I recommend you to first clear this bit as follow:

if (kRCM_SourceWakeup & RCM_GetPreviousResetSources(RCM)) /* Wakeup from VLLS. */
{
     PMC_ClearPeriphIOIsolationFlag(PMC);
}

/* Init board hardware. */
BOARD_InitBootPins();
BOARD_InitBootClocks();
...‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍‍

Hope this could help you.

Best Regards

Jorge Alcala

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