Encoder issue: incorrect shadow_count

I tried to drive two motors with 24V v3.5 Odrive board,and encoder was mounted well.I had flashed firmware and entered below codes on Anaconda to set configuration:

odrv0.axis0.motor.config.current_lim=10
odrv0.axis0.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT
odrv0.axis0.motor.config.pole_pairs=11
odrv0.axis0.motor.config.calibration_current=10
odrv0.axis0.motor.config.direction = 1
odrv0.axis0.motor.config.calibration_current = 10.0
odrv0.axis0.motor.config.resistance_calib_max_voltage = 12.0

odrv0.config.brake_resistance=0

odrv0.axis0.controller.config.vel_limit=50000
odrv0.axis0.controller.config.vel_gain = 0.01
odrv0.axis0.controller.config.vel_integrator_gain = 0.05
odrv0.axis0.controller.config.control_mode = 2
odrv0.axis0.controller.vel_setpoint = 400
odrv0.axis0.controller.config.kp_theta = 0.04 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kd_theta = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kp_gamma = 0.0 * 6000 / (2 * 3.1415926)
odrv0.axis0.controller.config.kd_gamma = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)

odrv0.axis0.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis0.encoder.config.cpr = 2000
odrv0.axis0.encoder.config.calib_range = 0.2
odrv0.axis0.encoder.config.use_index=True

odrv0.axis1.motor.config.current_lim=10
odrv0.axis1.motor.config.motor_type=MOTOR_TYPE_HIGH_CURRENT
odrv0.axis1.motor.config.pole_pairs=11
odrv0.axis1.motor.config.calibration_current=10
odrv0.axis1.motor.config.direction = 1
odrv0.axis1.motor.config.calibration_current = 10.0
odrv0.axis1.motor.config.resistance_calib_max_voltage = 12.0

odrv0.config.brake_resistance=0

odrv0.axis1.controller.config.vel_limit=50000
odrv0.axis1.controller.config.vel_gain = 0.01
odrv0.axis1.controller.config.vel_integrator_gain = 0.05
odrv0.axis1.controller.config.control_mode = 2
odrv0.axis1.controller.vel_setpoint = 400
odrv0.axis1.controller.config.kp_theta = 0.04 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kd_theta = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kp_gamma = 0.0 * 6000 / (2 * 3.1415926)
odrv0.axis1.controller.config.kd_gamma = 5.0 / 10000.0 * 6000 / (2 * 3.1415926)

odrv0.axis1.encoder.config.mode = ENCODER_MODE_INCREMENTAL
odrv0.axis1.encoder.config.cpr = 2000
odrv0.axis1.encoder.config.calib_range = 0.2
odrv0.axis1.encoder.config.use_index=True

odrv0.axis0.config.startup_motor_calibration=True
odrv0.axis0.config.startup_encoder_index_search=True
odrv0.axis0.config.startup_encoder_offset_calibration=True
odrv0.axis0.requested_state=AXIS_STATE_STARTUP_SEQUENCE

odrv0.axis0.encoder.config.pre_calibrated=True
odrv0.axis0.motor.config.pre_calibrated = True

odrv0.axis1.config.startup_motor_calibration=True
odrv0.axis1.config.startup_encoder_index_search=True
odrv0.axis1.config.startup_encoder_offset_calibration=True
odrv0.axis1.requested_state=AXIS_STATE_STARTUP_SEQUENCE

odrv0.axis1.encoder.config.pre_calibrated=True
odrv0.axis1.motor.config.pre_calibrated = True

odrv0.save_configuration()
odrv0.reboot()

I got errors below:

In [18]: dump_errors(odrv0)
axis0
axis: Error(s):
ERROR_INVALID_STATE
ERROR_MOTOR_FAILED
motor: no error
encoder: Error(s):
ERROR_CPR_OUT_OF_RANGE

I had tried to run the same codes several times and got the same errors.Therefore I checked M0 wirng and mounting ,but nothing wrong showed up.
I noticed M0 have no promblem with finding index and ‘‘found_index=True’’.However,M0 spined in one direction and stopped instead of changed direction and kept spinning for a while when M0 runed ‘‘encoder_offset_calibration’’.
I also had checked ‘‘axis0.encoder.shadow_count’’,which was initial 0 and alternated between 0 and 1 when I manually spined M0.
Can anyone offer me a kindly help?

Your A or B wire on your encoder is not connected properly.

Hello ! happened to me these mistakes more was the (cpr)

I connected both A B pins to oscilloscope and got square waves as I manually spined motor.But voltage of square waves from A pin alternated between 0V and 5V while the B pin’s alternated between near 4V and 5V.
Is it the cause?

Nope.This one does not apply to mine.Both encoders are in the same kind.

I just unpluged the encoder and powered it with 5V, same issue happened.So probably encoder is the cause and odrive board is OK.