I'm using a KL03 and the default mode of operation is using the HIRC 48MHz clock which is also used to clock the 2 TPM channels on module 0. When I go into VLPS, I want to keep TPM running and so need to enable the LIRC 8MHz clock and switch the TPM clock source.
Is there any recommended sequence of how this should be done? I'm having problems making it work.
Any help is greatly appreciated.
Hi Will X,
I think you can use the MCGIRCLK as the TPM diretly, just like the following picture:
Then, 24.3.4 Enable LIRC in Stop mode
In Stop mode, HIRC is disabled to save power. For LIRC, by default it is disabled as
well. To enable LIRC in Stop mode, write 1b to MCG_C1[IREFSTEN] and
MCG_C1[IRCLKEN] before entering Stop mode.
LIRC can still work on the VLPS mode after you enable it, so you can select it as the TPM source directly, then you don't need to change the clock source before you enter in the VLPS mode.
If you don't use the LIRC clock as the TPM clock source, you should switch the clock to LIRC then reconfigure your TPM module before you enter the VLPS mode. After wake up from the VLPS mode, if you want to still use the HIRC, you still need to disable the TPM modue, then switch the clock source and reconfigure your TPM module.
Wish it helps you!
If you still have question, please contact with me!
Have a great day,
Jingjing
-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------