I'm having trouble using CMP0 in Very Low Power Run mode on Kinetis KL14. The purpose of my circuit is to detect Power fails. If the power falls below some threshold, I choose a slower clock config and enter VLPR mode. When the power rises again, I exit VLPR and restore my original clock config. My back up power comes from a CR2032 battery, so I do need to save as much energy as I can when main power isn't available. The purpose is to keep the RTC running.
The problem is: I can detect the falling edge successfully and enter VLPR, however it looks like in VLPR the CMP0 is not working, because even restoring the power the Analog Comparator output is always 0 and I don't detect the event to exit VLPR!
My comparator is set to low power mode, and the comparison is using as negative input the bandgap voltage. I've already set in Processor Expert the Bandgap voltage to keep available on Low power modes, and also set the CMP0 to run in this condition. What am I missing?
- if I don't enter VLPR, just change my clock configuration to a slower clock, everything works fine
- if I use another event (like some delay, or counter overflow) to reenter RUN mode everything works fine. The problem is with the comparator.
- I've configure Processor Expert to enter VLPR only when asked by the user, and I've disabled the interrupt wakeup (tried it enabled already, without success)
There is a lot of things I've tried and config options I've changed - without success Please ask me if there is some information missing. The specific MCU I'm using is a MKL14Z64VFM4.
Is there any restrictions on CMP0 use when in VLPR mode?
Thank you very much!