Skip to main content
Explorer
November 10, 2025
Question

quadrature (incremental) encoder - Phase failure is detected automatically or not?

  • November 10, 2025
  • 5 replies
  • 296 views

We need to use quadrature phase counting with STM. can u please confirm if phase failure is supported in this mode or not .

    This topic has been closed for replies.

    5 replies

    Graduate II
    November 10, 2025

    Could you please tell some details about your task, which encoder you have and which mode you talk about?

     

    Komal_YAuthor
    Explorer
    November 10, 2025

    Hi,

    In quadrature phase counting ( If i use Encoder mode of TIM timers)  , phase A and B are thr. If any one phase is missing or failed then that detected by the hardware encoder automatically or not..

    Graduate II
    November 10, 2025

     

    I assume you talk about an illegal phase change, where both signals change at the same time (e.g. b10 -> b01) while it is expected to have only one changed at once (e.g. b10 -> b11 -> b01...).

     

    In general this can be detected and handled by an interrupt, see page 17 here:

    https://www.st.com/resource/en/product_training/STM32G4-WDG_TIMERS-General_Purpose_Timer_GPTIM.pdf

    This document is about STM32G4. I do not know which MCU you have.

     

    BR Klaus

    Technical Moderator
    November 10, 2025

    Hello @Komal_Y and welcome to the ST community,

    Please review How to write your question to maximize your chances to find a solution

    Thank you

    Super User
    November 10, 2025

    Note, that feature mentioned by @mfgkw above (i.e. "invalid" transition detection, which is indicative of the phases being shorted together) is available in newer STM32 only, such as 'G4, 'H5 and 'U5 families. Look for TIMx_SR.TERRF flag in the RM.

    It's hard to tell what would constitute "missing" phase - if the signal is not connected, this probably ought to be detected in some "analog" way, e.g. holding the signal at the board side at mid-level and using window comparator or ADC to detect that state. If a signal is "stuck" low or high, that's would result in position jumping forward and backward, detectable in software depending on the expected typical movement, but no automatic detection either.

    JW