too much PWM interrupt hitting in imxrt1062

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

too much PWM interrupt hitting in imxrt1062

327 Views
Ananth96
Contributor I

I am configuring the pwm interrupt for counter reload.

PWM_EnableInterrupts(PWM2, kPWM_Module_3, kPWM_ReloadInterruptEnable);

I expect an interrupt every time the counter reloads so that i can count the number of pwm pulses output by the module.

My pwm freq is 400hz and i am getting interrupt every 2.5 ms.

But my overall system got slowed because of frequent interrupt. How to get interrupt every specific number of pulses so that the frequency of interrupt can be reduced to 10ms or 20 ms.

0 Kudos
3 Replies

278 Views
Ananth96
Contributor I

Thanks , I understood the solution you mentioned.

But the issue is I cannot face a hardware change. In 1st solution, Is there any way to internally connect the output of one pwm channel to another to perform e-capture.

Also in 2nd solution, the hw is already set for pwm out of submodule3 and I can only find AUX_CLK_submod0 to clocking another submodule. Here also hw change seems to be required.

Is there any way to make use of XBAR here for internal connection and proceed with the mentioned solutions without hw change.

0 Kudos

267 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi again,

I must admit that the best solution to your need is to use another channel that perform E-Capture logic, even if it involves a very little HW modification.

But maybe as you mention XBAR could help us. At the beginning I discard this option because the only output signals from eFlexPWM that can be route with XBAR are PWM[n]_OUT_TRIG0 and PWM[n]_OUT_TRIG1, sorry for that.

However the Output Trigger Control Register allows to route the PWMx output to the PWM_OUT_TRIGx port.

_Leo__0-1706659890656.png

Having said that you can route this signal (by means of XBAR1) to the EXT_CLK of another PWM Submodule that you have available. In this other Submodule you can configure the PWM interrupt for counter reload. And with the Prescaler (CTRL[PRSC]) you can set the frequency of interrupts.

_Leo__1-1706659898938.png

But I must insist again that the E-Capture logic way is the best one.

Hope it helps you.

Have a nice day!

0 Kudos

297 Views
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

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

To be honest your requirement is a little strange because you want to count the reloads but you do not want an interrupt in every reload.

What come to my mind to archive your need are the following two ways:

The first one is to route externally your PWM signal of 400Hz to another channel that perform E-Capture logic (73.3.3.10 E-Capture section of reference manual) where you can generate an interrupt after "n" events have been counted, the counter value is specified by the user.

The second one is based in the Clocking Block Diagram:

_Leo__0-1706303803993.png

Use a PWM channel from Submodule0 to generate the PWM signal of 400Hz. And at the same time use the AUX_CLK_submod0 to clocking another Submodule. In this other Submodule you can configure the PWM interrupt for counter reload. And with the prescaler CTRL[PRSC] you can set the frequency of interrupts.

Hope it helps you.

Have a nice day!

0 Kudos