cancel
Showing results for 
Search instead for 
Did you mean: 

Latching comparator output

SimonRichter
Associate

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.

1 ACCEPTED SOLUTION

Accepted Solutions

> 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

View solution in original post

1 REPLY 1

> 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