cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H755 Quadrature Encoder direction Bit

sarun
Associate II

Hello all,

I am attempting to read the direction bit and have observed a surprising behaviour. Let’s say my encoder was set to the reverse direction. If I attempt to move the encoder in the opposite direction, the direction bit doesn’t update until I halt the movement.

sarun_0-1711626455738.png

sarun_1-1711626462915.png

just reading the value in the main loop

encoder_direction = (TIM3->CR1 & 0x10) >> 4;

Basically direction is not being updated on the move,  Is this the intended behaviour of this bit?

4 REPLIES 4
Uwe Bonnes
Principal II

TIM_CR1_DIR is for normal counter mode and not set in encoder mode.

sarun
Associate II

Hello @Uwe Bonnes The reason i used that bit 

sarun_0-1711630553096.png

As per the description it should be updating. 

Probably I am wrong. But maybe DIR is only visible internal. Can some ST insider confirm if DIR is set and readable in encoder mode?

sarun
Associate II

@Uwe Bonnes Just to clear any confusion this is already running on my target, I am able to read the the bit but the behaviour is the issue.