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-10-21 01:01 AM
It is possible that the sense voltage rise time is slow and the MCU power ON and init for MC library is complete before a stable voltage (greater than 32V) is available at the VBUS sensing ADC input (RC filter delay, etc).
To verify this, you can use any free GPIO configured as Output Push Pull and set it to high in the /* USER CODE BEGIN 2 */ area above the while(1) loop.
Now connect this GPIO and VBUS ADC input to two channels of a CRO and check if ADC scaled voltage corresponds to more than 32V before the GPIO state goes to high. So if your voltage divider ratio is 16, VBUS ADC voltage should be greater than 2V before GPIO goes high.
After power ON, it is always a good idea to check that the STM state machine is in IDLE. If it is in FAULT NOW, wait for it to go to FAULT OVER and acknowledge fault so that state machine is in IDLE state before any other operation is performed. Some kind of visual feedback (say a single LED blinking at different rates for different faults) can be quite useful for debugging.
Hope it helps.
2021-06-27 10:26 PM
The question has been moved from the "Motor Control Hardware" section to the "STM32 Motor Control" section (the question is about the STM32 MC SDK).
Best regards