cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting Missing Encoder Input

TWood.4
Associate III

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?

 

3 REPLIES 3
TDK
Guru

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
Associate III

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
Guru

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".