cancel
Showing results for 
Search instead for 
Did you mean: 

At motor BRK interrupt handler, TSK_SafetyTask() should be called instead of MC_Scheduler() to immediately execute fault processing?

THA.1
Associate II

(Environment)

MC_SDK 5.Y.3 + STM32CubeMX 6.3.0 with HAL + IAR EWARM 8.5

(Hardware)

custom board based on F446RE + custom power board + Low Voltage BLDC motor with Encoder

(Control Mode)

Speed Control

(What I found)

In "stm32f4xx_mc_it.c", there is TIMx_BRK_M1_IRQHandler() as follows.

Notice, here MC_Scheduler() is called as commented.

========================================================

void TIMx_BRK_M1_IRQHandler(void)

{

   if (LL_TIM_IsActiveFlag_BRK(PWM_Handle_M1.pParams_str->TIMx)) {

   LL_TIM_ClearFlag_BRK(PWM_Handle_M1.pParams_str->TIMx);

   R3_2_BRK_IRQHandler(&PWM_Handle_M1);

  }

  /* Systick is not executed due low priority so is necessary to call MC_Scheduler here.*/

  MC_Scheduler();

}

========================================================

(Question)

Once BRK interrupt(over current) happened, we need to handle this fault immediately.

While MC_Scheduler() is for normal medium task(speed controller), TSK_SafetyTask() that is for fault processing should be called rather than MC_Scheduler()?

1 ACCEPTED SOLUTION

Accepted Solutions
cedric H
ST Employee

Hello @THA.1​ ,

If the error is permanent, (for instance if the polarity of the break signal is not correct), and if the BRK IRQ priority is higher than sysTick, the call to MC_Scheduler guarantee that you will still have the communication link with the motor Pilot.

Cedric

View solution in original post

5 REPLIES 5
cedric H
ST Employee

Hello @THA.1​ ,

When the break occurs, all the safety measures are taken by the HW itself. The timer immediately stop driving the PWM and put your H-Bridge in safety mode.

The TSK_SafetyTask is a normal task checking the temperature and the VBus. It is not designed to be executed under BRK interrupt.

Regards

Cedric

THA.1
Associate II

Thank you for your reply !

I understood your point, then could you tell me why MC_Scheduler() should be executed in BRK interrupt?

Regards,

THA.1

THA.1
Associate II

Hi Cedric,

Could you answer my question above?

I think MC_Scheduler() is not necessary in BRK IRQ Handler either, even it might worse.

cedric H
ST Employee

Hello @THA.1​ ,

If the error is permanent, (for instance if the polarity of the break signal is not correct), and if the BRK IRQ priority is higher than sysTick, the call to MC_Scheduler guarantee that you will still have the communication link with the motor Pilot.

Cedric

THA.1
Associate II

Hi Cedric,

Thank you for your answer !

Regards,

THA.1