2025-04-01 2:19 AM
Hi,
I'm using TIM1 in Encoder mode while running ThreadX in the program in STM32H523. I encountered an issue where TIM1→CNT only toggles between 0 and 1 when rotating the encoder. However, when I deactivated ThreadX, the encoder worked fine. I haven't enabled TIM1 interrupts and am only reading the register periodically. Where could the conflict between ThreadX and the TIM1 Encoder be?
2025-04-01 5:17 AM
Read out and check/post content of all TIM1 registers, when the problem occurs.
JW
2025-04-01 5:47 AM
Hello @waclawek.jan
This is the TIM registers. As seen in the images, the registers CR1, SR, CNT, DMAR change. The changes are only between 2 values in 2 images like a loop:
Thanks
2025-04-01 7:28 AM
TIM setting is OK, but this appears like there is no signal change at TIM1_CH2. Read out and check/post relevant GPIO registers, including observing changes of given pin's IDR bit during operation.
JW
2025-04-01 11:43 PM
I see the changes in both PA8 and PA9 IDR:
I don't know how this problem occurs when I active the ThreadX (with USBX and their GPDMA). It works fine without them in a simple program.