2019-02-18 09:48 AM
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
Solved! Go to Solution.
2019-02-26 12:58 AM
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
2019-02-26 12:58 AM
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
2019-02-26 06:24 AM
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.
2019-02-26 10:58 AM
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
2019-02-26 12:40 PM
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
2019-03-01 12:22 AM
Hi
Do I need a LSE clock source to make this work ?
2019-03-12 11:26 AM
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.
2019-03-23 12:04 AM
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
2019-03-23 12:07 AM
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
2019-03-26 02:52 AM
You're welcome Randy, great that you have a running motor yet!