Skip to main content
SimonRichter
Visitor II
October 15, 2020
Solved

Latching comparator output

  • October 15, 2020
  • 1 reply
  • 1104 views

I'm building an overcurrent protection device based on an STM32F301C8, using COMP2 to compare an analog signal from a hall sensor against the DAC1 output value.

Now I'd like to generate a latching error signal that will remain asserted when the overcurrent situation goes away. The error signal shuts down the device, so it is expected that this resolves the situation.

Is there something I can (ab)use for this latch, ideally without involving software or requiring external pins (COMP outputs reduce ADC inputs, which I have way too few of)?

Ideas so far:

  • triggering a timer that immediately expires, without reload and using the output compare as an error signal
  • feeding the COMP output back as a BREAK signal into a timer that generates a 100% PWM

Resetting the latch is not time critical.

This topic has been closed for replies.
Best answer by waclawek.jan

> triggering a timer that immediately expires, without reload and using the output compare as an error signal

Yes.

Using Set Active On Match setting in TIMx_CCMRx.OCxM, and perhaps also setting OCxFE.

JW

1 reply

waclawek.jan
waclawek.janBest answer
Super User
October 15, 2020

> triggering a timer that immediately expires, without reload and using the output compare as an error signal

Yes.

Using Set Active On Match setting in TIMx_CCMRx.OCxM, and perhaps also setting OCxFE.

JW