Skip to main content
THA.1
Associate III
July 15, 2022
Solved

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

  • July 15, 2022
  • 5 replies
  • 1829 views

(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()?

This topic has been closed for replies.
Best answer by cedric H

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

5 replies

cedric H
Technical Moderator
July 18, 2022

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
THA.1Author
Associate III
July 21, 2022

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
THA.1Author
Associate III
July 28, 2022

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
cedric HBest answer
Technical Moderator
July 28, 2022

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
THA.1Author
Associate III
July 29, 2022

Hi Cedric,

Thank you for your answer !

Regards,

THA.1