Encoder Index Found always gets updated


#1

I am trying to use z pin of the encoders for that I am requesting state = AXIS_STATE_ENCODER_INDEX_SEARCH after the calibration of motors. But nothing happened. I am getting no error bits. Also , one problem I have noticed that the variable index_found becomes true as soon as I started O drive even the z pin is low.
These are the config settings I have used

config:
  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)
  step_gpio_pin = 7 (int)
  dir_gpio_pin = 8 (int)
  ramp_up_time = 0.4000000059604645 (float)
  ramp_up_distance = 12.566370964050293 (float)
  spin_up_current = 10.0 (float)
  spin_up_acceleration = 400.0 (float)
  spin_up_target_vel = 400.0 (float)

encoder:
  error = 0x0000 (int)
  is_ready = False (bool)
  index_found = True (bool)
  interpolation = 0.5 (float)
  phase = -0.2883787155151367 (float)
  pos_estimate = 0.0 (float)
  pos_cpr = 0.0 (float)
  hall_state = 6 (int)
  vel_estimate = 0.0 (float)

The state requested is

odrv0.axis1.requested_state= AXIS_STATE_ENCODER_INDEX_SEARCH 

Problem : Nothing happened after this command .
Hope for a quick reply @madcowswe sir.


#2

What encoder are you using? What cable are you using?
This is likely caused by electrical noise on the index line.


#3

Thanks for the reply @madcowswe , I am using Yumo E6B2-CWZ3E 1096 ppr encoders with a properly made 5 pin relimate connector. I have checked the connections atleast 5 times and my z pin is also working with other mcu but still problem persists with o-drive.


#4

Do you have a shield on the cable connected to ODrive GND? Can you check with an oscilloscope with a trigger level set to around 1.5V?


#5

Hi, actually I have resolved the problem . When checked with oscilloscope , I found that the index pin is in high state when no index is found and becomes low on finding index. And may be odrive index works on level triggering. I have resolved the problem by using a not gate with the index pin. Thanks @madcowswe for the help . Can I find any doc related to the firmware or how the code works in odrive. Thanks.