cancel
Showing results for 
Search instead for 
Did you mean: 

Getting speed feedback and start up error whenever i start the motor

soundarya_h_s
Associate III

I am using 24V, 2.0A, 3000RPM and 2 pairs of poles BLDC motor. When ever i start the motor, motor is run far 3 sec and it fetch speed feedback and start up error.

Below i provided the code:

while (1)

{

/* USER CODE END WHILE */

if(flag == 1)

{

MC_StartMotor1();

}

else

{

MC_StopMotor1();

}

 

HAL_Delay(1000);

 

motor1Faults = MC_GetOccurredFaultsMotor1();

//motor1Faults = MC_GetCurrentFaultsMotor1();

if(motor1Faults & MC_DURATION)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_DURATION", 12,100);

}

if(motor1Faults & MC_OVER_VOLT)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_OVER_VOLT", 13,100);

}

if(motor1Faults & MC_UNDER_VOLT)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_UNDER_VOLT", 14,100);

}

if(motor1Faults & MC_OVER_TEMP)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_OVER_TEMP", 13,100);

}

if(motor1Faults & MC_START_UP)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_START_UP", 12,100);

}

if(motor1Faults & MC_SPEED_FDBK)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_SPEED_FDBK", 14,100);

}

if(motor1Faults & MC_BREAK_IN)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_BREAK_IN", 12,100);

}

if(motor1Faults & MC_SW_ERROR)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"MC_SW_ERRORS",12,100);

}

/* USER CODE BEGIN 3 */

}

/* USER CODE END 3 */

}

 

void setMotorSpeed(uint16_t target_speed)

{

static uint16_t previous_speed = DEFAULT_TARGET_SPEED_RPM;

static uint16_t duration = 0;

const uint16_t slope = 3000;

if (target_speed > MAX_APPLICATION_SPEED_RPM)

{

HAL_UART_Transmit(&huart2, (uint8_t*)"Target speed exceeds the max", 29, 100);

return;

}

else

{

if(target_speed < previous_speed)

{

duration = (previous_speed - target_speed) / slope;

duration = duration * 1000;

}

else

{

duration = (target_speed - previous_speed) / slope;

duration = duration * 1000;

}

MC_ProgramSpeedRampMotor1_F(target_speed, duration);

previous_speed = target_speed;

}

}

 

void HAL_UART_RxCpltCallback(UART_HandleTypeDef *huart)

{

 

char TempBuffer[40] = "Invalid command or RPM value\r\n";

 

HAL_UART_Transmit(&huart2, (uint8_t*)rxbuffer, sizeof(rxbuffer),1000);

HAL_UART_Receive_IT(&huart2, (uint8_t*)rxbuffer, sizeof(rxbuffer));

 

if (strncmp((const char*)rxbuffer, "start", sizeof("start") - 1) == 0)

{

flag = 1;

//MC_StartMotor1();

 

}

else if (strncmp((const char*)rxbuffer, "stops", sizeof("stops") - 1) == 0)

{

flag = 0;

//MC_StopMotor1();

}

else

{

 

rxbuffer[4] = '\0';

uint16_t rpmValue = atoi((char*)rxbuffer);

if (500 <= rpmValue && rpmValue <= 3000)

{

setMotorSpeed(rpmValue);

}

else

{

HAL_UART_Transmit(&huart2, (uint8_t*)TempBuffer, sizeof(TempBuffer), 100);

}

 

}

}

 

Below i provided output screen:

soundarya_h_s_0-1704714795192.png

can anyone with any suggestion or any input why i am getting this error?

 

2 REPLIES 2
cedric H
ST Employee

Hello @soundarya_h_s ,

Could you please provide the version of the MCSDK you are using?

Which boards do you use?

Did you try to profile your motor first?

Regards.

Cedric.

soundarya_h_s
Associate III

hi @cedric H 

I am using STM32G474RE board, uisng motor control workbench 6.1.2 and I have checked motor with motor profiler.

I want to know that why i am getting this fault errors.

Also can you tell me how to resolve this error