Latching comparator output
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.
