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
Solved! Go to Solution.
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
Hi,Petr
Can you please share the EB configuration for this ?
It would be help full for better understand
Regards
Ajul
Hi
Right Now Iam using core clock (160MHz) as input to the PWM.
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
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>
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
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