2018-11-18 11:14 AM
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);
}
}
2018-11-19 03:33 AM
there's example code in the x-cube-spn8
2018-11-19 05:41 AM
Hi! I already download x-cube-spn8 but the code has only libraries! I want build my own programme so I need to know what signals should I send In Tim1_CH (in 3 phases of the motor) to make it spin!!
Thank you!
2018-11-19 07:24 AM
there's examples with full source code included that use the libraries. the board support package has drivers with complete source code.
2018-11-20 08:50 AM
Your example code above will not drive a brushless motor correctly. If you have hall effect sensors you need to monitor them to decide which phases to energise next. If your motor does not have hall effect sensors then you need sensorless determination of the rotor position which is quite complicated (requires detection of back EMF).
2018-11-21 07:23 AM
I need to know first what signals should I send In Tim1_CH (in 3 phases of the motor) and Tim1_CHN ( 3 complementry CH) to make the motor spin , then use the hall effect sensors to send the signals in the correct order!
am i right ? if you have any information please I need help!
2018-11-26 11:41 PM
Hello...
I'm not sure I read your code well, I know nothing about MBED. However, your code suggests that you always close TIM_CHx and TIM_CHxN at the same time. This cannot make the motor spin. Actually, doing this is dangerous for your hardware (X-NUCLEO-IHM08M1) as you create a short circuit... TIM_CHx and TIM_CHxN shall never be on at the same time.
Spinning a motor will require a little more than this anyway. Two things you can do:
Finally, the characteristics of your motor are important here. Do they fit with the board? You're trying to spin the motor at 10 000 rpm. Can this motor stand such a speed? Is an acceleration phase scheduled in your code?
2018-11-27 07:17 AM
Hi!
First Thank you for your reply !
I think the motor characteristics fit with the board cuz I already spin the motor with the binary file that I found in x-cube-spn8.
Analysing the source Code is a bit hard cuz there are lot of libraries calls that I dont understand !
My problem is I know the pins (Timer1 6 x pins) but I dont know what signals should I send on them and How!!
Ps: while spenning the motor with x-cube-spn8 binary file and using an oscilloscope I found the folowing signals:
1) on TIM1_CH1,2 and 3
2) on TIM1_CH1N,2N and 3N
3)on motor's outs
I really need your Help!
Thank you
2019-01-03 05:43 AM
Hello oussama.shis1.5425675341255417E12 I am working on the same project and would like to know more about you and your project maybe we have useful information that we can exchange. You can just send me an email at dennislang369@gmail.com
LG Dennis from Germany
nochmal in Deutsch :)
Hallo oussama.shis1.5425675341255417E12 ich arbeite an demselben Projekt und würde gern mehr über dich und dein Projekt erfahren vielleicht haben wir nützliche Informationen die wir austauschen können. Du kannst mir einfach eine mail schreiben unter dennislang369@gmail.com
LG Dennis aus Deutschland