Six step BLDC Control(X-NUCLEO-IHM11M1)
Hi,
We are trying to drive our 4v BLDC motor using the X-NUCLEO-IHM11M1 with the ST Nucleo board.
The logic we implemented is,
DELAYTIME-10ms ,FREQUENCY - 20KHz,DUTYCYCLE-50%
static void PhaseZeroClockwise(void){
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Stop(&htim1,TIM_CHANNEL_3) ;
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}
static void PhaseOneClockwise(void){
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim1,TIM_CHANNEL_3);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}
static void PhaseTwoClockwise(void){
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim1,TIM_CHANNEL_3) ;
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}
static void PhaseThreeClockwise(void){
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Stop(&htim1,TIM_CHANNEL_3) ;
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}
static void PhaseFourClockwise(void){
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim1,TIM_CHANNEL_3) ;
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}
static void PhaseFiveClockwise(void){
HAL_TIMEx_PWMN_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_1);
HAL_TIMEx_PWMN_Start(&htim1, TIM_CHANNEL_2);
HAL_TIM_PWM_Stop(&htim1, TIM_CHANNEL_2);
HAL_TIMEx_PWMN_Start(&htim1,TIM_CHANNEL_3) ;
HAL_TIM_PWM_Start(&htim1, TIM_CHANNEL_3);
HAL_Delay(DELAYTIME);
}

Observations when the above logic is implemented:
1) When the motor is driven in open loop condition it is rotating good, only when the frequency is 20KHz and duty cycle is 20% and 50% and the delay between each states is 10ms. The hall sensor is read, those readings seem to match with the input mosfet signals.
2) When the delay between each commutation states is varied, the motor rotates but the hall sensor signal read is not in sequence and the phase is skipped.
3)Also, when the duty cycle is varied, the motor is finding difficult to rotate. It stucks inbetween.
4) Motor works only When the frequency of the PWM is varied between 20 to 25KHz
Queries we have:
1)What shall be the Frequency of the PWM to be set?
2)Will there be mismatch in reading the hall sensor signals when the delay between states is changed(when operated in open loop condition)? How to choose that delay time?
3)How to operate in closed loop condition with hall sensor inputs?
Note: We are trying to procure the nucleo board(NUCLEO-G431RB) required to test the X-NUCLEO-IHM11M1 with Motor control Workbench. Apart from this, For now could you suggest any ways help us drive the motor?
