38.5.13.1 Enhanced Resolution Mode

The Enhanced Resolution mode is enabled if ADC_EMR.OSR is configured to 1, 2, 3 or 4. The enhancement is based on a digital averaging function.

There is no averaging on the last index channel if the measure is triggered by an RTC event.

In this mode, the ADC Controller will trade off conversion speed against accuracy by averaging multiple samples, thus providing a digital low-pass filter function.

The selected oversampling ratio applies to all enabled channels when triggered by an RTC event. The following formula applies:

ADC_LCDR.LDATA = 1 M × k = 0 k = N 1 A D C ( k )

where N and M are given in the table below.

Table 38-2. Digital Averaging Function Configuration Versus OSR Values
ADC_EMR.OSR Value ADC_LCDR.LDATA Length N Value M Value Full Scale Value Maximum Value
0 12 bits 1 1 4095 4095
1 13 bits 4 2 8191 8190
2 14 bits 16 4 16383 16381
3 15 bits 64 8 32767 32766
4 16 bits 256 16 65535 65533

The average result is valid in ADC_CDRx (x = channel index) only if the ADC_EOC_ISR.EOCn flag is set and if the ADC_OVER.OVREn flag is cleared. The average result for all channels is valid in ADC_LCDR only if ADC_ISR.DRDY is set and ADC_ISR.GOVRE is cleared.

Note that ADC_CDRs are not buffered. Therefore, when an averaging sequence is ongoing, the value in these registers changes after each averaging sample. However, overrun flags in ADC_OVER rise as soon as the first sample of an averaging sequence is received. Thus, the previous averaged value is not read, even if the new averaged value is not ready.

Consequently, when an overrun flag rises in ADC_OVER, it means that the previous unread data is lost but it does not mean that this data has been overwritten by the new averaged value, as the averaging sequence concerning this channel can still be ongoing.

When an oversampling is performed, the maximum value that can be read on ADC_CDRx or ADC_LCDR is not the full-scale value, even if the maximum voltage is supplied on the analog input. See the table Digital Averaging Function Configuration Versus OSR Values.