Enabling two Complimentary PWM on KL16 with TPM

cancel
Showing results for 
Search instead for 
Did you mean: 

Enabling two Complimentary PWM on KL16 with TPM

360 Views
grushbrush
Contributor I

We have a Kinetis KL16Z128

We have the requirement to run two PWM signals at the same time. 

One of the signal's polarity should start high, and the other starts low. 

1) It seems there is no way to make the initial polarity high. Why is this? 

2) We get an "undefined error" when trying to use PWM_Enable and Disable in our main.c on the Processor Expert PWM components. 

Thank you! michaelgoudey BlackNight

0 Kudos
3 Replies

144 Views
BlackNight
NXP Employee
NXP Employee

I don't have that KL16, but I see it is possible to set the initial polarity here:

pastedImage_1.png

To have the Enable and Disable available, you should turn them on with the context menu:

pastedImage_2.png

Erich

0 Kudos

144 Views
michaelgoudey
NXP Employee
NXP Employee

Hi Ethan,

The KL16 TPM does not support 'high' initial polarity.  Erich has a post on the topic.

   Tutorial: PWM with Processor Expert | MCU on Eclipse 

The problem is the PWM component doesn't support initial high.  See the community link below which applies to FRDM-KL25Z and would apply to KL16 as well.

   https://community.nxp.com/thread/339065 

If you have selected "Enabled in init. code" for the PWM, this is done automatically and you should not enable separately in your code.  If you do, Deinit should be called first.

Regards,
Michael Goudey

0 Kudos

144 Views
grushbrush
Contributor I

We have a motor that has two connections. It requires two PWM signals. The first signal has to start high. Is there any way we can drive this motor? There has got to be, this is a really simple thing. Can you please help us with this one?

Also, is there any way we can start one PWM at a different time than the second PWM? We want to try offsetting the start time for the second PWM in relation to the first PWM.

0 Kudos