38.5.13.2 Averaging Function Versus Trigger Events
The samples can be defined in different ways for the averaging function, depending on the configuration of ADC_EMR.ASTE and ADC_MR.USEQ.
When ADC_MR.USEQ = 0, there are two possible ways to generate the averaging through the trigger event. If ADC_EMR.ASTE = 0, every trigger event generates one sample for each enabled channel, as described in the following figure. Therefore, four trigger events are requested to obtain the result of averaging if ADC_EMR.OSR = 1.
If ADC_EMR.ASTE = 1 and ADC_MR.USEQ = 0, the sequence to be converted, defined in ADC_CHSR, is automatically repeated n times (where n corresponds to the oversampling ratio defined in ADC_EMR.OSR). As a result, only one trigger is required to obtain the result of the averaging function, as described in the following figure.
When USEQ = 1, the user can define the channel sequence to be converted by configuring ADC_SEQRx and ADC_CHER so that channels are not interleaved during the averaging period. Under these conditions, a sample is defined for each end of conversion, as described in the following figure.
When USEQ = 1 and ASTE = 1, OSR can be only configured to 1. Up to three channels can be converted in this mode. The averaging result will be placed in the corresponding ADC_CDRx and in ADC_LCDR for each trigger event. The ADC real sample rate remains the maximum ADC sample rate divided by 4.
It is important that the user sequence follows a specific pattern. The user sequence must be programmed in such a way that it generates a stream of conversion, where a same channel is successively converted.
Register | Number of Channels Non-interleaved Averaging - Register Value | ||
---|---|---|---|
1 (e.g., CH0) | 2 (e.g., CH0, CH1) | 3 (e.g., CH0, CH1, CH2) | |
ADC_CHSR | 0x0000000F | 0x000000FF | 0x00000FFF |
ADC_SEQR1 | 0x00000000 | 0x11110000 | 0x11110000 |
ADC_SEQR2 | 0x00000000 | 0x00000000 | 0x00002222 |