cancel
Showing results for 
Search instead for 
Did you mean: 

Issue on Comparators inputs on STM32L031xx

MPiaz
Associate II

Hello,

On a low power application, using STM32L031x, I want to monitor a 3-level signal (24V, 5V, 0V) using COMP1 and COMP2.

  • COMP1IN+ and COMP2IN+ connected to a voltage divider with two resistors (2M-220K)
  • COMP1IN- connected to internal VREF, so COMP1 capture 24V-5V transition (rising and falling edges)
  • COMP2IN- connected to internal VREF/4, so COMP2 capture 5V-0V transition (rising and falling edges)

Comparator positive input are configured by software on analog input mode, No pull-up, pull-down

When the 3-level signal under test goes to 0V, I measure about 400mV instead of 0V on COMPxIN+ (so COMP2 never toggle): is there a leakage current (it's about 400mV/200K=2uA) from comparator inputs that alter the external voltage divider? Maybe from internal pullup?

Or there is a mistake/inaccuracy on comparator and/or GPIO software configuration?

Thanks for your support!

Massimo

4 REPLIES 4

I have no experience with the comparators in 'L0, but maybe this is the reason for the behaviour you observe:

0690X000006CYxPQAW.png

JW

Hello Jan,

maybe the issue come from COMP1 electrical characteristics, but the purposes were

  • COMP1 captures 24V to 5V and 5V to 24V edges (the input signal can goes to 0V, anywhere)
  • COMP2 captures 5V to 0V and 0V to 5V edges/levels

so I expected correct behaviour of comparators.

What I want to say is that COMP1 may inject the current you see if you try to pull it below 0.6V; and as you have both comparators' pins connected, that prevents the other comparator to see the lower transition.

Maybe try using two individual dividers.

JW

Jan,

maybe you are right, but on board it's very difficult to isolate some pins and keep signals.

And in datasheets there are poor COMPx's electical characteristics, in particular for leakage current and/or particular operating condition you named.

Thanks,

Massimo