Skip to main content
Associate II
October 14, 2025
Solved

One Pulse Mode and ICP with one Input Pin

  • October 14, 2025
  • 2 replies
  • 263 views

Hi,

What I want to implement is to receive the Input Trigger (called Ch1) signal on the rising edge in One Pulse Mode and output a PWM signal through Ch2. At the same time, I want to capture an ICP interrupt on both the rising and falling edges of Ch1 to determine whether a signal is currently being received or not on Ch1.
Previously, the STM32F103 couldn't handle the One Pulse Mode Input and ICP as a single pin, so I had to split the signal between two pins in hardware.
However, the MCUs I'm currently using are the STM32H723 and STM32G071.
I found out that they can internally route channels, so I don't need to receive signals on two pins, but can receive them with a single pin. Is this actually possible on these two MCUs?

thanks in advance.

Best answer by TDK

You can assign a pin to multiple functions, for example TIM1_CH1 and TIM2_CH2, provided those choices are available for the pin. However, if you're driving the pin with a PWM output, the IC pulses will just match that PWM output that you're sending, which doesn't seem very useful. A pin can't effectively be an input and output at the same time.

 

Edit: This is poorly worded. You can only assign a pin to one alternate function at a time, but you can assign it to EXTI interrupts as well. So you can't have it be TIM1_CH1 and TIM2_CH2 simultaneously, but you could do, say TIM1_CH1 and EXTI.

2 replies

TDK
TDKBest answer
Super User
October 14, 2025

You can assign a pin to multiple functions, for example TIM1_CH1 and TIM2_CH2, provided those choices are available for the pin. However, if you're driving the pin with a PWM output, the IC pulses will just match that PWM output that you're sending, which doesn't seem very useful. A pin can't effectively be an input and output at the same time.

 

Edit: This is poorly worded. You can only assign a pin to one alternate function at a time, but you can assign it to EXTI interrupts as well. So you can't have it be TIM1_CH1 and TIM2_CH2 simultaneously, but you could do, say TIM1_CH1 and EXTI.

"If you feel a post has answered your question, please click ""Accept as Solution""."
waclawek.jan
Super User
October 14, 2025

If you want to have interrupts on both rising and falling edge of the signal at TIMx_CH1 pin, while using that pin simultaneously to trigger the Slave-mode controller in the timer upon only the rising edge, and simultaneously you are occupying the capture-compare channel 2 in that timer using PWM (and don't want to move it to other channel of the same timer, 3 or 4), then - as due to that PWM on CH2 you can't use the "CH1/CH2 crossover" (as set by TIMx_CCMRx.CCxS=0b10), as @TDK explained above - probably the only option is to set up an EXTI interrupt on that TIMx_CH1 pin, to be triggered by both edges.

This btw. should be possible on the 'F1, too; however, this is notoriously impossible to be clicked in CubeMX and in Cube has to be worked around.

JW