cancel
Showing results for 
Search instead for 
Did you mean: 

Strange behavior in STM32 start/stop button motor response

BTrem.1
Senior II

I'm running the Nucleo 64 with STM32F302x and IHM07M1 Driver and am using the motor from the ST Kit, the Bull-Running motor.

I added code to implement a phase detector using TIM2 and DMA to capture the edges of the the motor reference frequency and the motor once-around feedback. For now this phase detector is not hooked up, I'm only using signal generators to test the concept and it seems to work. However, since modifying code the start/stop button is not always responding. Even if I disable TIM2 and the DMA interrupts the button behavior is odd.

Here is the button code:

__weak void UI_HandleStartStopButton_cb (void)
{
/* USER CODE BEGIN START_STOP_BTN */
	MC_AcknowledgeFaultMotor1();
  if (MC_GetSTMStateMotor1() == IDLE)
  {
    /* Ramp parameters should be tuned for the actual motor */
    MC_StartMotor1();
  }
  else
  {
    MC_StopMotor1();
  }
/* USER CODE END START_STOP_BTN */

I can put a break point at the MC_StopMotor1 and it get there but on return the motor is still runniing. If I step through MC_StopMotor1 I believe the motor state is ANY_STOP. This should be a transient state on the way to STOP but the motor never stops.

Any clues or pointers appreciated. I must have changed something I'm unaware of ...

0 REPLIES 0