Problem with motor stops rotate

hello everyone,
I don’t know what is the problem with the motor. sometimes I have to move the motor vertical so can rotates but not always. Any ideas why? cable conexion ?

  • Motor ODrive D5065 270KV
  • ODrive Motor controller board V3.6
  • ODrive power resistor 50W
  • Encoder CUI AMT 102-V 4420


#restore the motherboard default parameters
odrv0.erase_configuration()


#1 config dissipation resistor
odrv0.config.brake_resistance = 2.0

#2 config low voltage portection threshold
odrv0.config.dc_bus_undervoltage_trip_level= 8.0

#3 config overvoltage protection threshold
odrv0.config.dc_bus_overvoltage_trip_level= 56.0

#4 config overcurrent protection threshold
odrv0.config.dc_max_positive_current = 20.0

#5 config the reverse overcurrent protection threshold
odrv0.config.dc_max_negative_current =-1.0

#6 config the recharge current value
odrv0.config.max_regen_current =0

#7 save config parameters

odrv0.save_configuration()






#Part2: motor parameter configuration

#1 config the number of motor pole pairs
odrv0.axis0.motor.config.pole_pairs=7

#2 config the current when the motor is calibrated
odrv0.axis0.motor.config.calibration_current =5

#3 config the voltage when the motor is calibrated
odrv0.axis0.motor.config.resistance_calib_max_voltage= 2

#4 config motor type
odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT

#5 Config the maximum current limit for motor operation
odrv0.axis0.motor.config.current_lim = 10 # [A]

#6 config the motor current sampling range
odrv0.axis0.motor.config.requested_current_range = 20

#******************************************************
odrv0.axis0.motor.config.current_control_bandwidth = 2000
odrv0.axis0.motor.config.torque_constant = 8.27 / 270
odrv0.axis0.motor.config.torque_lim= 1.3
#******************************************************


#7 save config parameters
odrv0.save_configuration()


# part 3
#encoder parameter config

#1 config encoder type
odrv0.axis0.encoder.config.mode= ENCODER_MODE_INCREMENTAL


#2 Config encoder resolution
odrv0.axis0.encoder.config.cpr =8192
odrv0.axis0.encoder.config.enable_phase_interpolation = True

#3 config encoding bandwith
odrv0.axis0.encoder.config.bandwidth=3000

#4 motor running current when configuring encoder calibration
odrv0.axis0.config.calibration_lockin.current =3

#5 config the current rise time during encoder calibration
odrv0.axis0.config.calibration_lockin.ramp_time = 0.4

#6 config the motor rotation distance when the current rises
odrv0.axis0.config.calibration_lockin.ramp_distance = 3.1415927410125732
#7 motor acceletation when configuring encoder calibration
odrv0.axis0.config.calibration_lockin.accel=20

#8 motor speed when configuring encoder calibration
odrv0.axis0.config.calibration_lockin.vel=40

#9 save config parameters
odrv0.save_configuration()



#PART 4 
#1 config control mode
odrv0.axis0.controller.config.control_mode= CONTROL_MODE_POSITION_CONTROL

#2 config the maximum speed of the motor
odrv0.axis0.controller.config.vel_limit=5

#3 config position loop gain
odrv0.axis0.controller.config.pos_gain =30

#4 config speed loop gain
odrv0.axis0.controller.config.vel_gain = 0.2
odrv0.axis0.controller.config.vel_integrator_gain = 0.5 * 10 * 0.2


#5 config input mode
odrv0.axis0.controller.config.input_mode= INPUT_MODE_TRAP_TRAJ

#6 Config the motor speed in trapezoidal mode
odrv0.axis0.trap_traj.config.vel_limit =30

#7 config the motor acceleration/deceleration in trapezoidal 
odrv0.axis0.trap_traj.config.accel_limit =5
odrv0.axis0.trap_traj.config.decel_limit =5

#8 save the config 
odrv0.save_configuration()

odrv0.reboot()



#-----------------------------------
#CALIBRATION
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE


odrv0.save_configuration()

#odrv0.reboot()
#odrv0.clear_errors()
#dump_errors(odrv0)
odrv0.axis0.motor.config
#-------------------------------------------------

#odrv0.axis0.controller.config.input_mode = AXIS_STATE_CLOSED_LOOP_CONTROL
odrv0.axis0.requested_state =AXIS_STATE_CLOSED_LOOP_CONTROL

odrv0.axis0.controller.input_pos =50

odrv0.axis0.controller.input_pos =0

This is the error i get
system: no error
axis0
axis: no error
motor: Error(s):
MOTOR_ERROR_UNKNOWN_TORQUE
MOTOR_ERROR_UNKNOWN_VOLTAGE_COMMAND
sensorless_estimator: no error
encoder: Error(s):
ENCODER_ERROR_CPR_POLEPAIRS_MISMATCH
controller: Error(s):
CONTROLLER_ERROR_OVERSPEED
axis1
axis: no error
motor: no error
sensorless_estimator: no error
encoder: no error
controller: no error

Doesn’t really make sense that you have both CPR_POLEPAIRS and OVERSPEED errors… is that at different times?

Yes, it’s at the same time. The wierd thing is that not always make the mistake. And about the problem that stops I think is because of the enclosure. Do you recommend another support to hold the motor?

Please check that the encoder is firmly mounted on the shaft. You need to press the plastic pieces together with “tool B” pretty hard so it grips firmly.

I found the problem. The screw were missing. What type of screw do i need?

Those are M4 screws.