cancel
Showing results for 
Search instead for 
Did you mean: 

ThreadX conflict with Timer1

Jeff4
Associate

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?

4 REPLIES 4

Read out and check/post content of all TIM1 registers, when the problem occurs.

JW

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:

 

Jeff4_1-1743511163978.png

 

Jeff4_2-1743511206885.png

Thanks

 

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

I see the changes in both PA8 and PA9 IDR:

Jeff4_0-1743575222824.png

 

Jeff4_2-1743575284587.png

 

Jeff4_3-1743575326184.png

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.