Hi everyone,
This is my schematic:
And source code:
void bldc_motor(void) { HAL_Delay(2000); HAL_TIM_PWM_Start(&htim2, TIM_CHANNEL_3); // Start PWM __HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_3, 20); // Duty = 20% HAL_Delay(1000); HAL_GPIO_WritePin(BLDC_DIR_GPIO_Port, BLDC_DIR_Pin, GPIO_PIN_SET);// DIR = 1 HAL_GPIO_WritePin(BLDC_BRAKE_GPIO_Port, BLDC_BRAKE_Pin, GPIO_PIN_SET);// BRAKE = 1, turn-off brake HAL_GPIO_WritePin(BLDC_EN_GPIO_Port, BLDC_EN_Pin, GPIO_PIN_SET);// EN = 1 - ON for (int i = 0; i < 5; i++) { __HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_3, 50); // Duty = 50% HAL_Delay(2000); __HAL_TIM_SET_COMPARE(&htim2, TIM_CHANNEL_3, 20); // Duty = 20% HAL_Delay(2000); } HAL_GPIO_WritePin(BLDC_BRAKE_GPIO_Port, BLDC_BRAKE_Pin, GPIO_PIN_RESET); // Brake = 0 HAL_GPIO_WritePin(BLDC_EN_GPIO_Port, BLDC_EN_Pin, GPIO_PIN_RESET); // EN = 0 }
The motor I use
http://www.wonsmart.com.cn/ws7040-24-v200-15655816895217949.html
Normally, the system works well and the motor still rotates, reverses, adjusts speed...
However, at some time I cannot start the motor.
If I deflect the rotor out of its current position the motor will rotate.
Please view attached video.