jmelson wrote:It's not a great or preferred solution, but there is an alignment routine built in to bldc which blindly energises the poles in a particular pattern and takes note of the resulting encoder counts.
OK, that sounds quite interesting. You'd have to move the motor up to one
full turn to reach the index position,
it's not actually that complicated. The point is that all that matters for commutation is the motor magnetic positon. bldc simply takes the position with A at +V and B,C at -V as commutation angle zero (it's as good a choice as any). All the commutation inputs and outputs use this same convention internally, and it doesn't actually matter if this doesn't match the motor or drive assumptions because it all eventually cancels out.
The magnetic alignment process just wiggles the phases clockwise and anticlockwise, converging on the A+ B- C- position (an attempt to shake stiction free)
There are far cleverer ways to do it based on back-emf etc, and sensorless drives do exactly that, but AFAIK there is no way to get that data in to HAL, so it can't be used.
if anyone comes up with a scheme, I am happy to integrate it into bldc. ditto for any encoder schemes, I have already included the Fanuc 16 position commutation as both input and output modes, so for example you can (badly) translate Fanuc Gray code into Hall signals for a non-Fanuc drive. it's not a good solution, as 6 into 16 doesn't go, but it is enough to spin a motor until an index is seen and the component can start commutating sinusoidally.