
I am programming a kl25z on a Freescale FRDM-KL25Z board using assembly language. My IDE is CodeWarrior 10.7. My program is a simple LED-blink program. I use the TPM output compare interrupt to schedule the blinks.
The program works correctly when I connect TPM to the FLL. The program fails to work when I connect TPM to MCGIRCLK. The only differences between the two versions of the program are in SIM_SOPT2 TPMSRC (which selects the TPM clock) and in TPM0_SC PS (the TPM clock prescaler).
When I write corresponding C-programs with help of the Processor Expert, the C- program works both when TPM is connected to FLL and when TPM is connected to MCGIRCLK.
Why won't my assembly-language program work with TPM connected to MCGIRCLK?
已解决! 转到解答。

Timothy
Load the code that works, let if run, then pause it and do a screen shot of all relevant registers.
Then load your code and do the same.
You should be able to see a difference in a register somewhere showing what is missing to get it working the same way.
Regards
Mark

Hi Timothy
You probably need to enable the MCGIRCLK clock gate with IRCLKEN in register MCG_C1.
To get 4MHz MCGIRCLK remove its divider to get 4MHz clock (MCG_S = 0) and select 4MHz instead of 32kHz with IRCS in register MCG_C2.
Regards
Mark
Kinetis: http://www.utasker.com/kinetis.html
Kinetis KL25, KL26, KL27, KL28, KL82, KL43, KL46
- http://http://www.utasker.com/kinetis/FRDM-KL25Z.html
- http://www.utasker.com/kinetis/TWR-KL25Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL26Z.html
- http://www.utasker.com/kinetis/TEENSY_LC.html
- http://www.utasker.com/kinetis/FRDM-KL27Z.html
- http://www.utasker.com/kinetis/Capuccino-KL27.html
- http://www.utasker.com/kinetis/FRDM-KL28Z.html
- http://www.utasker.com/kinetis/FRDM-KL82Z.html
- http://www.utasker.com/kinetis/FRDM-KL43Z.html
- http://www.utasker.com/kinetis/TWR-KL43Z48M.html
- http://www.utasker.com/kinetis/FRDM-KL46Z.html
- http://www.utasker.com/kinetis/TWR-KL46Z48M.html
Build with: CW10.x, KDS, MCUXpresso, IAR, Keil, Greenhills, Crossworks, CooCox, Atollic, S32 Design Studio, GNU Make and Visual Studio
HW timers: http://www.utasker.com/docs/uTasker/uTaskerHWTimers.PDF
Free Open Source solution: https://github.com/uTasker/uTasker-Kinetis
Working project in 15 minutes video: https://youtu.be/K8ScSgpgQ6M
For better, faster, cheaper product developments consider the uTasker developer's version, professional Kinetis support, one-on-one training and complete fast-track project solutions to set you apart from the herd : http://www.utasker.com/support.html

Timothy
Load the code that works, let if run, then pause it and do a screen shot of all relevant registers.
Then load your code and do the same.
You should be able to see a difference in a register somewhere showing what is missing to get it working the same way.
Regards
Mark
