ODrive Micro Issues with SPI and AS5048a

Hello - we are trying to get an AS5048a encoder working with the ODrive Micro; however, we’re bumping into several issues. We’re using an AS5048a Dev Board AS5048A-TS_EK_AB. MOSI is pulled high to 5V as per the ODrive docs.

The main issue is an intermittency issue - when viewing plots on the ODrive GUI, there are clearly points where data is missing. However, when viewing the MISO line on the scope, I can clearly see data.

This intermittency issue can be reproduced easily by physically disturbing the cabling in between the encoder and the ODrive Micro. We thought it might be a cabling related issue, but after testing numerous harnesses and reworking connections, it does not appear to be a component level or wiring issue with respect to the cabling. I have also tested changing up power sources.

I also scoped the V+ and GND lines to look for dips or bounces, but nothing seemed out of the ordinary,

Additionally, we observed that the ODrive Micro has some strange behavior that upon a power cycle or the above-described intermittency issue, it will reset the encoder position plot to 0. I was able to observe this behavior by: a) Setting the encoder position to a non-zero value as shown by the ODrive GUI, b) recording the scope readings, c) trigger a reset such that the encoder position shows 0 on the ODrive GUI despite not changing the physical position of the encoder, d) recording the scope readings. Before and after the position reset, the encoder readings on the scope looked characteristically the same, which makes me suspicious that the ODrive Micro is zeroing the reading for some random reason. Additionally, we put a scope on the PWM output of the encoder, and that value persisted between power cycles, intermittency, etc, which makes me believe the encoder readings are behaving as expected.

Any advice on this intermittency issue, as well as the ODrive’s strange zeroing response to said intermittency issue would be greatly appreciated.

Also, if this is an issue that is related to SPI encoders, are there any encoders that are compatible with the ODrive Micro that either are tested to have fewer issues than the AS5048a, or use another communication protocol that works with the ODrive?

Thank you!

Hi! The AS5048A has a lot of issues with its protocol and EMI resiliency, I generally recommend against it for this reason. SPI additionally can be quite sensitive to EMI – I would recommend shielding the cables (terminating shield to the digital ground at the Micro) and/or routing them away from the motor and power wires, if possible.

You can also try updating to devel firmware (in the firmware update tab of the GUI) and setting ignore_error_flag to true (and then running save configuration). Alternatively, you can try increasing max_error_rate to e.g. 0.5, which will allow the ODrive to ignore a few cycles of intermittent missed data.

Regarding the position reset-to-zero, this is expected functionality – by default, the ODrive will use the relative position since power-on. If you want to instead use the absolute position of the encoder, you can set up the absolute encoder reference frame.

Typically I would recommend using the MA702 encoder IC, it’s much higher performing than the AS5048A and with a more robust protocol. However, breakout boards are typically not available, which can be tricky.

Overall, I would recommend:

  1. Shield the encoder lines. This can be done with some aluminum foil, connected to a GND pin on the Micro’s J1 FEEDBACK IO header.
  2. If you’re still getting issues, try increasing max_error_rate to a maximum of 1
  3. If that doesn’t help, you can update to devel firmware and set ignore_error_flag to true.