I am using odrive 3.6 (56V), AS5047P absolute encoders, SPI, firmware v0.5.1
This is the code I have sent to the drives:
odrv0.erase_configuration()
odrv0.config.brake_resistance = 0
odrv0.config.dc_max_negative_current = -5
odrv0.axis0.motor.config.pole_pairs = 20
odrv0.axis0.encoder.config.cpr = 214
odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 3
odrv0.axis0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS
odrv0.axis1.motor.config.pole_pairs = 20
odrv0.axis1.encoder.config.cpr = 214
odrv0.axis1.encoder.config.abs_spi_cs_gpio_pin = 4
odrv0.axis1.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS
odrv0.save_configuration()
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.axis1.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
odrv0.save_configuration()
odrv0.axis0.motor.config.pre_calibrated = True
odrv0.axis0.config.startup_encoder_offset_calibration = True
odrv0.axis0.config.startup_closed_loop_control = True
odrv0.axis0.encoder.config.pre_calibrated = True
odrv0.axis1.motor.config.pre_calibrated = True
odrv0.axis1.config.startup_encoder_offset_calibration = True
odrv0.axis1.config.startup_closed_loop_control = True
odrv0.axis1.encoder.config.pre_calibrated = True
odrv0.save_configuration()
odrv0.reboot()
As an aside, I send the calibration sequence individually to each axis after I power cycle the board (i.e.
Send the first set of commands and do the save
Power down the board
Send the calibration to axis0 and wait for completion
Send the calibration to axis1 and wait for completion
Save
Send the remaining code to the board, save & reboot.
I have the two encoders: MOSI, MISO, SCK connected to the same SPI inputs on the Odrive
I have encoders power connected to 3.3V of the incremental inputs ( M0 & M1)
I have the encoders ground connected to the last two ground pins of the SPI inputs
This works for me, might give it a try.
When I re-power the ODrive, the motors perform a small turn (L & R) then go into Closed Loop Mode
Only thing I would like to see different is for the motors to NOT perform the small turn on power up, but have been unable to figure that one out.
Hope it helps
Ciao