PWM period

キャンセル
次の結果を表示 
表示  限定  | 次の代わりに検索 
もしかして: 
1,388件の閲覧回数
Ajul
Contributor I

Hi

I was working on NXP s32k324 controller .

Need to run a PWM at 35Hz and 125Hz .

In S32k data sheet It is mentioned like The frequency range is b/w 400Hz to 20Khz . Is it possible to run the PWM at 35 and 125 Hz ? If yes could you please tell me How to achieve this.

 

Regards

Ajul

0 件の賞賛
返信
1 解決策
1,376件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it is possible.
eMIOS module is clocked from CORE_CLK (up to 160Mhz). eMIOS divides this clock by the global prescaler (MCR[GPRE] + 1) and routes the resulting prescaled clock output to the channel internal prescaler (Cn[UCPRE] + 1). Thus channel internal counter counts (CORE_CLK/global prescaler/internal prescaler) clock. Channel offers also extended prescaler.
Channels Y/H do not have internal counters so must select some counter bus (global or local) which are be running from. The MCB mode is used to run on channels that serves as counter buses (ch 23,22,0,8,16).
Period in MCB mode is given as An[A]*global prescaler*internal prescaler/CORE_CLK.
Similar equation is also valid for modes generating PWM signal directly, like OPWFMB.
Global prescaler can range from 1 to 256. Internal prescaler can range from 1 to 4.
Register An is 24bit wide. So you can easily calculate longest PWM period for used Core clock, prescalers and An value.

BR, Petr

元の投稿で解決策を見る

0 件の賞賛
返信
6 返答(返信)
1,367件の閲覧回数
Ajul
Contributor I

Hi,Petr

 

Can you please share the EB configuration for this ?

It would be help full for better understand

 

Regards

Ajul

0 件の賞賛
返信
1,367件の閲覧回数
Ajul
Contributor I

Hi

Right Now Iam using core clock (160MHz) as input to the PWM.

Ajul_0-1688125572942.png

 

 

0 件の賞賛
返信
1,323件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

as module clock is selected then global prescaler has no effect for this channel and just local one is taken into account for this OPWFMB mode. So for 160MHz module clock and prescaler of 16, to have 35Hz generated use 285714 for Period setting.

BR, Petr

0 件の賞賛
返信
1,311件の閲覧回数
Ajul
Contributor I

Hi

How we can give period value as   285714 because the maximum value we can give is 65534 in the configuration.

 

Default period value of Pwm channel at initialization.
The measure unit are in ticks (if Period In Ticks checked), or in seconds (if unchecked)
Valid range: [0, 65534]
<note>

0 件の賞賛
返信
1,305件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, you are right, there is 16bit counter, 24bit counter is on different device.
Then you need to use global divider as well. As prescaler source select EMIOS_PWM_IP_PS_SRC_PRESCALED_CLOCK. Within MCL component you can configure eMIOS global divider. Then calculate period value for global and internal prescalers.

BR, Petr 

0 件の賞賛
返信
1,377件の閲覧回数
PetrS
NXP TechSupport
NXP TechSupport

Hi,

yes, it is possible.
eMIOS module is clocked from CORE_CLK (up to 160Mhz). eMIOS divides this clock by the global prescaler (MCR[GPRE] + 1) and routes the resulting prescaled clock output to the channel internal prescaler (Cn[UCPRE] + 1). Thus channel internal counter counts (CORE_CLK/global prescaler/internal prescaler) clock. Channel offers also extended prescaler.
Channels Y/H do not have internal counters so must select some counter bus (global or local) which are be running from. The MCB mode is used to run on channels that serves as counter buses (ch 23,22,0,8,16).
Period in MCB mode is given as An[A]*global prescaler*internal prescaler/CORE_CLK.
Similar equation is also valid for modes generating PWM signal directly, like OPWFMB.
Global prescaler can range from 1 to 256. Internal prescaler can range from 1 to 4.
Register An is 24bit wide. So you can easily calculate longest PWM period for used Core clock, prescalers and An value.

BR, Petr

0 件の賞賛
返信