I’m having problem running AS5048A encoder on v.3.6 ODrive 56V with rc-v0.5.1 firmware. I connected everything as it says here. SCK, MISO and GND to the same named pins on ODrive. MOSI, 3.3V and 5V on encoder connected together to 3.3V on ODrive. I only have M0 motor. I also applied fix as suggested here. I still get error immediately as ODrive is connected. As soon as it connects I run command dump_errors(odrive0) and get the following:
axis: Error(s):
motor: no error
encoder: Error(s):
controller: no error
axis: no error
motor: no error
encoder: no error
controller: no error

when I run command : odrv0.axis0.encoder, i get the following:

error = 0x0010 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
interpolation = 0.0 (float)
phase = 0.0 (float)
pos_estimate = 0.0 (float)
pos_estimate_counts = 0.0 (float)
pos_cpr = 0.0 (float)
pos_cpr_counts = 0.0 (float)
pos_circular = 0.0 (float)
hall_state = 7 (int)
vel_estimate = 0.0 (float)
vel_estimate_counts = 0.0 (float)
calib_scan_response = 0.0 (float)
pos_abs = 0 (int)
spi_error_rate = 0.0 (float)
  mode = 1 (int)
  use_index = False (bool)
  find_idx_on_lockin_only = False (bool)
  abs_spi_cs_gpio_pin = 4 (int)
  zero_count_on_find_idx = True (bool)
  cpr = 16384 (int)
  offset = 0 (int)
  pre_calibrated = False (bool)
  offset_float = 0.0 (float)
  enable_phase_interpolation = True (bool)
  bandwidth = 1000.0 (float)
  calib_range = 0.019999999552965164 (float)
  calib_scan_distance = 50.26548385620117 (float)
  calib_scan_omega = 12.566370964050293 (float)
  idx_search_unidirectional = False (bool)
  ignore_illegal_hall_state = False (bool)
  sincos_gpio_pin_sin = 3 (int)
  sincos_gpio_pin_cos = 4 (int)
set_linear_count(count: int)

I also cannot run offset calibration.

It looks like your encoder mode is set to 1 (ENCODER_MODE_HALL) change it to ENCODER_MODE_SPI_ABS_AMS (257)


Thank you very much. It works :grin: This new version doesn’t have ENCODER_MODE_SPI_ABS_AMS enum but I set to 257 as you said and it works perfectly.


That means you are still using the old version of odrivetool - perhaps you installed it with pip?
You need to uninstall that version, and run python3 tools/odrivetool from the Git repo to make use of the latest version of the tool. You’ll notice it connects much faster. :slight_smile:


Thanks :grin: yeah I got them now!

1 Like