2021-07-07 02:06 AM
I have used CubeMX to configure the HAL comparator driver to trigger an interrupt on the rising edge only, however the interrupt seems to occur on both edges. I checked the EXTI registers and everything seems correct. I then thought that my voltage supply might be noisy enough that it was causing transitions despite the high level of hysteresis that I have set. I used an oscilloscope to view the comparator output on a GPIO pin and there were no spurious transitions that I could see. I have no idea what the problem is at this point. Does anybody have any ideas? thanks.
Solved! Go to Solution.
2021-07-07 02:40 AM
I believe it's still likely that it's a glitch on the falling edge. Enable both edges and if it's the glitch, you should see both edges interrupt happening at once.
You can also route the comparator's output to a timer, to trigger an input capture interrupt, and use the input filter there.
JW
2021-07-07 02:40 AM
I believe it's still likely that it's a glitch on the falling edge. Enable both edges and if it's the glitch, you should see both edges interrupt happening at once.
You can also route the comparator's output to a timer, to trigger an input capture interrupt, and use the input filter there.
JW
2021-07-07 09:03 PM
You were right. I had the comparator in ultra-low-power mode as well so I wasn't seeing what was actually happening. When I changed it to high speed mode I saw that I was getting tens or hundreds of interrupts for a single transition on the bench power supply. I tried putting a large capacitor on the plus input of the comparator found that this fixed the issue. Thanks.
2022-08-26 05:50 AM
Hey! I'm with the same problem with stm32l452. But I cound´t fix it by filtering the input signal.
Do you remember your config of the comparator? Hysteresis, Vref, power mode.
Also, which signal do you generate on Input Plus and what was the value of the capacitor you mentioned?
I want to replicate what you did and see if it works since I have no more ideas. I created a new post: