Complementary PWM on FRDM-KL25Z using processor expert

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

Complementary PWM on FRDM-KL25Z using processor expert

Contributor III

Hi everyone,

     I have got customer queries on unavailability of complementary mode PWM on KL25Z . So, I thought let me experiment something and post it onto the community.


     The timer module on KL25 is TPM, not FTM!. There are 3 TPMs, TPM0 with 6 channels, TPM1 and TPM2 with 2 channels each. To generate a PWM signal, PWM component can be used. But the PWM bean doesnot provide option to generate complementary PWM. So, we need to configure different channels to get the complementary PWM. Again, there is a limitation for this. PWM component doesn't allow to generate initial polarity high. It says "the inherited component doesnot support this feature". But in run time can set or clear value on the PWM output pin using the SetValue() and ClrValue(). But again the inherited component"TimerUnit_LDD" doesn't support generating SetValue() and ClrValue().

     So, I came to a conclusion 'not to use PWM component' and started using Init_TPM. Using this component, 2 channels are configured to have opposite polarity during initialization. They are configured to have the same period. Deadtime is also inserted by configuring different duty cycle on each channel. But methods are not available since the component only provides the initialization function which is good enough to start . Dynamically if dutycycle needs to be changed, methods have to be written explicitly

    Project and oscilloscope captures are attached for reference.


Original Attachment has been moved to:

Labels (1)
0 Kudos
1 Reply

Specialist V


Note that this is also supported in the uTasker project - see

See specifically the final page - this is compatible for K and KL processors.



0 Kudos