STM32 gotchas
223. ADC input must not be negative or too high, even if in differential mode

Sometimes users don't realize, that the ADC is not an ideal "voltmeter" and are suprised, that for example bipolar signals (signals which have DC component at VSSA, i.e. they have both "positive" and "negative" portions, e.g. AC mains voltage decreased by a transformer or resistive divider, or similar) are clipped at their negative portions.

Users may expect, that using ADC in differential and setting one of the inputs to VSSA will solve this problem; but that's not the case (not to say that the common-mode voltage in STM32 ADC has to be close to the "analog midpoint" given by VREF+).

The reason is, that ADC inputs have both deliberate protection and also parasitic diodes, which clamp the negative input voltages to VSSA. They also usually clamp higher (single-ended) positive voltages to VDDA.

And not only is the "clamped" signal "incorrectly" measured. As such "clamping" results in current (in ST datasheets this is called "injection") flowing from the input signal source to VSSA/VDDA through structures and conductors which are common to other ADC inputs and other analog functions, such injection has impact on measurements on other ADC channels, too, and has to be generally avoided.