Skip to main content
CDesh
Associate III
February 22, 2021
Solved

STM32L0xx Comparator2

  • February 22, 2021
  • 3 replies
  • 946 views

Hi everyone,

I am using comparator 2 to capture a signal of duration 3-5usec. But observed that, I am able to trigger the comparator only when the duration of the signal is >5usec. I was wondering if there is any delay introduced by Vrefint in STM32L0xx. Attached is sample image of signal of interest and let me know if there is a solution from HW/SW to trigger the comparator when the signal duration is <5usec.

This topic has been closed for replies.
Best answer by CDesh

The issue has been resolved by setting EN_VREFINT flag during comparator initialization. Now the COM2 response time is in nsec which is required for our application.

Thanks @Vangelis Fortounas​  for your input.

3 replies

Vangelis Fortounas
Associate II
February 22, 2021

Hello

A hi capacitance in the input of comparator in combination with hi output impendance of source can cause such a delay.

Note that low delay propagation times can be achieved in fast mode and under certain vdda voltages

TI and EXTI lines can "catch" pulses in nanosecond scale.

0693W000007Z6luQAC.jpg

CDesh
CDeshAuthor
Associate III
February 25, 2021

Thanks for your response.

I am using ST development board (B-L072Z-LRWAN) where there I am using a simple push button to trigger the comparator. Following are the settings on COMP2 and even in fast mode, I am missing pulses <5msec duration. According to the data sheet propagation delay should be in usec, but in reality it is taking more time (>5msec).

  compHandle.Instance = COMP2;

  compHandle.Init.WindowMode = COMP_WINDOWMODE_DISABLE;

  compHandle.Init.Mode = COMP_POWERMODE_ULTRALOWPOWER;

  compHandle.Init.NonInvertingInput = COMP_INPUT_PLUS_IO1; 

  compHandle.Init.InvertingInput = COMP_INPUT_MINUS_VREFINT;

  compHandle.Init.OutputPol = COMP_OUTPUTPOL_NONINVERTED;

  compHandle.Init.TriggerMode = COMP_TRIGGERMODE_IT_FALLING;

CDesh
CDeshAuthorBest answer
Associate III
April 1, 2021

The issue has been resolved by setting EN_VREFINT flag during comparator initialization. Now the COM2 response time is in nsec which is required for our application.

Thanks @Vangelis Fortounas​  for your input.