cancel
Showing results for 
Search instead for 
Did you mean: 

Avoid Interrupt after HAL_COMP_Start(&hcomp1)

dhs
Senior

I set a breakpoint inside the function:

void HAL_COMP_TriggerCallback(COMP_HandleTypeDef *hcomp)

I got an interrupt event just after calling the function:

HAL_COMP_Start(&hcomp1);

I tried to pull-down/pull-up, I tried with all triggers modes but I ever get one false interrupt, how can I avoid it?

4 REPLIES 4
SLivi.1
Associate II

I realize this is an old post. But I am experiencing this issue on the STM32G0B1. I was wondering if you ever resolved this.

Post details.

JW

SLivi.1
Associate II

Thank you for a quick response.

I am using HAL code generated using STM32CubeIDE v. 14.0 for the STM32G0B1KEUxN.

I have the comparator configured for a gpio pin Input positive and a dac output as the Input negative. Output polarity is set to invert because I want it to trigger when the gpio input goes below the threshold. I have the trigger mode set to rising edge interrupt.

After setting the dac value with the comparator stopped, I call HAL_COMP_Start and get an immediate interrupt even though I know the gpio input is higher than the dac output.

If I read via HAL_COMP_GetOutputLevel and compare that in my ISR, I see that it is not COMP_OUTPUT_LEVEL_HIGH.

Please let me know if I can clarify anything else.

SLivi.1
Associate II

Nevermind on this one. I think I ended up needing to not invert the output polarity and to trigger on falling edge.