2022-03-21 05:30 AM
2022-03-21 05:41 AM
Hello,
I have problems with STEVAL-PTOOL1V1 board, specifically at flashing file with minimal and only necessary functions for Motor Control, which were included by using X-CUBE-MCSDK_5.Y.4 and STM32CubeMX. For a successfull flash I can't even add TX and RX or GPIO funcitonality at once because of flash overflow.
When I connnected only 1 led which toggled every 1mil-th cycle and tried to start the motor, the led didn't blink at all and the motor didn't rotate - see code below:
while (1)
{
if (MC_GetSTMStateMotor1() == RUN)
{
HAL_GPIO_WritePin(LEDICA_GPIO_Port, LEDICA_Pin, GPIO_PIN_RESET);
MC_ProgramSpeedRampMotor1(10000,10000);
} else
{
HAL_GPIO_WritePin(LEDICA_GPIO_Port, LEDICA_Pin, GPIO_PIN_SET);
MC_StopMotor1();
MC_ProgramSpeedRampMotor1(10000,10000);
}
Counter++;
if (Counter >= 1000000){
HAL_GPIO_TogglePin(LEDICA_GPIO_Port, LEDICA_Pin);
Counter = 0;
}
/* USER CODE END WHILE */
/* USER CODE BEGIN 3 */
}
/* USER CODE END 3 */
}
I tried looking at some of error handlers with debugging, and I think it ended up in HardFault_Handler - code below:
void HardFault_Handler(void)
{
/* USER CODE BEGIN HardFault_IRQn 0 */
/* USER CODE END HardFault_IRQn 0 */
TSK_HardwareFaultTask();
/* Go to infinite loop when Hard Fault exception occurs */
while (1)
{
}
/* USER CODE BEGIN HardFault_IRQn 1 */
/* USER CODE END HardFault_IRQn 1 */
}