How to connect with SPI encoder AS5048A

I try to connect the odrive v3.6-56v with SPI encoder, but i can’t

This is a code what i set up in cmd

odrv0.erase_configuration()
odrv0.axis0.motor.config.current_lim = 10
odrv0.config.brake_resistance = 2
odrv0.axis0.motor.config.pole_pairs = 14
odrv0.axis0.motor.config.motor_type = MOTOR_TYPE_GIMBAL
odrv0.axis0.encoder.config.abs_spi_cs_gpio_pin = 8
odrv0.axis0.encoder.config.mode = ENCODER_MODE_SPI_ABS_AMS
odrv0.axis0.encoder.config.cpr = 2**14              
odrv0.save_configuration()
odrv0.reboot()
odrv0.axis0.requested_state = AXIS_STATE_FULL_CALIBRATION_SEQUENCE
dump_errors(odrv0) 

And i get it

In [15]: dump_errors(odrv0)
system: not found
axis0
  axis: Error(s):
    UNKNOWN ERROR: 0x00000100
  motor: no error
  sensorless_estimator: no error
  encoder: Error(s):
    ENCODER_ERROR_ABS_SPI_COM_FAIL
  controller: no error
axis1
  axis: no error
  motor: no error
  sensorless_estimator: no error
  encoder: no error
  controller: no error

I try to get the value of AS5048A in ardunio, and I did.

Help me ! how to connect

But in your picture, it looks like it is plugged in to GPIO 8.

oh, i try gpio 3 and gpio 8, but i can’t

It could be the issues seen in this thread:

Try adding some series resistors (e.g. 50 Ohm) to the MOSI, MISO and SCK wires.

What happens if you do a dump_errors(odrv0) right after save_configuration() and reboot(), without even attempting the calibration sequence?
I’ve run into the same issue with the same encoder, but with hoverboard motors, and I always got ENCODER_ERROR_ABS_SPI_COM_FAIL already after saving configuration and rebooting.

Anyway, the solution turned out to be a pull-up resistor on the encoder’s CS pin; for details see my WIP patch at: docs/encoders.md: recommend a pull-up resistor on CS pin for AMS enco… · szeder/ODrive@66e4856 · GitHub.
Could you try a pull-up and please report back whether it worked for you as well? (Assuming your wiring is otherwise OK; we had to go all out with LVDS over twisted pairs…)

2 Likes

Hello! I faced the same problem. Just soldered 4.3K resistor between 4 pin and AVDD. Still have ENCODER_ERROR_ABS_SPI_COM_FAIL error after reboot. If i disconnect CS pin from the working device and connect it again encoder(AS5048A) starts working, but during full calibration it goes offline again :frowning:

I don’t know the role of the AVDD pin; I see that it is around 3.3V, but I don’t know what it does after the ODrive (re)starts.

Anyway, I wired the pull-up resistor to one of the 3.3V pins.

@nghiank97 unrelated to the topic, but I just registered and can’t send a direct message. Could you explain your photo a little bit please? I understand that the motor on your picture is RMD-S with a built in controller board.
Do you somehow compliment that controller with ODrive, or do you bypass the built in driver completely and control BLDC part of that motor with ODrive directly?

Thanks!