Is there a way to change PWM period through Processor Expert Interface?

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

Is there a way to change PWM period through Processor Expert Interface?

2,485 Views
lfschrickte
Contributor IV

Hi,

I've just figured out I can't change the PWM Component Period during program execution through Processor Expert functions. Looking at the Timer Unit Component associated I realized the functions to change the timer period are "blocked" either, as this component is controlled by the PWM.

So, as I don't want to study the underlying PWM code (at least not right now), is there an easy way to change the PWM period? Maybe through some combination of PDD functions..

I'm using CodeWarrior 10.4 with Processor Expert. My MCU is a Kinetis L MKL14Z64VFM4.

Thank you very much, any help will be appreciated!

Luiz Fernando

Labels (1)
6 Replies

806 Views
BlackNight
NXP Employee
NXP Employee

Hi Luiz,

for non-Kinetis parts I'm using the PPG (Programmable Pulse Generation) component, but it looks this one is not available for Kinetis :-(

I'm wondering why.

Erich

806 Views
anthony_huereca
NXP Employee
NXP Employee

Hi Luiz,

  Take a look at this tutorial: Tutorial: PWM with Processor Expert | MCU on Eclipse

  Let us know if that helps.

-Anthony

0 Kudos

806 Views
lfschrickte
Contributor IV

Hi Anthony,

I've read this before, but as you can see it only explains how to set the initial period of the PWM, and not how to change it during program execution.

Is also mention the functions to change the duty cycle, but it is not enough for me.

I've a setup in which I need to have a way to change the buzzer frequency dinamically as I don't know which kind of buzzer will be installed (may have different product versions).

Thank you anyway!

Luiz Fernando

0 Kudos

806 Views
BlackNight
NXP Employee
NXP Employee

Hi Luiz,

what is the frequency of the PWM you need? Have you considered using a software PWM generation?

Erich

0 Kudos

806 Views
lfschrickte
Contributor IV

Hi Erich,

Yes, I've considered setting up a timer to use the interrupts + IO as a PWM, however my application already has some critical interrupts being served and I don't want to have one more interrupt there for something like this. Indeed it is kind of frustrating that I can't set a PWM frequency in software because this looks so basic!

I'll hold this function in my app for now (switching the PWM frequency) as it is not mandatory. In the future I'll probably use the PDD functions and maybe some direct register manipulation to configure the PWM by myself.

Thank you!

Luiz Fernando

0 Kudos

806 Views
BlackNight
NXP Employee
NXP Employee

Yes, that tutorial shows how to set up the PWM period in the component. But at runtime it allows only changing the duty period/percent, and not the frequency of the PWM which what would be needed here.

Erich

0 Kudos