PWM Frequency in OPWFMB mode

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

PWM Frequency in OPWFMB mode

Jump to solution
1,483 Views
Kiran_Gowda
Contributor I

Hi All,

I am using S32K358 board and have configured 4 PWM Output Channel in OPWFMB mode with the same clock pre-scaler and configurable Period (Variable Period) for all the PWM output channels using EB tresos  listed below:

 EMIOS_0_CH_3 = MSCR 130 = GPIO 130 = PTE2  
 EMIOS_0_CH_1 = MSCR 45 = GPIO 45 = PTB13 
 EMIOS_0_CH_4 = MSCR 48 = GPIO 48 = PTB16 
 EMIOS_0_CH_2 = MSCR 46 = GPIO 46 = PTB14 

Saw the below formula from one of the queries raised in community,

PWM frequency = CORE_CLK / global pre-scaler / internal pre-scaler / (B1+1)

"B1 is a value written to channel B register."

But as per this calculation, I was not getting the output frequency and is mismatching with the actual generated signal (verified its frequency through oscilloscope).

Below are the values that I set in PWM module:

CORE_CLK = 240MHz | OPWFMB Mode | 

Global Pre-scaler: 44 (Clock Divider value set in MCL module - EMIOS0_CH23)

Internal Pre-scaler (Clock prescaler): 2 

Kiran_Gowda_6-1682441177152.png

Kiran_Gowda_7-1682441223765.png

 

Kiran_Gowda_8-1682441279699.pngKiran_Gowda_9-1682441293951.png

Kiran_Gowda_10-1682441327406.png

As per the formula, I got 340.8664Hz (240MHz/ (44*2*(8000+1)), but what I got from the oscilloscope was having 3.67kHz for 50% duty cycle. (Reg-A value: 4000h & Reg-B value: 8000h).

Kindly help me to understand, how the PWM frequency being calculated.

Thank you.

 

0 Kudos
Reply
1 Solution
1,435 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

The formula you found in the post is correct. What I can infer from your configuration is that the Prescaler Clock Source (UCPRECLK) should be set to EMIOS_PWM_IP_PS_SRC_PRESCALED_CLOCK so that the eMIOS channel clock is CORE_CLK divided by the Global Prescaler (GPRE).

Hope it helps you.

Have a nice day!

View solution in original post

0 Kudos
Reply
3 Replies
1,422 Views
Kiran_Gowda
Contributor I

Hi, It worked after configuring the Prescaler Clock Source (UCPRECLK) to EMIOS_PWM_IP_PS_SRC_PRESCALED_CLOCK .

Thank you for your support.

0 Kudos
Reply
628 Views
ESAKKI_MBD
Contributor II
Hello kiran,
well, we are working for generating PWM pulses with variable period and variable duty cycle with OPWFMB in S32K3and S32DS. Since we can be able to generate pulses with this mode, but the period and duty cycle is not varying.

can you help me with OPWFMB mode?
0 Kudos
Reply
1,436 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

Thank you so much for your interest in our products and for using our community.

The formula you found in the post is correct. What I can infer from your configuration is that the Prescaler Clock Source (UCPRECLK) should be set to EMIOS_PWM_IP_PS_SRC_PRESCALED_CLOCK so that the eMIOS channel clock is CORE_CLK divided by the Global Prescaler (GPRE).

Hope it helps you.

Have a nice day!

0 Kudos
Reply