PWM duty cycle measurement on RT105x

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

PWM duty cycle measurement on RT105x

473 次查看
mastupristi
Senior Contributor I

I have a PWM signal whose duty cycle I need to measure, but I do not know its frequency. That signal goes to the GPIO_B0_09 pin, which can be configured as QTIMER, FlexPWM, or FlexGPIO, among other things.
What is the best way to measure the duty of the signal?

best regards

Max

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

463 次查看
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

As the following Figure, the GPIO_B0_09 pin can be configured as QTIMER4_TIMER0 function, the pin can be an input pin which is connected to PWM signal, because the PWM signal is low frequency signal, you can use quadTimer mode capture function to test the duty cycle or period.

In detail, you can select one Timer, for example use QT4 Timer0 to count the IP bus clock, which can be set up in TMRx_CTRLn[PCS], configure the capture pin with TMRx_CTRLn[SCS], configure the capture mode by TMRx_SCTRLn[CAPTURE_MODE], when the captured signal edge is detected, an ISR of quadTimer4_T0 is triggered, the current counter value is loaded into TMRx_CAPTn register, you can read the TMRx_CAPTn register to a variable, compare the value in two consecutive ISR, and get the duty cycle or period.

Hope it can help you

BR

XiangJun Rong

 

 

xiangjun_rong_0-1654067998288.png

 

0 项奖励