s32k312 emios pwm period

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

s32k312 emios pwm period

Jump to solution
1,536 Views
fengba_360
Contributor III

我想设置 s32k312 emios PWM 周期。你能帮我检查一下我使用的公式是否正确吗?例如,如果我想将 10ms 设置为一个周期, 下图中的周期 字段是否等于 coreclock / DIV / 100 ?

微信图片_20240808235953.png

0 Kudos
Reply
1 Solution
1,516 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @fengba_360 

EMIOS module setting in ConfigTools are named as Clock_Divider Value, Master_Bus Prescaler, and Master BusAlternate Prescaler. How to know their relationship and their usage? When Emios is used as PWM (OPWMB, OPWFMB, ...), it divides the CORE_CLK clock by the Clock Divider Value (global prescaler (MCR[GPRE] + 1)) and routes the resulting prescaled clock output to the Master Bus Prescaler (channel internal prescaler (Cn[UCPRE] + 1)). Thus channel internal counter counts (CORE_CLK/global prescaler/internal prescaler) clock.

For example: assuming the channel running in for example OPWFMB mode, its PWM frequency is calculated as: 

PWM frequency = CORE_CLK / global prescaler / internal prescaler / (B1+1)

Where B1 is the period ticks. 

With this information, if we want a PWM of 1KHz and the clock frequency of our eMIOS is 48Mhz and we define the global prescaler and the internal prescaler equal to 1, with this we would only need one parameter to obtain our 1KHz signal, which is the period (ticks) which we can obtain by solving the formula given above:

Period = CORE_CLK/1KHz, giving 48000.

 

BR, VaneB

View solution in original post

0 Kudos
Reply
1 Reply
1,517 Views
VaneB
NXP TechSupport
NXP TechSupport

Hi @fengba_360 

EMIOS module setting in ConfigTools are named as Clock_Divider Value, Master_Bus Prescaler, and Master BusAlternate Prescaler. How to know their relationship and their usage? When Emios is used as PWM (OPWMB, OPWFMB, ...), it divides the CORE_CLK clock by the Clock Divider Value (global prescaler (MCR[GPRE] + 1)) and routes the resulting prescaled clock output to the Master Bus Prescaler (channel internal prescaler (Cn[UCPRE] + 1)). Thus channel internal counter counts (CORE_CLK/global prescaler/internal prescaler) clock.

For example: assuming the channel running in for example OPWFMB mode, its PWM frequency is calculated as: 

PWM frequency = CORE_CLK / global prescaler / internal prescaler / (B1+1)

Where B1 is the period ticks. 

With this information, if we want a PWM of 1KHz and the clock frequency of our eMIOS is 48Mhz and we define the global prescaler and the internal prescaler equal to 1, with this we would only need one parameter to obtain our 1KHz signal, which is the period (ticks) which we can obtain by solving the formula given above:

Period = CORE_CLK/1KHz, giving 48000.

 

BR, VaneB

0 Kudos
Reply