DocID025202 Rev 7
326/1080
RM0365
Analog-to-digital converters (ADC)
392
ADC overrun (OVR, OVRMOD)
The overrun flag (OVR) notifies of a buffer overrun event, when the regular converted data
was not read (by the CPU or the DMA) before new converted data became available.
The OVR flag is set if the EOC flag is still 1 at the time when a new conversion completes.
An interrupt can be generated if bit OVRIE=1.
When an overrun condition occurs, the ADC is still operating and can continue to convert
unless the software decides to stop and reset the sequence by setting bit ADSTP=1.
OVR flag is cleared by software by writing 1 to it.
It is possible to configure if data is preserved or overwritten when an overrun event occurs
by programming the control bit OVRMOD:
•
OVRMOD=0: The overrun event preserves the data register from being overrun: the
old data is maintained and the new conversion is discarded and lost. If OVR remains at
1, any further conversions will occur but the result data will be also discarded.
•
OVRMOD=1: The data register is overwritten with the last conversion result and the
previous unread data is lost. If OVR remains at 1, any further conversions will operate
normally and the ADCx_DR register will always contain the latest converted data.
Figure 84. Example of overrun (OVR)
Note:
There is no overrun detection on the injected channels since there is a dedicated data
register for each of the four injected channels.
Managing a sequence of conversion without using the DMA
If the conversions are slow enough, the conversion sequence can be handled by the
software. In this case the software must use the EOC flag and its associated interrupt to
handle each data. Each time a conversion is complete, EOC is set and the ADCx_DR
register can be read. OVRMOD should be configured to 0 to manage overrun events as an
error.
2YHUXQ
-36
$'67$57
(2&
(26
75*[
$'&VWDWH
$'&B'5UHDGDFFHVV
E\VZ
E\KZ
,QGLFDWLYHWLPLQJV
WULJJHUHG
5'<
&+
&+
&+
&+
&+
&+
&+
6723
5'<
'
'
'
'
'
'
'
'
'
'
$'673
295
$'&B'5
29502'
$'&B'5
29502'