Hello everyone!
Me and my team are working on a high power battery charger (OBC) and we would require a 100 kHz hardware PWM. Based on the S32K344 datasheet, only 20 kHz and 400 Hz is mentioned.
Is it possible to adjust the hardware PWM's frequency to 100 kHz or other arbitrary frequencies? If so, how?
Thank you in advance!
Greetings,
Peter
Solved! Go to Solution.
Hi,
yes 100Khz frequency is possible.
eMIOS module is available for PWM signal generating, using PWM modes (OPWMB, OPWFMB, ...)
eMIOS 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.
Finally assuming channel running in e.g. OPWFMB mode, its PWM frequency is calculated as
PWM frequency = CORE_CLK / global prescaler / internal prescaler / (B1+1)
B1 is a value written to channel B register.
Refer to device RM for description of eMIOS modes.
BR, Petr
Hi,
yes 100Khz frequency is possible.
eMIOS module is available for PWM signal generating, using PWM modes (OPWMB, OPWFMB, ...)
eMIOS 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.
Finally assuming channel running in e.g. OPWFMB mode, its PWM frequency is calculated as
PWM frequency = CORE_CLK / global prescaler / internal prescaler / (B1+1)
B1 is a value written to channel B register.
Refer to device RM for description of eMIOS modes.
BR, Petr
Hi @PetrS
How we could define B1 in RTD
Just a quick question, just checked the reference manual now, and it mentions 72 standard channels for emios, does this mean that we can have 72 individual PWM outputs in theory?
Hi,
unfortunately not, you need to consider possible modes implemented in each channel, which is stated in Chip-specific eMIOS information chapter of the RM. Some channels does not include internal counter so must run out of other counter bases (global or local), which must be generated by channel running in MCB/MC modes. There are 5 counter busses, for those channels not having internal counter, so this also limits number of channels with individual PWM frequency.
BR, Petr
Thank you very much Petr!