The following bits must be programmed in AFEC_MR:
- USEQ: User Sequence Enable
- 0: NUM_ORDER: Normal mode: The controller converts channels in a simple
numeric order.
- 1: REG_ORDER: User Sequence mode: The sequence respects what is defined
in AFEC_SEQ1R and AFEC_SEQ1R.
- ONE: This but must be written to 1.
- FREERUN: Free Run Mode
Selection
- 0: OFF: Normal mode
- 1: ON: Free Run mode:
Never wait for any trigger. In Free Run mode, the sampling frequency
(fS) is calculated as 1/tAFE_conv.
- FWUP: Fast Wake-up Selection
- 0: OFF: Normal Sleep
mode: The sleep mode is defined by the SLEEP bit.
- 1: ON: Fast wake-up Sleep
mode: The voltage reference is ON between conversions and AFE is
OFF.
- SLEEP: Sleep Mode Selection
- 0: Normal mode: The AFE
and reference voltage circuitry are kept ON between conversions.
- 1: Sleep mode: The AFE
and reference voltage circuitry are OFF between conversions.
- TRGEN: Hardware triggers are
enabled or disabled using this bit.
- 0: Starting a conversion
is only possible by software.
- 1: Hardware trigger
selected by TRGSEL field is enabled.
- TRGSEL: Trigger Source Selection (ADTRG, Timer Counter, PWM, Analog
Comparator)
Code example to configure AFEC_MR:
/* Step 3: AFEC Mode Register Configuration */
AFEC_SetModeReg(
AFEC0,AFEC_MR_FREERUN_OFF|AFEC_MR_TRANSFER(1)|AFEC_MR_TRACKTIM(2)|
AFEC_MR_ONE| AFEC_MR_STARTUP_SUT512);