Hi. I use an arduino MKR with SAMD21 device. Just had the experience, that in a brown-out situation, shortly before the device was gone, the analog sensor values went up.
I suspect that in this case the 3V3 supply (which is the ADC reference) drops a bit, which will lead to higher ADC values. To prevent using wrong sensor values - How do I check if the analog reference is correct, without sacrifying a full analog channel?
My approaches until now:
Brown-out: Arduino configures the 3V3 brown out to level7 = 1.75V. So this won't help me when the 3.3V supply starts dropping. And I don't really want to mess around with this standard settings.
IO supply: The ADC of the SAMD21 has an input channel which measures the "1/4 scaled IO supply". This would be perfect to measure against the 1V bandgap reference. Unfortunately I found no way in the arduino core to measure the "special" ADC channels (e.g. MUXPOS=0x1B)
So is there really no way to detect if the board supply is good, beside soldering an external voltage divider and wasting an ADC pin?