Encoder error 0x0002 by using motor with reduction gear

I have a rotary encoder mounted to a motor with reduction gear. After I saved the configuration and reboot the odrive 3.5 24v board. I get the beep and motor rotation in one direction. And I get the encoder error code 0x0002 and different hall state after each reboot. I tried to find a solution by browsing in the forum. Then I have see Oska provided a solution for this error. I followed this solution but I still get the error code. Oska said remove any load from the motor at startup. So here is my question, is it that odrive isn’t support motor with reduction gear?

my encoder state shown below:
In [80]: odrv0.axis0.encoder
error = 0x0002 (int)
is_ready = False (bool)
index_found = False (bool)
shadow_count = 1022 (int)
count_in_cpr = 1022 (int)
interpolation = 0.5 (float)
phase = 3.136990785598755 (float)
pos_estimate = 1022.2396850585938 (float)
pos_cpr = 1022.2396850585938 (float)
hall_state = 5 (int)
vel_estimate = 0.0 (float)
mode = 0 (int)
use_index = False (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
cpr = 4096 (int)
offset = 0 (int)
offset_float = 0.0 (float)
bandwidth = 1000.0 (float)
calib_range = 0.05000000074505806 (float)

Hi…If you want to detect direction as well as amount of movement, you need to use 2 photo interrupter instead of just one. The code track can just be a series of holes drilled in the disc at regular intervals, with the hole diameter about half of the distance between hole centres or slightly greater. The 2 photo interrupters can both read the same holes, they just need to be placed so that one of them is over the centre of a hole when the other is over the edge of a hole.

pcb assembly

If you use a gear reduction to connect your encoder to the motor, you need to account for it in the encoders CPR value.

If your encoder is for example connected to your motor through a 2:1 gear ratio, and your original CPR is 2400, then you need to input a CPR-value of 1200 instead. And you also need to make sure that your resulting CPR-value is a whole number. So I can’t use a gear ratio of 7:1 with an encoder with an original CPR of 2400

Actually you can fiddle with the pole-pairs and CPR values to create a whole-number CPR if you really care that much

1 Like

The encoder mounted on the output of the gearbox via a 3d printing shaft, the cpr is 4096, the gearbox ratio is 14:1, so the resulting cpr values isn’t a whole number. So the encoder may not adapt this gearbox.
But someone said I can’t mout the encoder on the output of the gearbox, espeacially via a 3d printing shaft. I need to mount the encoder on the back of motor if I using a reduction gearbox, so I need to buy a new dual shaft motor. I’m not sure which point is correct. But I use the hall sensor feedback, the motor can fully calibration.