Skip to main content
BM.4
Associate
July 7, 2021
Solved

STM32L433RC Comparator interrupt triggering on both edges rather than just rising edge.

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.

This topic has been closed for replies.
waclawek.jan
waclawek.janBest answer
Super User
July 7, 2021

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

3 replies

waclawek.jan
waclawek.janBest answer
Super User
July 7, 2021

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

BM.4
BM.4Author
Associate
July 8, 2021

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.

PParo.2
Associate
August 26, 2022

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:

https://community.st.com/s/question/0D53W00001lRfwKSAS/nucleol452-comparator-triggering-in-both-edges