AnsweredAssumed Answered

simple PWM example for KL1x ?

Question asked by John Beale on Oct 30, 2015
Latest reply on Nov 2, 2015 by xiangjun.rong

New to Kinetis. I am using KDS 3.0.0 and KSDK 1.2.0, with Processor Expert 3.0.1. My target is in the MKL1x family.

 

So far I can name and configure output pins, and control them with GPIO_DRV_SetPinOutput() and GPIO_DRV_ClearPinOutput().  I am hoping there is something at a similar level for PWM, so that for example, after using TPM0:Init_TPM in Processor Expert to configure the timer (setting clock source, modulo count, pin output for each channel, etc.) , there is some call like PWM_SetDuty(timer, channel, value) to set the duty cycle. Can I do that?

 

The only Kinetis code examples I have found online do not use Processor Expert, or use some (older?) version that apparently has a PWM module.  This page Tutorial: PWM with Processor Expert | MCU on Eclipse   shows PE has a PWM module, but nothing with "PWM" in the name appears in PE for me.

 

I found this: Example code on how to configure the TPM as PWM in the FRDM-KL25 board

which uses set_TPM_CnV(TPM1_BASE_PTR, 0, DUTY_CYCLE); but is this function documented anywhere? Google says there is exactly one web page online containing "set_TPM_CnV" and it's in Czech...  Any assistance would be welcomed!  Thanks.

Outcomes