Odrive not accepting neither UART nor odrivetool commands

Hi there!

I am running an odrive in a small electric vehicle. Two motors on 7S battery. Driving logic runs on Arduino which sends UART current commands to the odrive.

My setup used to work just fine but after some changes, I have now trouble getting the motors to spin. I am quite sure I did not make any changes to odrive and the output functions on my arduino, but who knows… I also had some EMI-related issues lately, so maybe thats an issue?

I am now testing the odrive on its own to make sure this is not the fault. Odrive is configured as follows:

In [1]: odrv0.axis0
Out[1]:
error = 0x0000 (int)
enable_step_dir = False (bool)
current_state = 8 (int)
requested_state = 0 (int)
loop_counter = 3307123 (int)
config:
  startup_motor_calibration = False (bool)
  startup_encoder_index_search = False (bool)
  startup_encoder_offset_calibration = True (bool)
  startup_closed_loop_control = True (bool)
  startup_sensorless_control = False (bool)
  enable_step_dir = False (bool)
  counts_per_step = 2.0 (float)
  ramp_up_time = 0.4000000059604645 (float)
  ramp_up_distance = 12.566370964050293 (float)
  spin_up_current = 10.0 (float)
  spin_up_acceleration = 400.0 (float)
  spin_up_target_vel = 400.0 (float)
motor:
  error = 0x0000 (int)
  armed_state = 3 (int)
  is_calibrated = True (bool)
  current_meas_phB = 0.03220057487487793 (float)
  current_meas_phC = -0.04202532768249512 (float)
  DC_calib_phB = -2.1269025802612305 (float)
  DC_calib_phC = -2.0526959896087646 (float)
  phase_current_rev_gain = 0.02500000037252903 (float)
  current_control: ...
  gate_driver: ...
  timing_log: ...
  config: ...
controller:
  pos_setpoint = 0.0 (float)
  vel_setpoint = 0.0 (float)
  vel_integrator_current = 0.0 (float)
  current_setpoint = 0.0 (float)
  config: ...
  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)
  start_anticogging_calibration()
encoder:
  error = 0x0000 (int)
  is_ready = True (bool)
  index_found = False (bool)
  shadow_count = -272 (int)
  count_in_cpr = 16112 (int)
  offset = 12565 (int)
  interpolation = 0.5 (float)
  phase = 0.5178260803222656 (float)
  pos_estimate = -271.84735107421875 (float)
  pos_cpr = 16112.2392578125 (float)
  hall_state = 4 (int)
  pll_vel = 0.0 (float)
  pll_kp = 2000.0 (float)
  pll_ki = 1000000.0 (float)
  config: ...
sensorless_estimator:
  error = 0x0000 (int)
  phase = -0.0289801973849535 (float)
  pll_pos = -0.02938968315720558 (float)
  pll_vel = 0.22442401945590973 (float)
  pll_kp = 2000.0 (float)
  pll_ki = 1000000.0 (float)
In [2]: odrv0.axis1
Out[2]:
error = 0x0000 (int)
enable_step_dir = False (bool)
current_state = 8 (int)
requested_state = 0 (int)
loop_counter = 3325699 (int)
config:
  startup_motor_calibration = False (bool)
  startup_encoder_index_search = False (bool)
  startup_encoder_offset_calibration = True (bool)
  startup_closed_loop_control = True (bool)
  startup_sensorless_control = False (bool)
  enable_step_dir = False (bool)
  counts_per_step = 2.0 (float)
  ramp_up_time = 0.4000000059604645 (float)
  ramp_up_distance = 12.566370964050293 (float)
  spin_up_current = 10.0 (float)
  spin_up_acceleration = 400.0 (float)
  spin_up_target_vel = 400.0 (float)
motor:
  error = 0x0000 (int)
  armed_state = 3 (int)
  is_calibrated = True (bool)
  current_meas_phB = 0.010358572006225586 (float)
  current_meas_phC = 0.049659013748168945 (float)
  DC_calib_phB = -2.6286370754241943 (float)
  DC_calib_phC = -1.1371026039123535 (float)
  phase_current_rev_gain = 0.02500000037252903 (float)
  current_control: ...
  gate_driver: ...
  timing_log: ...
  config: ...
controller:
  pos_setpoint = 0.0 (float)
  vel_setpoint = 0.0 (float)
  vel_integrator_current = 0.0 (float)
  current_setpoint = 0.0 (float)
  config: ...
  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)
  start_anticogging_calibration()
encoder:
  error = 0x0000 (int)
  is_ready = True (bool)
  index_found = False (bool)
  shadow_count = 97 (int)
  count_in_cpr = 97 (int)
  offset = -12766 (int)
  interpolation = 0.5 (float)
  phase = -0.4681062698364258 (float)
  pos_estimate = 97.99150085449219 (float)
  pos_cpr = 97.76221466064453 (float)
  hall_state = 4 (int)
  pll_vel = 0.0 (float)
  pll_kp = 2000.0 (float)
  pll_ki = 1000000.0 (float)
  config: ...
sensorless_estimator:
  error = 0x0000 (int)
  phase = 0.04214863106608391 (float)
  pll_pos = 0.042754508554935455 (float)
  pll_vel = -0.12438177317380905 (float)
  pll_kp = 2000.0 (float)
  pll_ki = 1000000.0 (float)

When I try to control the Odrive manually via Odrivetool, I get the following behaviour:
In [1]: odrv0.axis0.controller.set_current_setpoint = 5

In [2]: odrv0.axis0.controller.current_setpoint
Out[2]: 0.0

Is this supposed to look like this? Why does the odrive not accept my commands?

Thanks for any input?
Jakob

set_current_setpoint(5) not set_current_setpoint = 5

Oh damn!

Thats it, thanks a million wetmelon!

At least I now know my odrive is working. Already ordered a new one with epress shipping :smile:
Jakob

1 Like