Generate PWM with 20Hz with K27

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

Generate PWM with 20Hz with K27

429 Views
christophosterl
Contributor I

Hi,

i'm struggeling to generate a pwm with 20Hz and a duty cycle of 50%. Running the clock with 120Mhz, i get a bus clock speed of 60Mhz. Even with the maximum prescaler of 128 I'm far away from 20Hz (cause the compare value would be > 16bit).

When I'm to use the fixed frequeny clock (MCGFFCLK) by setting C1[IREFS] to 1 and set the Clock Source Selection [CLKS] to 2, I do not get any output (when triggering the pin with a scope).

Do you have any hints for me what I've forgotten or could you tell me a different/better way to solve this?

Thanks and best regards!

Labels (1)
0 Kudos
1 Reply

359 Views
Robin_Shen
NXP TechSupport
NXP TechSupport

Hi christophosterloh,

I try to import the ftm_simple_pwm example of MCUXpresso SDK_2.4.1_MK27FN2M0Axxx15.
After modify the configurations using the Peripherals Tool in MCUXpresso IDE, I can get 20Hz PWM at FTM3_CH1 pin on FRDM-K28F board.

Peripherals PWM 20Hz.png

main.png

Best Regards,

Robin

 

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

0 Kudos