Start and stop of a PWM output by signals

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

Start and stop of a PWM output by signals

1,637 次查看
whitzler
Contributor I

I use the PWM's on a MXRT1064-EVK Board under Micrium-OS.
For a project with strict timing constraints I have to start and
stop the PWM's by hardware signals.
The cycle time of the PWM's differ, but can be from 50 ns to 5 us.
I use center aligned mode on channel A and channel B of PWM1.
A digital signal from outside the RT1064 processor should be used
to start the PWM.
After one cycle it should stop automatically.
Can this be achieved with the RT1064 ?

0 项奖励
回复
3 回复数

1,605 次查看
whitzler
Contributor I

Dear Omar Anguiano

Thank you for your suggestions. That helps me along.
Because of my timing constraints, what is the typical hardware interrupt delay on the MXRT1064 processor ?
When I start the PWM signal inside my interrrupt service routine,
I get a delay of ca. 20 us until my PWM signal becomes activ.
Can this delay be minimised to let's say to 4 us ?

Best regards

Wilhelm

0 项奖励
回复

1,594 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

The cortex M7 has a typical interrupt latency of 10-12 cycles. You can find more detailed information about interruptions and how to measure the latency in this document: https://www.nxp.com/docs/en/application-note/AN12078.pdf

If you have more questions do not hesitate to ask me.
Best regards,
Omar

0 项奖励
回复

1,623 次查看
Omar_Anguiano
NXP TechSupport
NXP TechSupport

Hello
Hope you are well.

Using a fault will be helpful for this; A fault condition can result in the PWM output being tristated, forced to a logic 1, or forced to a logic 0 depending on the values programmed into the OCTRL[PWMxFS] fields.
This fault condition only disables the output but the timer continues running.
 
The timer is stopped by writing to MCTRL register, you can do this with the PWM_StopTimer() function.
To do this by the hardware you can connect your external signal to the GPIO so when the GPIO receives that signal, the function can be called.
I suggest you do this by interruptions otherwise the GPIO will be polling consuming CPU resources.

If you have more questions do not hesitate to ask me.
Best regards,
Omar

0 项奖励
回复