NO_RESPONSE error with AS5048A encoder

Hi, I’m trying to make work the AMS AS5048A encoder with the ODrive Pro and motor (link). When I run the calibration sequence, the motor moves a bit and then stop, giving the NO_RESPONSE error. I share my configuration and some photos of the connections:

odrv = odrv0
odrv.config.dc_bus_overvoltage_trip_level = 28
odrv.config.dc_bus_undervoltage_trip_level = 10.5
odrv.config.dc_max_positive_current = 4
odrv.config.dc_max_negative_current = -100
odrv.axis0.config.motor.motor_type = MotorType.HIGH_CURRENT
odrv.axis0.config.motor.pole_pairs = 2
odrv.axis0.config.motor.torque_constant = 0.056708701048459535
odrv.axis0.config.motor.current_soft_max = 5
odrv.axis0.config.motor.current_hard_max = 16.5
odrv.axis0.config.motor.calibration_current = 2
odrv.axis0.config.motor.resistance_calib_max_voltage = 10
odrv.axis0.config.calibration_lockin.current = 2
odrv.axis0.motor.motor_thermistor.config.enabled = False
odrv.axis0.controller.config.control_mode = ControlMode.VELOCITY_CONTROL
odrv.axis0.controller.config.input_mode = InputMode.PASSTHROUGH
odrv.axis0.controller.config.vel_limit = 50
odrv.axis0.controller.config.vel_limit_tolerance = 1
odrv.axis0.config.torque_soft_min = -math.inf
odrv.axis0.config.torque_soft_max = math.inf
odrv.can.config.protocol = Protocol.NONE
odrv.config.gpio15_mode = GpioMode.ANALOG_IN
odrv.config.gpio15_analog_mapping.min = 0
odrv.config.gpio15_analog_mapping.max = 25
odrv.config.gpio15_analog_mapping.endpoint = odrv.axis0.controller._input_vel_property
odrv.axis0.config.enable_watchdog = False
odrv.axis0.config.load_encoder = EncoderId.SPI_ENCODER0
odrv.axis0.config.commutation_encoder = EncoderId.SPI_ENCODER0
odrv.spi_encoder0.config.mode = SpiEncoderMode.AMS
odrv.spi_encoder0.config.ncs_gpio = 17
odrv.config.enable_uart_a = False




The encoder parameters are as follows:

image

When I run the calibration sequence, pos_rel stays in zero. I tried reading with a multimeter the voltage on the PWM output of the AS5048A and I get readings when i move the motor’s rotor, so I guess the magnet is properly mounted and aligned. n_errors continues to increase rapidly.

What could be the problem and how can I solve it? Thanks in advance!

As additional information, when i connect the encoder to an Arduino Mega via SPI it can read the angle without problems (with this exact setup), so this confirms there’s no problem with the encoder-magnet setup. Here’s the reading of the angle in Arduino while the ODrive tries to do the calibration (vertical axis is degrees):

First it does this without moving the rotor:


Then when the rotor is moving:

Thank you as always for the really useful and comprehensive overview and information!!! Can’t express how much of a breath of fresh air it is.

Wiring looks great, no concerns there.

Can you try setting GPIO17 mode to DIGITAL? odrv0.config.gpio17_mode = GpioMode.DIGITAL (or equiv setting in GUI), then save_configuration()

If you’re also able to hook up an oscilloscope or logic analyzer to CLK/MISO/MOSI/CSn that would be quite helpful.

It’s been a while since I played with an AS5048, I have one somewhere and I’ll try replicating your setup.

General recommendation though – if you can swap this with an OA1, you’ll have a much nicer experience overall :slight_smile: the SPI can end up being a big issue when you’re actually running the motor, as it’s so sensitive to electromagnetic interferance.

Hi, thanks for the response. I tried setting the gpio17 to DIGITAL but no luck there. I don’t have an oscilloscope with me right now. We ordered a couple of OA1 for the future, but I would like to make this one work for now.

I’ll try to get it wired up tomorrow and share my setup :slight_smile:

Hi, did you have any result?

Hi! Apologies for the delay in my response, had an unexpectedly slammed week, and didn’t get the chance to get to this as much as I would’ve liked to. I’m unfortunately out of town now, will be back in about a week and a half and can prioritize giving this a shot then.

In the mean time, would you be open to taking an oscilloscope capture of the CSn/SCK/MOSI/MISO pins?