2022-08-30 02:53 PM
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?
2024-10-04 09:44 AM
I realize this is an old post. But I am experiencing this issue on the STM32G0B1. I was wondering if you ever resolved this.
2024-10-04 10:19 AM
Post details.
JW
2024-10-04 10:56 AM
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.
2024-10-04 12:45 PM
Nevermind on this one. I think I ended up needing to not invert the output polarity and to trigger on falling edge.