Hello, I'm working with KL16Z256 in VLLS1 mode. I want to wake up by a rising edge on pin PTB0. This pin doesn´t support GPIO interrupt, only LLWU source. However, I need to enable the GPIO interrupt to wake up. My code is:
PORTB_PCR0 = (uint32_t)((PORTB_PCR0 & (uint32_t)~(uint32_t)(PORT_PCR_ISF_MASK | PORT_PCR_MUX(0x07) | PORT_PCR_IRQC_MASK))
| (uint32_t)(PORT_PCR_MUX(0x01)) | (uint32_t)(PORT_PCR_IRQC(0x09)) );
|psLLWUStruct->PE2 |= LLWU_PE2_WUPE5(0x01);||//Rising edge|
SMC_STOPCTRL = SMC_STOPCTRL_VLLSM(0x01);
SMC_PMPROT = 0x0A; //Added to allow VLLS
SMC_PMCTRL = SMC_PMCTRL_STOPM(u8LowPowerType);
MCG_C6 &= ~MCG_C6_CME0_MASK; // Disable MCG clock monitor
stop(); // Goto STOP with SLEEPDEEP enabled
If I don't use the first setence, it doesn´t work.
On the other hand, it work only the first time, once the microcontroler wake up, it reset all the time.
I have cleared the LLWU flash... what is wrong???