Unexpected motor spin after position control

No problems with running

.AXIS_STATE_FULL_CALIBRATION_SEQUENCE

and no errors came up when running

.startup_closed_loop_control

But motor sometimes spinned very fast in one direction while sometimes it held position…
Any help?

I fond out something odd which is the pos_setpoint pumped up to a very large negative number from 0.details about odrv0.axis1.controller
before and after command odrv0.axis1.requested_state=AXIS_STATE_CLOSED_LOOP_CONTROL are shown below:

error = 0x0000 (int)
pos_setpoint = 0.0 (float)
vel_setpoint = 0.0 (float)
vel_integrator_current = 0.0 (float)
current_setpoint = 0.0 (float)
vel_ramp_target = 0.0 (float)
vel_ramp_enable = False (bool)
config:
control_mode = 4 (int)
pos_gain = 20.0 (float)
vel_gain = 0.0005000000237487257 (float)
vel_integrator_gain = 0.0010000000474974513 (float)
vel_limit = 50000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = False (bool)
set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_forward: float)
set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
set_current_setpoint(current_setpoint: float)
move_to_pos(pos_setpoint: float)
move_incremental(displacement: float, from_goal_point: bool)
start_anticogging_calibration()

error = 0x0000 (int)
pos_setpoint = -3.593795787244739e+26 (float)
vel_setpoint = -131218552.0 (float)
vel_integrator_current = -0.475469172000885 (float)
current_setpoint = 0.0 (float)
vel_ramp_target = 0.0 (float)
vel_ramp_enable = False (bool)
config:
control_mode = 4 (int)
pos_gain = 20.0 (float)
vel_gain = 0.0005000000237487257 (float)
vel_integrator_gain = 0.0010000000474974513 (float)
vel_limit = 50000.0 (float)
vel_limit_tolerance = 1.2000000476837158 (float)
vel_ramp_rate = 10000.0 (float)
setpoints_in_cpr = False (bool)
set_pos_setpoint(pos_setpoint: float, vel_feed_forward: float, current_feed_forward: float)
set_vel_setpoint(vel_setpoint: float, current_feed_forward: float)
set_current_setpoint(current_setpoint: float)
move_to_pos(pos_setpoint: float)
move_incremental(displacement: float, from_goal_point: bool)
start_anticogging_calibration()

Dafuq

Do you have UART, i2c, or CAN configured?

emmm…I used the UART and I took the “UART congiure” as including protocol in the firmware.I used the previously released firmware version v4.10 which have ASCII protocol included.

my tup.config file is there:

CONFIG_BOARD_VERSION=v3.5-24V
CONFIG_USB_PROTOCOL=native
CONFIG_UART_PROTOCOL=ascii
CONFIG_DEBUG=false

CONFIG_STRICT=true

It is possible that noise managed to write p <float> on UART (or corrupt an otherwise valid p command). Make sure your UART device and ODrive are grounded together.

This may not be cause because I used usb which should be gounded with PCB.Besides I had tried GPIO 1,2 pin and gound pin ,didn’t worked

Is it possible that the PID paras do not fit…

It looks like you’re in control_mode = 4, which is the Trajectory Control mode. Somehow you’ve entered that mode (this can be done with a t command on UART)

Do me favour, and do an odrv0.erase_configuration() odrv0.save_configuration() and odrv0.reboot(), then setup your odrive again to get one axis going on USB. Then once it works, you can try to control it over UART.