Skip to main content
Edwin kaus
Associate III
April 22, 2018
Question

Pwm input capture mode in stm32H7 MCU

  • April 22, 2018
  • 1 reply
  • 1510 views
Posted on April 22, 2018 at 05:41

HELLO..

I want to measure the frequency and duty cycle of the external signal. I have gone through some example available , and suggestions on website. Everywhere they are using either channel 1 or channel 2 in any of timer , unfortunately in my case signal is given to channel 4 ,  Is it still possible to measure duty cycle and frequency by using channel 4 , if so how to configure the same in stm cubemx ..

Can anybody suggest please , I am fully stuck with this issue ..

Thank you

#pwm-input #stm32h7 #cubemx
This topic has been closed for replies.

1 reply

Tesla DeLorean
Guru
April 22, 2018
Posted on April 22, 2018 at 16:06

The PWM Input mode pairs Channel 1 and 2.

You could use Input Capture with Channel 4, and Channel 3 (Indirect) to time stamp TIMx_CH4 along the timeline of TIMx and interrupt. You could then delta measurements in an interrupt (or sample with DMA), to measure the period and duty of an input signal.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..
Edwin kaus
Associate III
April 22, 2018
Posted on April 22, 2018 at 16:45

Hello ..

Thanks for response ..

I am just confused , Can you please give me some more explanation, suggest some example project if possible . In stm example project they used TIM1 channel 1 as direct & channel 2 as indirect mode .  I am using TIM 8 CHANNEL 4 for frequency capture and duty cycle measurements.

Suggest me how to configure the tim8 and how calculate duty cycle .

Tesla DeLorean
Guru
April 22, 2018
Posted on April 22, 2018 at 17:33

Use a free-running timer, use CH3 and CH4 to time-stamp different edges, and subtract values, or prior values.

Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..