Using CUI AMT112S-V Encoder with ODrive

Hello again!
I am attempting to run a 24V BLDC Motor (P/N: 42BLS100-24-01) with a CUI Encoder attached (P/N AMT112S-V).
However, when following through the getting started documentation, when I get to the line where you run the calibration sequence (i.e. odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE), the motor does not spin at all and when i run “dump_errors(odrv0, True)” I get this error:
‘’’
axis0
axis: Error(s):
ERROR_CURRENT_MEASUREMENT_TIMEOUT
motor: no error
encoder: no error
controller: no error
‘’’

If I then attempt to run the full calibration sequence again, the controller beeps, and then the motor spins four rotations in one direction.
Running the “dump_errors(odrv0, True)” command again, I get these errors:

‘’’
axis0
axis: Error(s):
ERROR_ENCODER_FAILED
motor: no error
encoder: Error(s):
ERROR_CPR_OUT_OF_RANGE
controller: no error
‘’’
I have attempted to change quite a few values to fix this one, none of which have worked (changed the cpr value, and the pole pairs).

This is the second set of encoders I’m trying to use, so I hope its not something I’m blatantly doing wrong.

Any help would be greatly appreciated.

Thank you

You will need to copy your whole config here for any reliable help.

At least send this command odrv0.axis1.motor.config and copy back what it gives.

Did you set your motor poles correctly?

That motor has an integrated hall sensor, are you just leaving that unconnected?

Also, I think that motor might best be run as a gimbal motor, due to the high resistance between the phases. I am assuming, due to the listed specs of 24 V and 6 A. Although I could be wrong on that.

Basically I would need more info to help. But I run that family of encoder myself succesfully.

Thank you for your reply!
I’ll tackle your questions one at a time here. Firstly, here’s the return of odrv0.axis0.motor.config:
‘’’
pre_calibrated = False (bool)
pole_pairs = 12 (int)
calibration_current = 6.0 (float)
resistance_calib_max_voltage = 4.0 (float)
phase_inductance = 0.0004414464929141104 (float)
phase_resistance = 0.31769099831581116 (float)
direction = 1 (int)
motor_type = 2 (int)
current_lim = 6.0 (float)
current_lim_tolerance = 1.25 (float)
inverter_temp_limit_lower = 100.0 (float)
inverter_temp_limit_upper = 120.0 (float)
requested_current_range = 25.0 (float)
current_control_bandwidth = 100.0 (float)
‘’’

With the motor pairs it has been a bit tricky, I can’t see inside the motor to count the pole pairs, so I attempted that trick where you attach two of the three phases to the power supply. At a relatively low current (~800mA) I could feel 12 detents, but if I upped it any more, there was only 2 (180 degree separation). I have tried both with no success.

To answer your question, yeah I currently just have the hall sensor wires unconnected as we are hoping to just use the encoder for now.

I also just switched the motor type to gymbal and attempted to run the full calibration sequence again. The motor doesn’t move and after running the dump_errors() command I am met with the following:
‘’’
axis0
axis: Error(s):
ERROR_MOTOR_FAILED
motor: Error(s):
ERROR_MODULATION_MAGNITUDE
encoder: no error
controller: no error
‘’’

I believe I have answered everything. If you need any more information or want me to attempt anything, please let me know!
Thank you

Whoops, after changing the motor type, I forgot to run the commands odrv0.save_configuration() and odrv0.reboot().
After completing the reboot and attempting the full calibration sequence again I am met with the same errors as I first initially posted:
‘’’
axis0
axis: Error(s):
ERROR_CURRENT_MEASUREMENT_TIMEOUT
motor: no error
encoder: no error
controller: no error
‘’’

Does anyone have any ideas? I have tried to debug this on my own, but can’t seem to find anything to remedy this so far.

Sorry been a hectic… ten days… lets just say I am sorry. Ill update this shortly with my reply

Reply: So the first google result for that part number, here https://www.omc-stepperonline.com/24v-4000rpm-025nm-105w-64a-42x42x100mm-brushless-dc-motor-42bls100-24-01.html, states that the motor has 4 poles. Not sure why that trick of powering 2 phases did not work, I have done it before, but only once or twice. Lets try setting that correctly and go from there.

I would also take the time to scan that page for other settings you can add to your config. And if you still have problems, copy the output of odrv0.axis0.config

out of curiousity, what do you have as your cpr? And have you changed the config on your encoder to adjust the ppr?

From wetmelon elsewhere on this forum “ CPR_OUT_OF_RANGE means either your pole-pair setting is wrong, your encoder CPR setting is wrong, or you’re not getting good data from the encoder. This can be due to a wiring issue or a mechanical slippage.”

