is it possible configure eMIOS0 Channel 6 for 0.1 Hz PWM with 120 MHz clock on S32K312?

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

is it possible configure eMIOS0 Channel 6 for 0.1 Hz PWM with 120 MHz clock on S32K312?

256 Views
Mohmedsohel
Contributor III

I am working on the S32K312 MCU and trying to configure eMIOS0, Channel 6 to generate a PWM signal with 0.1 Hz frequency.

Input clock: 120 MHz

Required output frequency 0.1 Hz (10 seconds period)

Module eMIOS0, Channel 6

Mode OPWFMB
Bus :Internal Bus

Minimum Frequency I can Generate is 0.3 Hz.

I am not sure how to configure the prescaler, period, and counter bus in this case since the frequency is very low compared to the input clock is it possible to generate 0.1Hz?
if yes than please help me to generate. 

Thanks and Regards,
Md.sohel Jakati

Tags (1)
0 Kudos
Reply
1 Reply

228 Views
PetrS
NXP TechSupport
NXP TechSupport

Hi,

a 0.1Hz will not be possible if having 120MHz eMIOS module clock.

eMIOS is clocked from CORE_CLK (up to 120Mhz on S32K312). eMIOS divides this clock by the global prescaler (MCR[GPRE] + 1, Clock Divider Value in Mcl component) and routes the resulting prescaled clock output to the channel internal prescaler (Cn[UCPRE] + 1, Clock prescaler in Pwm component). Thus channel internal counter counts (CORE_CLK/global prescaler/internal prescaler) clock.
Finally assuming channel running in e.g. OPWFMB mode, its PWM frequency is calculated as

PWM frequency = CORE_CLK / global prescaler / internal prescaler / B1

B1 is a value written to channel B register (Period set in PWM component).

Using max values for global prescaler / internal prescaler / Period you got

PWM frequency = 120MHz / 256 / 16 / 65535 = 0.447 Hz

So you will need to divide module clock as well to get lower freq PWMs.

BR, Petr

0 Kudos
Reply
%3CLINGO-SUB%20id%3D%22lingo-sub-2165569%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3Eis%20it%20possible%20configure%20eMIOS0%20Channel%206%20for%200.1%20Hz%20PWM%20with%20120%20MHz%20clock%20on%20S32K312%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2165569%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EI%20am%20working%20on%20the%20%3CSTRONG%3ES32K312%20MCU%3C%2FSTRONG%3E%20and%20trying%20to%20configure%20%3CSTRONG%3EeMIOS0%2C%20Channel%206%3C%2FSTRONG%3E%20to%20generate%20a%20%3CSTRONG%3EPWM%20signal%20with%200.1%20Hz%20frequency%3C%2FSTRONG%3E.%3C%2FP%3E%3CP%3EInput%20clock%3A%20%3CSTRONG%3E120%20MHz%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3ERequired%20output%20frequency%26nbsp%3B%3CSTRONG%3E0.1%20Hz%20(10%20seconds%20period)%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EModule%26nbsp%3B%3CSTRONG%3EeMIOS0%2C%20Channel%206%3CBR%20%2F%3E%3C%2FSTRONG%3E%3C%2FP%3E%3CP%3EMode%20OPWFMB%3CBR%20%2F%3EBus%20%3AInternal%20Bus%3CBR%20%2F%3E%3CBR%20%2F%3EMinimum%20Frequency%20I%20can%20Generate%20is%200.3%20Hz.%3C%2FP%3E%3CP%3EI%20am%20not%20sure%20how%20to%20configure%20the%20prescaler%2C%20period%2C%20and%20counter%20bus%20in%20this%20case%20since%20the%20frequency%20is%20very%20low%20compared%20to%20the%20input%20clock%20is%20it%20possible%20to%20generate%200.1Hz%3F%3CBR%20%2F%3Eif%20yes%20than%20please%20help%20me%20to%20generate.%26nbsp%3B%3C%2FP%3E%3CP%3EThanks%20and%20Regards%2C%3CBR%20%2F%3EMd.sohel%20Jakati%3C%2FP%3E%3C%2FLINGO-BODY%3E%3CLINGO-SUB%20id%3D%22lingo-sub-2165795%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%20translate%3D%22no%22%3ERe%3A%20is%20it%20possible%20configure%20eMIOS0%20Channel%206%20for%200.1%20Hz%20PWM%20with%20120%20MHz%20clock%20on%20S32K312%3F%3C%2FLINGO-SUB%3E%3CLINGO-BODY%20id%3D%22lingo-body-2165795%22%20slang%3D%22en-US%22%20mode%3D%22CREATE%22%3E%3CP%3EHi%2C%3C%2FP%3E%0A%3CP%3Ea%200.1Hz%20will%20not%20be%20possible%20if%20having%20120MHz%20eMIOS%20module%20clock.%3C%2FP%3E%0A%3CP%3EeMIOS%20is%20clocked%20from%20CORE_CLK%20(up%20to%20120Mhz%20on%20S32K312).%20eMIOS%20divides%20this%20clock%20by%20the%20global%20prescaler%20(MCR%5BGPRE%5D%20%2B%201%2C%20Clock%20Divider%20Value%20in%20Mcl%20component)%20and%20routes%20the%20resulting%20prescaled%20clock%20output%20to%20the%20channel%20internal%20prescaler%20(Cn%5BUCPRE%5D%20%2B%201%2C%20Clock%20prescaler%20in%20Pwm%20component).%20Thus%20channel%20internal%20counter%20counts%20(CORE_CLK%2Fglobal%20prescaler%2Finternal%20prescaler)%20clock.%3CBR%20%2F%3EFinally%20assuming%20channel%20running%20in%20e.g.%20OPWFMB%20mode%2C%20its%20PWM%20frequency%20is%20calculated%20as%3C%2FP%3E%0A%3CP%3EPWM%20frequency%20%3D%20CORE_CLK%20%2F%20global%20prescaler%20%2F%20internal%20prescaler%20%2F%20B1%3C%2FP%3E%0A%3CP%3EB1%20is%20a%20value%20written%20to%20channel%20B%20register%20(Period%20set%20in%20PWM%20component).%3C%2FP%3E%0A%3CP%3EUsing%20max%20values%20for%26nbsp%3Bglobal%20prescaler%20%2F%20internal%20prescaler%20%2F%20Period%20you%20got%3CBR%20%2F%3E%3CBR%20%2F%3EPWM%20frequency%20%3D%20120MHz%20%2F%20256%20%2F%2016%20%2F%2065535%20%3D%200.447%20Hz%3C%2FP%3E%0A%3CP%3ESo%20you%20will%20need%20to%20divide%20module%20clock%20as%20well%20to%20get%20lower%20freq%20PWMs.%3C%2FP%3E%0A%3CP%3EBR%2C%20Petr%3C%2FP%3E%3C%2FLINGO-BODY%3E