I have a 14 pole-pair motor with a AS5047P encoder (ABI interface, 4096 CPR) and seem to have configured the index and able to do some position control after loose tuning, but the move_to_pos() function only works across a small range of counts, about 5900.
It may be an encoder issue, but I am not sure. Any ideas on what could be a cause of this?
I have verified that the actual number of magnet poles matches what was in the datasheet of the motor; as for the encoder, I am assuming it is on the default mode of 4096 counts.
I managed to set up the encoder with index signal, and it searches for the index at startup.
The only issue I had so far with this encoder is that I had to relax the accuracy of encoder counts during calibration (encoder.config.calib_range = 0.05), to overcome error ERROR_CPR_OUT_OF_RANGE.
Another issue, probably related, is that the velocity and current control modes do not work.
Position plots (blue=pos_estimate, orange=pos_setpoint):
I can add to this that although I didn’t directly check CPR, that this 5900 count range is roughly 1.5 turns by eyeballing, which is roughly 5900/4096, so on first observation the resolution setting seems to agree with the default value of the AS5047P.
In fact velocity and current control seem to start off OK, but they hit this same artificial position limit that the motor will not move away from, as if some secondary position control was in action. Can only turn a bit over half a rev each way.
Motor turns freely by hand when unpowered, and positional feedback seems fine, for multiple revs.
My issue was very similar to this one, but I tried changing over to 3.3V encoder operation with no difference:
This one looks like a hard issue to solve remotely, so possibly why no reply, or someone maybe looking into it. My initial thoughts are the index pulse is not correct as the demanded position goes past a certain point with the motor stopping and then recovering once t comes back past the same point, as if it tries to find the index pulse past 4096 counts but stops the motor at 902 counts past either direction (4096 + (2 x 902) = 5900).
I would look at the index pulse first, its configuration or changing the Counts Per Revolution if configurable.
Could you connect the AS5047P into a separate microcontroller and set the ODrive to sensorless control so that you could test and get confidence in the encoder’s output? (Just a test).
I may be way off, although it’s hard to judge and may give you a starting point.
Unfortunately I haven’t yet been able to detect the index pulse using the code below.
I don’t have a scope at hand right now, so I’ll try and troubleshoot as much as I can until I can observe the index.