PWM duty cycle measurement on RT105x

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

PWM duty cycle measurement on RT105x

450 Views
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

Labels (1)
0 Kudos
1 Reply

440 Views
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 Kudos