I Want Generate 20Hz PWM?

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

I Want Generate 20Hz PWM?

1,381 Views
velmurugan2educ
Contributor I

Dear sir/madam,

       i need 20Hz PWM Generate using FTM-> Single PWM Example , i simply change 24000U to 20U and Compile and Debug, then Measure PWM Frequency is 83.33Hz, Where is Change any Setting or any Mode

 Kindly Help me

Regards & Thanks,

   V. Velmurugan

0 Kudos
8 Replies

1,095 Views
gunnarbohlen
Contributor II

Hello,

the formula is correct, but you have to make sure that you clock source matches the expected measuring range.

e.g. if your timer is 16bit, you need to set the clock source to a frequency that you have at most 65535 timer ticks per revolution. Otherwise you have to check for timer overruns and add up these overruns (sometimes tricky in case the overrun happens between 2nd irq event and code execution for this event)

Another point: If it is possible that you system suddenly stops, and all you do is waiting for an interrupt, you might never get the second interrupt and therefor never notice the stop condition. In this case you should have a timer interrupt that creates an event at the slowest rpm that you want to measure. (e.g. if you want to measure 60 rpm this time is set slightly larger than to 1sec., for min. rpm=600 timer woud be set to ~100ms.

0 Kudos

1,095 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello  V. Velmurugan,

Please tell use which part number you used.

And which code do you used, SDK ?

BR

Alice

0 Kudos

1,095 Views
velmurugan2educ
Contributor I

Hi Alice_Yang,

            I'm using MK22FN512VLL12 Processor.

Thanks

0 Kudos

1,095 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hello Velmurugan V,

20Hz frequency is too low .

As to the PWM frequency = PWM clock source (or FTM clock source) / MOD,  

PWM frequency * MOD = PWM clock source

the maximum of MOD is 0xFFFF,  please check the FTM clock source in your code.

So even if MOD configure to 0xFFFF, if PWM frequency = 20hz,  then PWM CLOCK source should almost

less than 2MHz.

Hope it helps,


Have a great day,
TIC

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

0 Kudos

1,095 Views
velmurugan2educ
Contributor I

Hi  Alice_Yang,

         Thanks, it is Working Fine.

0 Kudos

1,095 Views
Alice_Yang
NXP TechSupport
NXP TechSupport

Hi,Velmurugan,

Ok, welcome!


Have a great day,
TIC

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

0 Kudos

1,095 Views
velmurugan2educ
Contributor I

Hi Alice_Yang,

          i need Find RPM, 

          i'm using one revolution how time tick taken and calculate RPM

          My Method 

              Home Pin Interrupt Occur First time ->  Load Timer Value & Start timer.

              Home Pin Interrupt Occur Next Time -> Current Timer Value Read & Stop Timer.

          My Formula

           Calc_RPM = ( 60.0* (Timer Clock Source / (Load Timer tick value - Current Timer tick value )))

What is My method is wrong and Where is corrected My method 

Please Help Me!
 

Advance Thanks,

Velmurugan  V

0 Kudos

1,094 Views
velmurugan2educ
Contributor I

Hi Alice_Yang,

       Thanks For your Reply, i will try and Reply.

Thanks & Regards,

Velmurugan V

0 Kudos