I am trying to figure out why my K40 (on a KwikStik) does not wake up on serial port activity. This is how I go to sleep:
SCB_SCR = 0x4; //SLEEPDEEP = 1 MC_PMCTRL = 0xC2; //LP Wakeup enable, RUNM=2, LPLLSM=2 //let UART5 RX edge cause wake-up UART_S2_REG(UART5_BASE_PTR) |= UART_S2_RXEDGIF_MASK; //clear it before enabling interrupt UART_BDH_REG(UART5_BASE_PTR) |= UART_BDH_RXEDGIE_MASK; //enable wake-up on serial port rx edge UART_S2_REG(UART5_BASE_PTR) |= UART_S2_RXEDGIF_MASK; //make sure it is cleared before going to sleep SCB_SCR |= SCB_SCR_SLEEPDEEP_MASK; asm("WFI");
When it goes to sleep, the current goes down - I measure .1mV across the 1ohm resistor on the board for current monitoring. When I send a character to the serial port, the meter reading goes up but only to .5 and there is no sign that the code is running. If I comment out the line that enables the wake-up via serial port then the reading stays at .1 when I send a character.
MQX is running on the board.
What am I missing? Why does it not fully wake up?