How can I control PWM at a specified frequency?

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

How can I control PWM at a specified frequency?

744 Views
T2
Contributor III

Hello,

I am studying how to use FlexIO PWM in the SDK sample project "flexio_pwm".
I am using "TWR-KE18F" board.
When I tried to run, it was not working according to the specified frequency. (See the figure below.)

pastedImage_1.png

                                                                                                   ↑Frequency specified in        ↑Actual frequency measured    
                                                                                                     code (flexio_pwm.c)              with Memory high coder.

I imagined that the frequency specified in the code would be the PWM control frequency.    
    DEMO_FLEXIO_FREQUENCY == PWM actual frequency
However, the actual frequency was not same.    
    100 Hz ≠ 800 Hz

Why are the frequencies not matching?
How can I control PWM at a specified frequency?

Best regards.

Labels (1)
Tags (3)
0 Kudos
3 Replies

645 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi Toshiyuki,

SOSC clock comes from on board 8M crystal. It is not 1M.

pastedImage_1.png

Regards,

Jing

0 Kudos

645 Views
T2
Contributor III

Hi Jing,

Thank you for your quick reply.
Your advice was very helpful.

I have a question about the SOSC clock.
The SOSC clock settings on the MCUXpresso IDE are as follow.
It looks like 1M is set.

Is this 1M invalid?

Is there anything else to set?
OR
Only 8M can be set for SOSC?

pastedImage_1.png

Best regards.

0 Kudos

645 Views
jingpan
NXP TechSupport
NXP TechSupport

Hi,

SOSC clock is from XTAL. The range of external oscillator is from 32k to 40M. Please check the table 42 in datasheet.

pastedImage_1.png

You can modify this value in MCUXpresso CFG Tools.

Regards,

Jing

0 Kudos