How to implement specified cycles of PWM in i.MXRT1050

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

How to implement specified cycles of PWM in i.MXRT1050

212 次查看
jimmyli
Contributor IV

Hi,

      We are evaluating i.MXRT1050 MCU for our motion controller.

      According to the actual demand, we need to implement specified cycles of PWM output without CPU interruption.

      For example, CPU sets PWM parameters and starts PWM output, then the PWM module will output continuous PWM waves and stop when reach the specified cycles automatically. Then, waiting for CPU to  update PWM parameters and restart the PWM module.

      If can, does it have any demo code for us to take a reference ?

     Thanks very much.

标签 (3)
0 项奖励
1 回复

160 次查看
_Leo_
NXP TechSupport
NXP TechSupport

Hi,

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

With the eFlexPWM module is possible to generate interrupts with the generation of PWM signals when VAL2 and/or VAL3 compare values are meet in channel A (which correspond to the turn-on/off edges of the PWM signal), the same for VAL4 and VAL5 in channel B.

And in said interrupt, you can keep track of the periods required. But this way will require CPU interruption.

On the other hand, in order to reduce the CPU intervention you can perform with other submodule the E-Capture feature to count rise and/or fall edges of the PWM signal. This feature can be used to simply generate an interrupt after "n" events have been counted, and in such interrupt you can update PWM parameters and restart the PWM module. Just take into account that it is limited to count up to 256 edge events and you will need to route externally the PWM signal to the input capture pin.

Hope it helps you.

Have a nice day!

0 项奖励