MOT: PP check: fail - estimated pp:16.4384

Good morning, everyone. After calibration, such a message. I think something is wrong. Is it so?
Безымянный

Hey @nikolaewich1988,
Yeah, failed pole pair number check usually indicates that there is something whong.
But it doesn’t have to be so. Pole pair check is optional.
If your motor spins after this check and if you can control it, you can ignore the message. If your motor is stuck and drawing a lot of current, there is something wrong. :slight_smile:

What is the number of the pole pairs of your motor?
Can you describe your setup, driver, sensor, mcu and the motor?

Hello. atmega 328, motor hoverboard (15), rotaryencoder 600ppr. cw & ccw have different speeds (5, -5)

#include <SimpleFOC.h>
int S;

BLDCMotor motor= BLDCMotor(15);
BLDCDriver3PWM driver= BLDCDriver3PWM(9, 10, 11, 8);

Encoder encoder= Encoder(2, 3, 600);

void doA(){encoder.handleA();}
void doB(){encoder.handleB();}

Commander command= Commander(Serial);
void onMotor(char* cmd){command.motor(&motor, cmd);}
struct _poligonInexes{
int minIndex;
int maxIndex;}
;
int _Poligon_InArray_2[4] = {0, 12, 22, 1000};
int _Poligon_OutArray_2[4] = {0, 0, -3, -7};
int _Poligon_InArray_3[4] = {0, 12, 22, 1000};
int _Poligon_OutArray_3[4] = {0, 0, 3, 7};
int _gtv2;
void setup(){

encoder.init();
encoder.enableInterrupts(doA, doB);
motor.linkSensor(&encoder);
driver.voltage_power_supply = 24;
driver.init();
motor.linkDriver(&driver);
motor.foc_modulation = FOCModulationType::SpaceVectorPWM;
motor.controller = MotionControlType::torque;
motor.PID_velocity.P = 0.1f;
motor.PID_velocity.I = 6;
motor.PID_velocity.D = 0;
motor.voltage_limit = 8;
motor.LPF_velocity.Tf = 0.01f;
motor.P_angle.P = 20;
motor.velocity_limit = 50;
motor.init();
motor.initFOC();
motor.target = 2;
}
void loop(){
S = _gtv2;
motor.loopFOC();
motor.move(S);
command.run();
if (!(((analogRead (0))) > (20))){_gtv2 = (_poligon(((analogRead (1))), _Poligon_InArray_3, _Poligon_OutArray_3, 4));}
if (!(((analogRead (1))) > (20))){_gtv2 = (_poligon(((analogRead (0))), _Poligon_InArray_2, _Poligon_OutArray_2, 4));}
}
int _poligon(int value, int intArray[], int outArray[], int arraySize)
{
struct _poligonInexes indexes;
indexes = _getPoligonIndexes(value, intArray, arraySize);
return map(value, intArray[indexes.minIndex], intArray[indexes.maxIndex], outArray[indexes.minIndex], outArray[indexes.maxIndex]);
}
struct _poligonInexes _getPoligonIndexes(int value, int array[], int arraySize)
{
struct _poligonInexes result;
int i;
result.minIndex = 0;
result.maxIndex = 0;
for (i = 0; i < arraySize; i++) {if (array [result.minIndex] > array[i]) { result.minIndex = i;}
if (array [result.maxIndex] < array[i]){result.maxIndex = i;}
}
for (i = 0; i < arraySize; i++)
{
if ((array [i] >= value) && (array [result.maxIndex] > array[i]))
{result.maxIndex = i;}
}
if (result.maxIndex==0)
{
result.minIndex = 0;
result.maxIndex=1;
}
else
{
result.minIndex = result.maxIndex -1;
}
return result;
return result;
}