Encoder index triggered "found" when calibrating motor

hi all,
i figured out the odrive changes the index_found to true when doing the motor calibration.

the encoder i use is a us digital E5 with 2500ppr.

using the oscilloscope to check if the encoder signal is correct, the index pulse signal is rising above 4.5V as expected when i turn the encoder by hand. the signal is nice and square.

below is the odrivetool output when not manually interacting

Reconnected to ODrive 205337943548 as odrv0
In [14]: odrv0.axis0.encoder
Out[14]:
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.45151233673095703 (float)
pos_estimate = 0.0 (float)
pos_cpr = 0.0 (float)
hall_state = 1 (int)
vel_estimate = 0.0 (float)
config:
mode = 0 (int)
use_index = True (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
zero_count_on_find_idx = True (bool)
cpr = 10000 (int)
offset = 9820 (int)
offset_float = 0.849484384059906 (float)
enable_phase_interpolation = True (bool)
bandwidth = 1000.0 (float)
calib_range = 0.019999999552965164 (float)
ignore_illegal_hall_state = False (bool)

In [15]: odrv0.axis0.requested_state = AXIS_STATE_MOTOR_CALIBRATION

In [16]: odrv0.axis0.encoder
Out[16]:
error = 0x0000 (int)
is_ready = False (bool)
index_found = True (bool)
shadow_count = 3 (int)
count_in_cpr = 3 (int)
interpolation = 0.5 (float)
phase = 0.45905208587646484 (float)
pos_estimate = 3.234375 (float)
pos_cpr = 3.234375 (float)
hall_state = 2 (int)
vel_estimate = 0.0 (float)
config:
mode = 0 (int)
use_index = True (bool)
pre_calibrated = False (bool)
idx_search_speed = 10.0 (float)
zero_count_on_find_idx = True (bool)
cpr = 10000 (int)
offset = 9820 (int)
offset_float = 0.849484384059906 (float)
enable_phase_interpolation = True (bool)
bandwidth = 1000.0 (float)
calib_range = 0.019999999552965164 (float)
ignore_illegal_hall_state = False (bool)

any ideas?

Does the motor turn past the index location during the motor calibration? Or is this a false positive index found?

hi @madcowswe,
it is definitely a false positive, the same thing happens wherever the rotor stands and no movement is made.
i figured there is slightly more electrical noise on the index channel when doing the motor calibration, but not enough to trigger the oscilloscope trigger at 1.5V.
the cable should not be the issue - it is shielded and the shield connected to ground.

i will try the other odrive controller if it behaves the same and keep you posted.

i just tried the second odrive:
there is the same issue, although the trigger level for the false positive might be different.
the motor calibration is not sufficient to trigger the index found. however, during the encoder offset calibration, it only inconsistently finds the true index location.

as you know, i have modified the shunts to drive a low current motor and downloaded the custom firmware with only the changed value for the shunt resistance. is there any possibility the changed shunts affect the encoder trigger levels?

update:
i tried to add a pull down resistor on the index channel of the encoder. this did not solve the problem on the first odrive that i started this thread with.

how is the trigger level on the encoder channels defined?

the thing is: tinkering with settings and continuously reboting, power cycling, adding and removing pull-downs of different values, etc. i now have the odrive in a state it finds the index (so far) reliably.
concerning the connections it is currently at the same state as i had the problems before. on the scope, the signal of the index is the same as when i had the trouble.

this causes me some headache since i have to be afraid the once seen behavior reappears.

i use it for the movement of a filter fan in a restricted section, so a wrong index position would cause the filter holder to repeatedly crash into the housing.

so, i finally managed to capture a situation that causes trouble concerning the encoder index.
as you can see in the image below, there are spikes on the encoder index line at a constant frequency of about 47.6kHz (21us interval).
in the given situation, the spikes trigger consistently at a trigger level of 1.45V.

further investigation shows that these spikes are on the signal during closed loop control and disappear once the axis state is set to idle.
@madcowswe, might the pwm cause these spikes?

for positioning, i coded a workaround using a hard stop that i approach using current control during initialization, but i would definitely want to remove the effect if possible. sometimes the behavior of the controller is erratic. possibly because of similar effects.