Timer/PWM (TPM) - K66 - Code is not working...

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

Timer/PWM (TPM) - K66 - Code is not working...

1,831 Views
BARN_RD
Contributor I

Hi Community:

I am very new to the NXP / K66 processor.  I having all sorts of fun trying to get up to speed on this.

I'm working on a PWM function that I can not seem to get working.

Attached is very simple PWM Initialization code.   

Once the code has initialized the PWM module, I'm expecting to TPM1_COUNT.COUNT to increment.

It is not. 

I'm not seeing an LED brighten or dim either and yet, I know that I can turn the LED on and off.

Two questions:

1. Would you be so kind as to taking a look at the attachment and giving me some ideas (with an explanation) about what is wrong?  

2. What is the best way to Turn TPM On and Off?

Thanks!

 

0 Kudos
3 Replies

1,821 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi BARN_RD,

  After checking your code, I find you enable the TPM before you complete the TPM register initialization.

   Normally, we disable the TPM clock at first, TPM_SC[CMOD]=0, then configure all the related TPM register, then enable the TPM clock, TPM_SC[CMOD]=1.

  If you are new to kinetis, I highly suggest you refer to the MK66 SDK code, which can be downloaded from this link:

https://mcuxpresso.nxp.com/

  Choose the board as FRDM-K66, then generate the code and download it.

You will find the TPM code in folder:

SDK_2.7.0_FRDM-K66F\boards\frdmk66f\driver_examples\tpm

 

Wish it helps you!

If you still have questions about it, please kindly let me know.

Best Regards,

Kerry

0 Kudos

1,793 Views
BARN_RD
Contributor I

Hi:

Thank you for the input on disabling / enabling the clock.

I also had a misconfiguration on the TPM1_CONF register.

Things are looking much better.

Please close the ticket.

 

 

0 Kudos

1,787 Views
kerryzhou
NXP TechSupport
NXP TechSupport

Hi BARN_RD,

     Thanks for your updated information.

     Please help to mark the correct answer to close this question post.

    Any new questions in the future, welcome to create the new case.

Wish it helps you!

If you still have questions about it, please kindly let me know!

Best Regards,

Kerry

-------------------------------------------------------------------------------

Note:

- If this post answers your question, please click the "Mark Correct" button. Thank you!

 

- We are following threads for 7 weeks after the last post, later replies are ignored

Please open a new thread and refer to the closed one, if you have a related question at a later point in time.

-----------------------------------------------------------------------------

0 Kudos