Brushless motor control using a STM32F302RB
Hi!
I'm trying to control a brushless motor using a STM32F302RB and X-NUCLEO-IHM08M1.
But the motor is not spining!!
I need your help !
best regards!
I'm using mbed online compiler to configurate TIM1_CH1 pin (PA8)
�? TIM1_CH1N pin (PA7)
�? TIM1_CH2 pin (PA9)
�? TIM1_CH2N pin (PB0)
�? TIM1_CH3 pin (PA10)
�? TIM1_CH3N pin (PB1)
>>
PwmOut mypwmA(PA_8);
PwmOut mypwmB(PA_9);
PwmOut mypwmC(PA_10);
PwmOut mypwmA1(PA_7);
PwmOut mypwmB1(PB_0);
PwmOut mypwmC1(PB_1);
DigitalOut myled(LED1);
DigitalIn mybutton(USER_BUTTON);
DigitalOut EN1(PC_10);
DigitalOut EN2(PC_11);
DigitalOut EN3(PC_12);
DigitalOut ld2(PB_13);
int main()
{ EN1=1;
EN2=1;
EN3=1;
mypwmA.period_us(20);
mypwmB.period_us(20);
mypwmC.period_us(20);
mypwmA1.period_us(20);
mypwmB1.period_us(20);
mypwmC1.period_us(20);
while(1) {
mypwmA.write(0.5f);
mypwmB.write(0);
mypwmC.write(0);
mypwmA1.write(0.5f);
mypwmB1.write(0);
mypwmC1.write(0);
wait_ms(2);
mypwmA.write(0);
mypwmB.write(0.5f);
mypwmC.write(0);
mypwmA1.write(0);
mypwmB1.write(0.5f);
mypwmC1.write(0);
wait_ms(2);
mypwmA.write(0);
mypwmB.write(0);
mypwmC.write(0.5f);
mypwmA1.write(0);
mypwmB1.write(0);
mypwmC1.write(0.5f);
wait_ms(2);
}
}
