cancel
Showing results for 
Search instead for 
Did you mean: 

Analog Comparator False Initial Trigger

Carl_G
Senior

Hello,

I am working with an STM32G071. I am using Comp2. I have configured it with the STM32CubeIDE. Presently, It is set to "medium" speed/power, and Rising Edge Input with High Hysteresis. The positive input is set to INP/PB6. The negative input is set to Internal VRef. (I can't find anywhere in the manual what that value is. Maybe its only in the data sheet!?) Anyway, my problem is when I enable the AC it instantly triggers the interrupt. However, I don't see any evidence that VALUE is ever high. Meaning It doesn't look like the comparator is actually triggered but maybe its some type of configuration initialization issue? If I ignore this first trigger the AC seems to work fine afterwards.

I have checked the flags in EXTI and they are not set until the exact moment the AC is enabled.

Any idea what could be causing this? I haven't found anything on the forums that might point to an explanation.

10 REPLIES 10
Carl_G
Senior

Yes, I tied the pin directly to GND, and the COMP output monitored with an oscilloscope.

I have added a post as a bug report here

https://community.st.com/t5/stm32-mcus-products/comparator-bug-report-on-stm32g0/td-p/763733

 

I think your solution would work. My alternate was to disable the interrupt just before I enable COMP.  Then reenable it afterward. This is because I enable and disable COMP based on the operating state of my module.

Its the COMP itself that is sending a trigger to EXTI.