cancel
Showing results for 
Search instead for 
Did you mean: 

timer break interrupt

Srinath_03
Associate II

hi im using stm32g474vet6 mcu , in that i am using tim1 for pwm generation , for protection im enabling all the 7 comparators and exrernal break input pin for pwm shutdown. comparator configuration and dac settings are correctly done.i dont know why the tim_bkin interuppt is not shutdown the pwm by mcu hardware itself.

 

by software im doing like this comparator output is detected and pwm is shutdown. but by hardware external input and internally comparator hardware is not working

 

if(HAL_COMP_GetOutputLevel(&hcomp1) == 1)

{

Rectifier.COMP_faults.COMP1_Idc=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp2) == 1)

{

Rectifier.COMP_faults.COMP2_Vbc=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp3) == 1)

{

Rectifier.COMP_faults.COMP3_Vab=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp4) == 1)

{

Rectifier.COMP_faults.COMP4_Ia=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp5) == 1)

{

Rectifier.COMP_faults.COMP5_Ib=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp6) == 1)

{

Rectifier.COMP_faults.COMP6_VDC=1;

}

if(HAL_COMP_GetOutputLevel(&hcomp7) == 1)

{

Rectifier.COMP_faults.COMP7_Ic=1;

}

 

if((Rectifier.COMP_faults.COMP1_Idc) || (Rectifier.COMP_faults.COMP2_Vbc) || (Rectifier.COMP_faults.COMP3_Vab) || \

(Rectifier.COMP_faults.COMP4_Ia) || (Rectifier.COMP_faults.COMP5_Ib) || (Rectifier.COMP_faults.COMP6_VDC) || \

(Rectifier.COMP_faults.COMP7_Ic) )

{

__HAL_TIM_MOE_DISABLE(&htim1);

Rectifier.COMP_faults.COMP_FLAG = 1;

 

}

else

{

__HAL_TIM_CLEAR_FLAG(&htim1,TIM_FLAG_BREAK);

__HAL_TIM_MOE_ENABLE(&htim1);

Rectifier.COMP_faults.COMP_FLAG = 0;

 

}

 

1 REPLY 1
Karl Yamashita
Lead III

Edit your post and use the </> to post code so it's formatted and readable 

Tips and Tricks with TimerCallback https://www.youtube.com/@eebykarl
If you find my solution useful, please click the Accept as Solution so others see the solution.