We use LLWU to wake up the MCU. There are different sources to wake up: CMP, gpio and LPTMR. When we wake up by CMP or gpio, we have to get a value from LPTMR0_CNR to find sleep time. But it is always 0. Is there any recomendations to get LPTMR0_CNR after VLLS1?
Solved! Go to Solution.
The problem was in SIM_SCGC5. We didn't enable LPTMR bit before reading CNR.
The problem was in SIM_SCGC5. We didn't enable LPTMR bit before reading CNR.
Hello Tester,
About the register of "LPTMR_CNR" :
- The CNR is reset when the LPTMR is disabled or if the counter register overflows. If
CSR[TFC] is cleared, then the CNR is also reset whenever CSR[TCF] is set.
- And On each read of the CNR, software must first write to the CNR with any value.
About the detail description , please refer to KL26P121M48SF4RM.pdf -> 33.4.5 LPTMR counter .
If you have mentioned this , it still have question , could you please show your code clearly ?
Hope it helps
Have a great day,
Alice
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------