2025-09-13 8:26 AM
I am using the Advanced and General purpose timers on the STM32G474VE for PWM generation and Input capture.
Is it possible, for example, to use TIM4 Ch1 to generate PWM output and TIM4 Ch2 to be used as Input Capture simultaneously?
If these 2 features are used on different channels of the same timer are there any timing issues that could prevent me from using them simultaneously to drive, for example, a PWM controlled fan with a Tachometer that generates signals for the MCU?
Solved! Go to Solution.
2025-09-13 8:56 AM
Well the limitation here is there is ONE counter and it is bounded by the Period, ie ARR
The CCRx registers latch or compare against the count, ie CNT
If you are just modulating the Duty, you might be able to capture on another channel.
I'd recommend using another TIM.
2025-09-13 8:35 AM
Edit: I read this thread - https://community.st.com/t5/stm32-mcus-products/pwm-input-capture-and-pwm-output-with-same-timer/td-p/483410
But it talks about 'input PWM' NOT 'input capture'
2025-09-13 8:56 AM
Well the limitation here is there is ONE counter and it is bounded by the Period, ie ARR
The CCRx registers latch or compare against the count, ie CNT
If you are just modulating the Duty, you might be able to capture on another channel.
I'd recommend using another TIM.
2025-09-13 8:58 AM
Makes sense. Thank you.
2025-09-13 10:20 AM
Input PWM combines two channels, from one input, and a reset so it can capture a period in one channel and duty in the other.
Regular Input Capture just uses the channel input to latch the current count value and that wraps within the period.
I'd generally use maximal count TIM to measure durations, otherwise there's a lot of fighting with the wrapping.