2024-03-04 07:32 PM
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).
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?
2024-03-26 09:58 AM
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.