Hey Adam,
I receive this 3 pole resolver for the 3 pole pair motor next week.
Currently my 4 pole pair motor with my 1 pole resolver I have this to convert the mechanical angle to electrical and handle the wrap around - same as QEI block does. The resolver position is 0-4095. The number of pole pairs is 4.
// Do the same conversions and such as the QEI module to convert the resolver
// position value into the format used by the KMS modules.
_lq tempLQ;
// Shift the position to get a 0 angle output at desired point.
resolverPos += resolver->internal.encoderZeroOffset ;
resolverPos %= resolver->internal.encoderMaxCount ;
/* convert raw count into mechanical rotor angle */
tempLQ = _LQmpyLQX((_lq)resolverPos, 0, resolver->internal.angleScalar, GLOBAL_LQ);
/* convert mechanical rotor angle into electrical rotor angle */
tempLQ = tempLQ * resolver->internal.polePairs;
/* wrap electrical rotor angle around _LQ(2.0) */
tempLQ = tempLQ & 0x0001FFFFFF;
/* wrap electrical rotor angle between _LQ(-1.0) and _LQ(1.0) */
return UTIL_angleWrapAround(tempLQ);
For the 3 pole resolver with 3 pole pair motor, my mechanical angle will be equal to the electrical angle, so I would think don't need to multiply the mechanical angle by the number of pole pairs now so that it does not look like I am taking 3 revolutions in 1 revolution? From your answer above it sounds like I still need to do this so I don't think I am making 3 revolutions in 1 revolution, so does the above function stay the same or does it change to the below?
// Do the same conversions and such as the QEI module to convert the resolver
// position value into the format used by the KMS modules.
_lq tempLQ;
// Shift the position to get a 0 angle output at desired point.
resolverPos += resolver->internal.encoderZeroOffset ;
resolverPos %= resolver->internal.encoderMaxCount ;
/* convert raw count into mechanical rotor angle */
tempLQ = _LQmpyLQX((_lq)resolverPos, 0, resolver->internal.angleScalar, GLOBAL_LQ);
/* convert mechanical rotor angle into electrical rotor angle */
tempLQ = tempLQ;
/* wrap electrical rotor angle around _LQ(2.0) */
tempLQ = tempLQ & 0x0001FFFFFF;
/* wrap electrical rotor angle between _LQ(-1.0) and _LQ(1.0) */
return UTIL_angleWrapAround(tempLQ);