Skip to main content
TWood.4
Associate II
September 25, 2023
Question

Detecting Missing Encoder Input

  • September 25, 2023
  • 3 replies
  • 1467 views

I am using LPTIM1 of an STM32WB55 to read the outputs of a quadrature encoder.

If I disconnect either of the two inputs, the timer continues to increment or decrement.

Is there any way to stop the counter changing value when one of the in puts is missing?

Or to detect that there is only one input?

 

This topic has been closed for replies.

3 replies

TDK
September 25, 2023

No. How would it know the input is "missing" as opposed to just not changing value?

If they're ADC pins you could bias them to midscale and check for the range, but that's a little extreme.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TWood.4
TWood.4Author
Associate II
October 6, 2023

If one of the inputs is not changing state then the counter should increment on one edge and then decrement on the other.

What I'm seeing is the counter counting either up or down according to which input is driven. 

 

 

 

 

What I'm seeing is the counter counting up or down if one of the inputs is driven.

TDK
October 6, 2023

If one input is fixed at high or low, and the other is toggling, the counter value should go up by 1, then down by 1, then up, etc... It should not have appreciable movement up or down beyond one count. You can convince yourself of this by driving them manually as GPIO pins. If one input is floating, then all bets are off as noise can cause the floating input to go up or down.

It's not typical for an encoder to lose one of its two signals. Is there some reason you're concerned about this? Perhaps there is something wrong with the setup, or something is being misinterpreted.

"If you feel a post has answered your question, please click ""Accept as Solution""."