STM32L476 comparator constantly generates an interrupt
Hi. I configured comparator with neccessary settings using CubeIDE and LL library and got next generated piece of code:
COMP_InitStruct.PowerMode = LL_COMP_POWERMODE_HIGHSPEED;
COMP_InitStruct.InputPlus = LL_COMP_INPUT_PLUS_IO1;
COMP_InitStruct.InputMinus = LL_COMP_INPUT_MINUS_VREFINT;
COMP_InitStruct.InputHysteresis = LL_COMP_HYSTERESIS_HIGH;
COMP_InitStruct.OutputPolarity = LL_COMP_OUTPUTPOL_NONINVERTED;
COMP_InitStruct.OutputBlankingSource = LL_COMP_BLANKINGSRC_NONE;
LL_COMP_Init(COMP1, &COMP_InitStruct);
LL_COMP_SetCommonWindowMode(__LL_COMP_COMMON_INSTANCE(COMP1), LL_COMP_WINDOWMODE_DISABLE);I also got generated code to use interrupt:
LL_EXTI_ClearFlag_0_31(LL_EXTI_LINE_21);
LL_EXTI_EnableRisingTrig_0_31(LL_EXTI_LINE_21);
LL_EXTI_DisableFallingTrig_0_31(LL_EXTI_LINE_21);
LL_EXTI_DisableEvent_0_31(LL_EXTI_LINE_21);
LL_EXTI_EnableIT_0_31(LL_EXTI_LINE_21);Then I used 3 configuration of connection INP(input plus):
1) INP do not connected to anything;
2) INP connect to GND;
3) INP connect to DAC output pin with maximum value (4095) (I think it correspond to Vref).
In config 1) I enable comparator and got constantly generated interrupt (one after another) (I clear flag in IRQ)
In config 2) I enable comparator and got once generated interrupt
In config 3) I enable comparator and got constantly generated interrupt again.
Maybe I don't understand how comparator works, but in my opinion it must generate interrupt once only when INP(+) > INP(-) (Vref in my case). And that's all. So
In config 1) I must not get interrupt
In config 2) I must not get interrupt
In config 3) ... I can or can't get interrupt? Anyway, I must not get constantly generated interrupt
What is the problem?