cancel
Showing results for 
Search instead for 
Did you mean: 

STM32L4: COMP1 and COMP2 as TIM1 BREAK2 input sources.

MGard.2
Associate II

Hi,

I am using STM32L476 MCU. 

I have COMP1 and COMP2 configured in window mode. That's working fine. 

I would like to have COMP1 and COMP2 as break input sources for TIM1 BRKIN2.

  • Test #1: if I set COMP1 as break input source, that works:

LL_TIM_EnableBreakInputSource(TIM1, LL_TIM_BREAK_INPUT_BKIN2, LL_TIM_BKIN_SOURCE_BKCOMP1);

  • Test #2: if I set COMP2 as break input source, that works:

LL_TIM_EnableBreakInputSource(TIM1, LL_TIM_BREAK_INPUT_BKIN2, LL_TIM_BKIN_SOURCE_BKCOMP2);

  • Test #3: now, if I set both COMP1 and COMP2, that does NOT work, i.e. the break event will never happen:

LL_TIM_EnableBreakInputSource(TIM1, LL_TIM_BREAK_INPUT_BKIN2, LL_TIM_BKIN_SOURCE_BKCOMP1|LL_TIM_BKIN_SOURCE_BKCOMP2);

I checked BDTR and OR3 registers and everything is correctly set. For some reason, when both comparators are set as break inputs, the break event will never happen.

I also checked BRK2 polarity and it is correct.

I was wondering if anybody ever managed to used COMP1 and COMP2 as BRK2 input sources. As of today, I cannot explain why the input sources work correctly when set separately but don't work when set simultaneously.

Thanks!

Michel

1 REPLY 1

> I checked BDTR and OR3 registers and everything is correctly set.

Show.

JW