I'm trying to put a KL02 microcontroler in VLPS mode (according to the datasheet the current consumption in this mode should be betwen 2 to 5 uA) but it seems that it doesn't enter in this mode properly. The current consumption is around 2mA after WFI instruction (3.6mA in normal operation)
I've an periodic interruption (1sec) using LPTIMER for RUN mode enter 1sec. after WFI instruction.
I'm trying to send the uC to VLPS mode out of this interruption with this code:
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
// set the uC in Very-Low-Power Stop mode (VLPS)
SMC->PMPROT |= (uint8_t)SMC_PMPROT_AVLP_MASK; // allow entry in low power modes
SMC->PMCTRL |= 0x02; // set VLPS mode for WFI state
MCM->CPO |= MCM_CPO_CPOWOI_MASK; // clear CPOREQ on any interrupt or exception vector fetch
MCM->CPO |= MCM_CPO_CPOREQ_MASK; // request Compute Operation
while (!(MCM->CPO & MCM_CPO_CPOACK_MASK)); // wait until Compute operation entry has completed
__WFI();
///////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
Any idea about what I'm doing wrong?
Thanks in advance