MKL17Z256 TPM with OSCERCLK

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

MKL17Z256 TPM with OSCERCLK

611 Views
aarondiamant
Contributor I
  • I am using a 32.768 kHz ABRACON ABS25-32.768KHZ-T crystal (same as the FRDM-KL03Z) connected to pins EXTAL0 / XTAL0
  • The crystal  has a CL of 12.5pF. I am configuring a load capacitance of 21pF
  • TPM is configured for OSCERCLK clock
  • When I execute the application in KDS with the PEMicro debugger I have no problem generating the proper PWM output
  • If I execute the flashed application with no debugger there is no PWM signal generated

 

I assume there is some kind of initialization being done while executing with the debugger that Processor Expert or myself are not doing. If the TPM is clocked with MCGIRCLK there is no problem while debugging or stand-alone.

Thanks!

0 Kudos
Reply
1 Reply

532 Views
aarondiamant
Contributor I

It is working now.

The problem was that Cpu.c calls TPM_DRV_PwmStart(tpmTmr1_IDX, &tpmTmr1_ChnConfig0, 0U); and I was calling it again in main.c

When debugging, by default execution stops in main.c at PE_low_level_init();. Apparently if there is enough time between calls to PM_DRV_PwmStart(tpmTmr1_IDX, &tpmTmr1_ChnConfig0, 0U); there is "no problem". So when executing from flash with no debugger, the 2 calls happen very quickly and the TPM doesn't work. Removing the call from main.c solves the problem.