I have an MCU application where the MCU switches on/off and monitors the various power supplies of the board (3.3V, 1.8V, 1.0V etc.). When an under- or over-voltage is detected, an alarm to the system should be raised.
Until now the implementation was a bit simplistic: I only took one sample every 5ms and if it was above/below the relevant threshold, for overvoltage/undervoltage respectively, then the alarm was raised.
That led to the problem that on one board, where the dc/dc converter design was not optimal and short over-voltage pulses were present, the alarms were thrown. Such a behavior is of course not desired.
Now I am trying to optimize the c code of the MCU to cope with the problem. I know that ideally this should be solved at its origin (correct the HW design or implement an analog LP filter) but let's assume that this is not possible for the time being.
My first idea was to require more than one consecutive samples to be outside the limits before an alarm is triggered. But somehow I came to this thought: what if I happen to sample exactly when the over-voltage samples occur? I am not sure if they are periodic at all, but it may also be the case. I cannot exclude it. In such a case such an implementation would also fail; it would trigger a false alarm. What do you think? Does this thought make sense at all?
And then my next idea is to implement a digital low pass filter. Probably an IIR recursive filter. But here the questions are even more. Would this really solve my concerns? I mean, if the samples are taken exactly when the periodic pulses come, then the filter solution fails too. Do you have something else to propose? Do you think the digital LP filter is a good idea? If yes, I suppose I should somehow set the 3dB frequency of the filter close to DC. Is that anyhow possible?