cancel
Showing results for 
Search instead for 
Did you mean: 

Six step BLDC Control(X-NUCLEO-IHM11M1)

_Danny_
Associate II

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);
}

_Danny__0-1703118271534.png

 

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?

 

 
 
4 REPLIES 4
SRedd.5
Senior III

There are limitations in running the motor in the open loop, i use open loop only to test the hardware issues like the hall signal is toggling or not when the motor is running. PWM section is working as per the set frequency etc. and other features.

In closed loop condition. 

Read the hall sensor signals the micro has the feature and when the hall state changes you get an interrupt read H1,H2,H3 and based on the state switch on the PWM as per the truth table.

Hi,

Thank you for your response.

I have been trying to run the motor in the Clockwise Direction(CW) i.e step sequence Reverse. When i try to run in the sequence 6,5,4,3,2,1 i am not getting the hall values as shown in the below image, Instead i got the hall values as 001 for sequence 6, 101 for sequence 5, 100 for sequence 4, 110 for sequence 3, 010 for sequence 2, 011 for sequence 1. 
What shall be done to solve this one. 

image (1).png

For 6 step commutation there will be one time calibration procedure to be performed to find the correct sequence to drive the motor. 

For example

If H1, H2, H3 are fixed you have to find the right phase sequence to switch ON the PWMs

Ex:

H1=0, H2=0,H3 = 1; U Phase=PWM ON, V Phase = PWM OFF, W Phase = Not Connected etc

so for the six states find the correct sequence of switching ON the pwm's.   

Once this calibration is done, you can drive the motor based on the Hall position.

Hi,

Can you elaborate on how to read the hall sensor using XOR/Hall Sensor mode.