Skip to main content
Associate
May 16, 2025
Solved

STM32H723 TIM2 in encoder mode not working

  • May 16, 2025
  • 3 replies
  • 643 views

Hello,

I have the following problem - I configured TIM2 of STM32H723 in Encoder Mode following all recommendations in the Reference Manual RM0468, chapter Encoder Interface Mode, p. 1694:

• CC1S= 01 (TIMx_CCMR1 register, TI1FP1 mapped on TI1)
• CC2S= 01 (TIMx_CCMR2 register, TI2FP2 mapped on TI2)
• CC1P and CC1NP = ‘0’ (TIMx_CCER register, TI1FP1 noninverted, TI1FP1=TI1)
• CC2P and CC2NP = ‘0’ (TIMx_CCER register, TI2FP2 noninverted, TI2FP2=TI2)
• SMS= 011 (TIMx_SMCR register, both inputs are active on both rising and falling
edges)
• CEN= 1 (TIMx_CR1 register, Counter is enabled)

I also checked these settings in the TIM2 registers in debug mode with halting the micro and they were exactly as recommended. I checked the input quadrature signals - they are there. But still the TIM2 counter value stays 0 and does not change.

Any ideas what I might be missing?

Thanks a lot,

Radek

This topic has been closed for replies.
Best answer by waclawek.jan

Indeed.

JW

3 replies

waclawek.jan
Super User
May 18, 2025

Read out and check/post the TIM and relevant GPIO registers content.

JW

 

radekbgAuthor
Associate
May 18, 2025

The problem might be on my side - I am actually using the pair of channels CH3 and CH4 assuming they have the same functionality as the pair CH1 and CH2 which may be wrong?

waclawek.jan
waclawek.janBest answer
Super User
May 18, 2025