PWM with processor expert KL43z?

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

PWM with processor expert KL43z?

Jump to solution
808 Views
christopherira
Contributor III

Hi,

 

I'm using frdm-kl43z and processor expert. I'm trying to set up a simple pwm output for pin E24. I'm using component fsl_tpm.

131440_131440.pngpastedImage_1.png

 

I've configured the component as follows:

131439_131439.pngpastedImage_0.png

132017_132017.pngpastedImage_3.png

 

Not sure how to set the duty cycle, but I initialized the frequency as 250 kHz:

132018_132018.pngpastedImage_4.png

 

And just trying to initialize the output, I wrote this code:

132019_132019.pngpastedImage_5.png

Is this correct?

 

Thanks!

Labels (1)
0 Kudos
1 Solution
554 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Christopher,

- About the duty cycle , you  can configure it at here:

pastedImage_0.png

- About the initialize code , after you generated the code , you  can find the initialize code at here :

pastedImage_1.png

you needn't write the initialize code by yourself .

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

View solution in original post

0 Kudos
3 Replies
555 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Christopher,

- About the duty cycle , you  can configure it at here:

pastedImage_0.png

- About the initialize code , after you generated the code , you  can find the initialize code at here :

pastedImage_1.png

you needn't write the initialize code by yourself .

Hope it helps


Have a great day,
Alice Yang

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos
555 Views
christopherira
Contributor III

That's very helpful thank you. Additionally, how would I tell the processor to send the output or not send the output? Do I do that through a normal fsl_gpio?

Thanks!

Chris

0 Kudos
555 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Chris,

You don't need add fsl_gpio component.

In the fsl_tpm  component , we can configure the channel to out put PWM:

pastedImage_0.png

If you select "Auto initialization " , after generate code , then run the project , it can out put PWM.

And if do not select this option , you can initialize and start it by yourself use the methods , and use the method

of "TPM_DRV_Deinit"  shouts down it .

I recommend you first  select the "Auto initialization " , then run the project , check whether can out put the signal you need .

Hope it helps

Alice

0 Kudos