Oh I replaced the encoder, resoldered it, erased the configuration, and re configured using this commands :
odrv0.erase_configuration()
odrv0.config.brake_resistance = 2.0
odrv0.config.dc_bus_undervoltage_trip_level = 8.0
odrv0.config.dc_bus_overvoltage_trip_level = 56.0
odrv0.config.dc_max_positive_current = 20.0
odrv0.config.dc_max_negative_current = -3.0
odrv0.config.max_regen_current = 0
odrv0.axis0.motor.config.pole_pairs = 14
odrv0.axis0.motor.config.calibration_current = 5
odrv0.axis0.motor.config.resistance_calib_max_voltage = 2
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.motor.config.current_lim = 15
odrv0.axis0.motor.config.requested_current_range = 20
odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 4
odrv0.axis0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS
odrv0.axis0.encoder.config.cpr = 2**14
odrv0.axis0.encoder.config.bandwidth = 1000
odrv0.axis0.config.calibration_lockin.current = 5
odrv0.axis0.config.calibration_lockin.ramp_time = 0.4
odrv0.axis0.config.calibration_lockin.ramp_distance = 3.141592
odrv0.axis0.config.calibration_lockin.accel = 20
odrv0.axis0.config.calibration_lockin.vel = 40
odrv0.axis0.controller.config.control_mode = CONTROL_MODE_POSITION_CONTROL
odrv0.axis0.controller.config.vel_limit = 50
odrv0.axis0.controller.config.pos_gain = 30
odrv0.axis0.controller.config.vel_gain = 0.02
odrv0.axis0.controller.config.vel_integrator_gain = 0.2
odrv0.axis0.controller.config.input_mode = INPUT_MODE_TRAP_TRAJ
odrv0.axis0.trap_traj.config.vel_limit = 30
odrv0.axis0.trap_traj.config.accel_limit = 5
odrv0.axis0.trap_traj.config.decel_limit = 5
odrv0.save_configuration()
odrv0.reboot()
odrv0.axis0.requested_state = AXIS_STATE_ENCODER_OFFSET_CALIBRATION
Most of the errors disappeared while this processes.
In [1]: odrv0.axis0.encoder
Out[1]:
error = 0x0000 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 0 (int)
count_in_cpr = 0 (int)
interpolation = 0.5 (float)
phase = 0.002684354782104492 (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)
config:
mode = 257 (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)
In [48]: dump_errors(odrv0)
axis0
axis: no error
motor: no error
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error
But sometimes, the error ‘AXIS_ERROR_INVALID_STATE’ appears in the axis section.
I tried those commands to verify.
In [25]: odrv0.axis0.encoder.config.phase_offset
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File <ipython-input-25-82bec0f1045f>:1
----> 1 odrv0.axis0.encoder.config.phase_offset
File c:\users\bluej\appdata\local\programs\python\python38\lib\site-packages\fibre\remote_object.py:245, in RemoteObject.__getattribute__(self, name)
243 return attr
244 else:
--> 245 return object.__getattribute__(self, name)
AttributeError: 'RemoteObject' object has no attribute 'phase_offset'
In [26]: odrv0.axis0.encoder.config.direction
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
File <ipython-input-26-a77ffd9810f9>:1
----> 1 odrv0.axis0.encoder.config.direction
File c:\users\bluej\appdata\local\programs\python\python38\lib\site-packages\fibre\remote_object.py:245, in RemoteObject.__getattribute__(self, name)
243 return attr
244 else:
--> 245 return object.__getattribute__(self, name)
AttributeError: 'RemoteObject' object has no attribute 'direction'
Well, It’s not working.
After running this command :
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
The dump says this errors :
In [30]: dump_errors(odrv0)
axis0
axis: Error(s):
AXIS_ERROR_MOTOR_FAILED
motor: Error(s):
MOTOR_ERROR_PHASE_RESISTANCE_OUT_OF_RANGE
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error
axis1
axis: no error
motor: no error
fet_thermistor: no error
motor_thermistor: no error
encoder: no error
controller: no error