Another take on the AS5047P encoder (PWM absolute position)

I have been using an ODrive 48V V3.5 to control a big PMS motor using the incremental output from an AS5047P.

This has been working well and I have been playing with the anticogging feature in the devel branch.
After quite a bit of tuning of the gains I managed to get the anticogging working. It makes a huge difference.

Anyway, as well as the ABI and SPI interface the AS5047P has a PWM interface where the absolute position is encoded the as a pulse width signal. This is shown in the AS5047P datasheet:

This interface can be enabled as well as the ABI interface using SPI. The configuration can be made permanent using the OTP configuration write. While setting this I figure I may as well move from ‘decimal’ mode to ‘binary’ mode for the tiny bit more resolution (4000CPR -> 4096CPR),

While you cant get access to the full 14bit resolution you would normally get when using SPI, you can still get 12 bits assuming that you can measure the pulse width sufficiently accurately.

The idea would be that you connect this signal to the Z encoder channel and read the absolute position at startup to get the initial motor position. After that you just use the quadrature signal as normal.

This means that you can still use a 5 wire interface to the encoder.

I have not started on the code for this yet, I will start that next week. I am still not extremely familiar with the firmware so I will have some questions about the best implementation. I think that github may be a better place for that discussion.

So, any thoughts?

Tobin.

1 Like

Hi Tobin, this seem to be a good idea, have you implemented it yet?

I sure did, but I fairly quickly moved on to absolute SPI comms instead.
The implementation is here, though it is based on a fairly old version of devel at this point.
I have not had nearly as much time for Odrive dev recently. There are several people looking into hardware expansion for differential SPI coms. Could be worth checking that out too.
The discord channels are fairly active, you should check them out if you haven’t already.
Tobin.

Hi! Could you help me with the implementation of the work of the absolute encoder MagAlpha702. It works over SPI. I tried to go through your brunch and determine what should I do in order to adapt my encoder for ODrive. How difficult is it to make it happened? Do you consider paid assistance? We have around 20 of this encoders and its too expensive to replace them with AS5047/AS5048 Encoders.
https://www.monolithicpower.com/en/documentview/productdocument/index/doc_url/L20vYS9tYTcwMl9yMS4wLnBkZg/prod_id/MjUzMA/ link to datasheet for MagAplha 702

Thank you.

Hi.
Unfortunately I am very busy with work at the moment, I don’t have time to implement support for this encoder. There is some code for SPI comms which should be fairly easy to add support for this encoder to. @Wetmelon’s Razors Edge Branch has support for SPI encoders.
You need to look at the encoder source and header files. Everything related to the SPI encoders should be prefixed with abs_spi_ and should be easy to understand.

Good luck.