Motor not switching directions when calibrating hall sensor

Hi there,

I am very new to odrivetool, and i am trying to set up a BLDC motor (1,8kW 6Nm 44A 48V 3000rpm)

Currently using: ODrive control utility v0.6.5.post2 and firmware v0.5.1

I have follow a guide until the motor should rotate CW and CCW to get calibrated but it just turns CW.

This are the commands that I followed:

odrv0.axis0.motor.config.pole_pairs = 4
odrv0.axis0.motor.config.resistance_calib_max_voltage = 4
odrv0.axis0.motor.config.requested_current_range = 20
odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.encoder.config.mode = ENCODER_MODE_HALL
odrv0.axis0.encoder.config.cpr = 24
odrv0.axis0.encoder.config.bandwidth = 100
odrv0.axis0.motor.config.current_control_bandwidth = 100
odrv0.axis0.controller.config.pos_gain = 0
odrv0.axis0.controller.config.vel_gain = 0.02
odrv0.axis0.controller.config.vel_integrator_gain = 0.0
odrv0.axis0.controller.config.vel_limit = 1000
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_VELOCITY_CONTROL
odrv0.save_configuration()
odrv0.reboot()

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION
odrv0.axis0.motor
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION

I don’t have any problem until the command

odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION

Here, it should spin CW and CCW, but just spins in one direction.

and it seems to be working since when I use the command

odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

it makes a little “bip sound”

When entering the command:

odrv0.axis0.encoder

I receive this results:

calib_scan_response: 40.0 (float)
config:
  abs_spi_cs_gpio_pin: 1 (uint16)
  bandwidth: 100.0 (float)
  calib_range: 0.019999999552965164 (float)
  calib_scan_distance: 50.26548385620117 (float)
  calib_scan_omega: 12.566370964050293 (float)
  cpr: 24 (int32)
  enable_phase_interpolation: True (bool)
  find_idx_on_lockin_only: False (bool)
  idx_search_unidirectional: False (bool)
  ignore_illegal_hall_state: False (bool)
  mode: 1 (int32)
  offset: 0 (int32)
  offset_float: 0.0 (float)
  pre_calibrated: False (bool)
  sincos_gpio_pin_cos: 4 (uint16)
  sincos_gpio_pin_sin: 3 (uint16)
  use_index: False (bool)
  zero_count_on_find_idx: True (bool)
count_in_cpr: 15 (int32)
error: 2 (int32)
hall_state: 6 (uint8)
index_found: False (bool)
interpolation: 0.5 (float)
is_ready: False (bool)
phase: -2.6179935932159424 (float)
pos_abs: 0 (int32)
pos_circular: 0.6655988693237305 (float)
pos_cpr: 0.6656306982040405 (float)
pos_cpr_counts: 15.975135803222656 (float)
pos_estimate: 2.6659884452819824 (float)
pos_estimate_counts: 63.98372268676758 (float)
set_linear_count(obj: object_ref, count: int32)
shadow_count: 63 (int32)
spi_error_rate: 0.0 (float)
vel_estimate: 0.0 (float)
vel_estimate_counts: 0.0 (float)

Thanks in advance, I will appreciate any help.

I tried to do the same with axis1 and works better, it turns CW and CCW when doing the “AXIS_STATE_ENCODER_OFFSET_CALIBRATION”
and i don’t get any errors when i enter “odrv0.axis0.encoder.error”

However, when I try the command

odrv0.axis1.controller.input_vel = 2

it doesn’t move (i configured the “CONTROL_MODE_VELOCITY_CONTROL” before )

i have also try the “CONTROL_MODE_VELOCITY_CONTROL” and doesn’t move.

Any idea what is going on?

I have the same problem as you. Do you resolve this problem now? Thanks.