Skip to main content
Visitor II
April 1, 2025
Question

ThreadX conflict with Timer1

  • April 1, 2025
  • 3 replies
  • 475 views

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?

    This topic has been closed for replies.

    3 replies

    Super User
    April 1, 2025

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

    JW

    Jeff4Author
    Visitor II
    April 1, 2025

    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

     

    Super User
    April 1, 2025

    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

    Jeff4Author
    Visitor II
    April 2, 2025

    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.

     

     

     

     

     

    Super User
    April 3, 2025

    You haven't looked at GPIOA_AFR[] to see if the proper AF are set for these two pins, when the problem is occuring.

    JW