cancel
Showing results for 
Search instead for 
Did you mean: 

Extra quadrature encoder doesn't work if "MC_StartMotor1()" is executed

apexyz
Associate II

I set up a BLDC position control with NUCLEO-F446ZE and X-NUCLEO-IHM07M1. The BLDC motor has integrated rotary encoder, which is connected to X-NUCLEO-IHM07M1. To verify the accuracy of the integrated encoder, I set up an extra optical encoder, which is connected to NUCLEO-F446Ze Timer 4. Timer 4 is configured as encoder mode, see below, with GPIO PD12 (A), PD13(B) and PD14(Z).

apexyz_0-1709608611003.png

Weird thing is that if I start the motor by command "MC_StartMotor1()", even if the motor is not moving, the reading value of TIM4->CNT keeps changing (cycles from 0 to 65535). If I stop the motor, the reading value of TIM4->CNT remains unchanged. Under this condition (motor state Idle), if I manually change the position, the reading value of TIM4->CNT changes accordingly and seems normal. 

Anyone knows what happens there?

1 REPLY 1
GMA
ST Employee

Hello @apexyz ,

Two short comments:

- Counter period (Auto-reload register) has to be set according to the "Pulses per mechanical revolution". Counter is incremented by 4 at each pulse then to be set at ((4*NBR Pulse) -1)
- PD12 and PD13 are connected to several other signals (PF10 and PC5 for PD13 e.g). Please check if these signals interfere with Encoder signals.

If you agree with the answer, please accept it by clicking on 'Accept as solution'.
Best regards.
GMA