Also i confused myself on the motor poles. The correct answer is 2 (but if all else fails try 4). Then onto the encoder. These encoders i believe come from factory set up to give 2048 ppr or 8192 cpr same as the cui 102 variety. They can however handle twice the rpm at that range. If you want the doible resolution you gotta plug em into the computer and use their application to change the ppr. Or you could bit bang it.

Thank you for the reply! I gave all of these a shot today. I tried to change the motor poles back to 2 (as well as tried 4). As well with the two different cpr values. However I also noticed that when you set the gymbal motor type, the current lim and calibration current become voltage. So I set both of these to their respective voltage values ( 25V and 24V).
Everything is giving me the same error now, no matter what I do:

axis0
axis: Error(s):
ERROR_MOTOR_FAILED
motor: Error(s):
ERROR_MODULATION_MAGNITUDE
encoder: no error
controller: no error

To give you all of the config I have done so far, I’ll put them all below:

odrv0.axis0.encoder
Out[112]:
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.0007669904152862728 (float)
pos_estimate = 0.0 (float)
pos_cpr = 0.0 (float)
hall_state = 3 (int)
vel_estimate = 0.0 (float)
calib_scan_response = 0.0 (float)
config:
mode = 0 (int)
use_index = False (bool)
find_idx_on_lockin_only = False (bool)
pre_calibrated = False (bool)
zero_count_on_find_idx = True (bool)
cpr = 8192 (int)
offset = 0 (int)
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)
set_linear_count(count: int)

In [114]: odrv0.axis0.motor.config
Out[114]:
pre_calibrated = False (bool)
pole_pairs = 2 (int)
calibration_current = 24.0 (float)
resistance_calib_max_voltage = 4.0 (float)
phase_inductance = 0.0004414464929141104 (float)
phase_resistance = 0.31769099831581116 (float)
direction = 1 (int)
motor_type = 2 (int)
current_lim = 25.0 (float)
current_lim_tolerance = 1.25 (float)
inverter_temp_limit_lower = 100.0 (float)
inverter_temp_limit_upper = 120.0 (float)
requested_current_range = 25.0 (float)
current_control_bandwidth = 100.0 (float)

In [115]: odrv0.axis0.config
Out[115]:
startup_motor_calibration = False (bool)
startup_encoder_index_search = False (bool)
startup_encoder_offset_calibration = False (bool)
startup_closed_loop_control = False (bool)
startup_sensorless_control = False (bool)
enable_step_dir = False (bool)
counts_per_step = 2.0 (float)
watchdog_timeout = 0.0 (float)
step_gpio_pin = 1 (int)
dir_gpio_pin = 2 (int)
calibration_lockin:
current = 10.0 (float)
ramp_time = 0.4000000059604645 (float)
ramp_distance = 3.1415927410125732 (float)
accel = 20.0 (float)
vel = 40.0 (float)
sensorless_ramp:
current = 10.0 (float)
ramp_time = 0.4000000059604645 (float)
ramp_distance = 3.1415927410125732 (float)
accel = 200.0 (float)
vel = 400.0 (float)
finish_distance = 100.0 (float)
finish_on_vel = True (bool)
finish_on_distance = False (bool)
finish_on_enc_idx = False (bool)
general_lockin:
current = 10.0 (float)
ramp_time = 0.4000000059604645 (float)
ramp_distance = 3.1415927410125732 (float)
accel = 20.0 (float)
vel = 40.0 (float)
finish_distance = 100.0 (float)
finish_on_vel = False (bool)
finish_on_distance = False (bool)
finish_on_enc_idx = False (bool)

I thank you for your help thus far again! I hope we can get this figured out :slight_smile:

For that error, see the documentation’s tip about that-
** ERROR_MODULATION_MAGNITUDE = 0x0080*

The bus voltage was insufficent to push the requested current through the motor. If you are getting this during motor calibration, make sure that motor.config.resistance_calib_max_voltage is no more than half your bus voltage.

For gimbal motors, it is recommended to set the motor.config.calibration_current and motor.config.current_lim to half your bus voltage, or less.

Ok looking at what you copied, I would suggest resetting your config. There is some mixed up values I think. Start from default config, follow the getting started guide using the value we came up with for pole pairs and your CPR. Definitely be sure to set your brake resistance correctly too.

I finally made it through the calibration!! Thank you so much.
I reset the board to get rid of any weird changes I had probably made when trying to debug earlier. I then tried to set the following:

In [31]: odrv0.axis0.motor.config.resistance_calib_max_voltage = 12

In [32]: odrv0.axis0.motor.config.calibration_current = 12

In [33]: odrv0.axis0.motor.config.current_lim = 12

I also tried at 10V, but both times it caused the motor to jump aggressively, so I figured I would lower it some more.
It finally worked when I set to 2.5V (Is this what you meant by bus voltage (i.e. 5V)?

Either way, I really appreciate the help! I think that will be all for this one, I will open a new page if I have any more errors related elsewhere.