cancel
Showing results for 
Search instead for 
Did you mean: 

My Motor don't spin with MCSDK_v5.3.3-Full on my custom board

Randy1
Associate III

Hello I made a custom board with a stm32f446ze and L6398 driver. To make it work I generated the source code thanks to STMCWB and I built it with atollic TRUE Studio.

And I added this code in the while loop in the main.c file:

/* USER CODE BEGIN 2 */

 /* USER CODE END 2 */

 /* Infinite loop */

 /* USER CODE BEGIN WHILE */

 while (1)

 {

 HAL_Delay(2000);

 MC_ProgramSpeedRampMotor1(83,0);

 HAL_Delay(100);

 MC_StartMotor1();

 HAL_Delay(3000);

 MC_StopMotor1();

 /* USER CODE END WHILE */

 /* USER CODE BEGIN 3 */

 }

 /* USER CODE END 3 */

} // End of int main(void)

The PWM outputs of my microcontroler are still at 3.3V for high side and 0V for low side. I don't understand why but the pwm signals are not generated.

Is something missing in my code ? or the problem is somewhere else?

Regards

1 ACCEPTED SOLUTION

Accepted Solutions
CPrin
Associate III

Hi Randy, at this point I cannot say whether your code is OK or not. But, have you tried to get the Motor Control Work Bench monitor to get connected to your custom hardware? It's very useful for me, so I expect that it can be useful for you too. the MCWB monitor only needs correct setting of the UART and is very helpful for me. Kind regards from the Netherlands, Cojan

View solution in original post

11 REPLIES 11
CPrin
Associate III

Hi Randy, at this point I cannot say whether your code is OK or not. But, have you tried to get the Motor Control Work Bench monitor to get connected to your custom hardware? It's very useful for me, so I expect that it can be useful for you too. the MCWB monitor only needs correct setting of the UART and is very helpful for me. Kind regards from the Netherlands, Cojan

CPrin
Associate III

In mc_api.c I found following remarks:

 * One of the following commands must be executed before calling MC_StartMotor1():

 *

 * - MC_ProgramSpeedRampMotor1()

 * - MC_ProgramTorqueRampMotor1()

 * - MC_SetCurrentReferenceMotor1()

 *

So in my opinion your code looks good ... please inform if you have solved the problem.

Randy1
Associate III

Ok thanks

I discovered my oscillator is not powerd by the stm32 and my pwm outputs for low side reach only 2.64V instead of Vdd = 3.3V and it's constant I don't know why. I'm trying to fix this first.

Regards

Randy1
Associate III

I fixed my oscillator circuit. In the STMCWB I choose the ceramic resonator but in the CubeMX project generated by STMCWB it was "BYPASS clock source" which was selected. Now my oscillator is powered and I can see the 8 MHz signal. But my PWM outputs are still constant. I keep investigating

Randy1
Associate III

Hi

Do I need a LSE clock source to make this work ?

Randy1
Associate III

It seems my microcontroller is still in idle state. It will be difficult to reach UART port on my custom board but I will try it.

Randy1
Associate III

I used the UART port with a UART-USB cable in the STMCWB and there was a Under Voltage fault I cleared it and the motor ran.

Thank You very much Cojan

Randy1
Associate III

But now the question is why I have an under voltage fault at the beginning? I mesured the voltage and it's 39.5V and my max is 42 and my min is 32 in settings

You're welcome Randy, great that you have a running motor yet!