Matching pole_pair gives error


i’m running a ODrive card(v3.5) with firmware 0.5.4, and I’m having issues with calibrating a hub-motor.

This one to be exact: 8 inch brushless single shaft encoder hub motor - UU Motor

I have plugged in A,B,C phases and also the hall-encoder wires onto M0 on my odrive card.

Motor calibration works fine, here is the config after i run that:

I_bus_hard_max: inf (float)
I_bus_hard_min: -inf (float)
I_leak_max: 0.10000000149011612 (float)
R_wL_FF_enable: False (bool)
acim_autoflux_attack_gain: 10.0 (float)
acim_autoflux_decay_gain: 1.0 (float)
acim_autoflux_enable: False (bool)
acim_autoflux_min_Id: 10.0 (float)
acim_gain_min_flux: 10.0 (float)
bEMF_FF_enable: False (bool)
calibration_current: 10.0 (float)
current_control_bandwidth: 1000.0 (float)
current_lim: 10.0 (float)
current_lim_margin: 8.0 (float)
dc_calib_tau: 0.20000000298023224 (float)
inverter_temp_limit_lower: 100.0 (float)
inverter_temp_limit_upper: 120.0 (float)
motor_type: 0 (uint8)
phase_inductance: 0.00026390718994662166 (float)
phase_resistance: 0.15721480548381805 (float)
pole_pairs: 15 (int32)
pre_calibrated: False (bool)
requested_current_range: 60.0 (float)
resistance_calib_max_voltage: 4.0 (float)
torque_constant: 0.03999999910593033 (float)
torque_lim: inf (float)

But when i run a FULL_CALIBRATION or a ENCODER_OFFSET_CALIBRATION i get a mismatch on cpr to polepairs

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION```

the wheel only spins oneway and dump_errors gives me:

system: no error
  axis: no error
  motor: no error
  sensorless_estimator: no error
  encoder: Error(s):
  controller: no error
  axis: no error
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error

So my first question is cpr should be set to 90? 15*6 ?

Could there be any other issues with my conf?


abs_spi_cs_gpio_pin: 1 (uint16)
bandwidth: 1000.0 (float)
calib_range: 0.019999999552965164 (float)
calib_scan_distance: 50.26548385620117 (float)
calib_scan_omega: 12.566370964050293 (float)
cpr: 90 (int32)
direction: 1 (int32)
enable_phase_interpolation: True (bool)
find_idx_on_lockin_only: False (bool)
hall_polarity: 0 (uint8)
hall_polarity_calibrated: False (bool)
ignore_illegal_hall_state: False (bool)
index_offset: 0.0 (float)
mode: 0 (uint16)
phase_offset: -15 (int32)
phase_offset_float: -0.14545565843582153 (float)
pre_calibrated: False (bool)
sincos_gpio_pin_cos: 4 (uint16)
sincos_gpio_pin_sin: 3 (uint16)
use_index: False (bool)
use_index_offset: True (bool)

controller config:

  anticogging_enabled: True (bool)
  calib_anticogging: False (bool)
  calib_pos_threshold: 1.0 (float)
  calib_vel_threshold: 1.0 (float)
  cogging_ratio: 1.0 (float)
  index: 0 (uint32)
  pre_calibrated: False (bool)
axis_to_mirror: 255 (uint8)
circular_setpoint_range: 1.0 (float)
circular_setpoints: False (bool)
control_mode: 3 (uint8)
electrical_power_bandwidth: 20.0 (float)
enable_gain_scheduling: False (bool)
enable_overspeed_error: True (bool)
enable_torque_mode_vel_limit: True (bool)
enable_vel_limit: True (bool)
gain_scheduling_width: 10.0 (float)
homing_speed: 0.25 (float)
inertia: 0.0 (float)
input_filter_bandwidth: 2.0 (float)
input_mode: 1 (uint8)
load_encoder_axis: 0 (uint8)
mechanical_power_bandwidth: 20.0 (float)
mirror_ratio: 1.0 (float)
pos_gain: 20.0 (float)
spinout_electrical_power_threshold: 10.0 (float)
spinout_mechanical_power_threshold: -10.0 (float)
steps_per_circular_range: 1024 (int32)
torque_mirror_ratio: 0.0 (float)
torque_ramp_rate: 0.009999999776482582 (float)
vel_gain: 0.1666666716337204 (float)
vel_integrator_gain: 0.3333333432674408 (float)
vel_integrator_limit: inf (float)
vel_limit: 2.0 (float)
vel_limit_tolerance: 1.2000000476837158 (float)
vel_ramp_rate: 1.0 (float)

Thankful for any input at all! I’ll happily add more logs if there is any missing

Make sure you’re following the hoverboard guide for the hall sensor config, even if it’s not actually a hoverboard motor

I’m following this guide here: Hoverboard motor and remote control setup guide — ODrive Pro Documentation 0.6.2 documentation

You might just have a bad hall sensor if you’re getting this error and cpr and pp look right. You can also increase the calibration (or general?) lockin current

Yes that was correct, I added capacitors on both encoders but I still have the same issue. There is a lot of noise