The AFE driver provides the interface to configure and use the AFE peripheral.
It converts the analog input to digital format. The converted result could be 12bit or 10bit. The AFE supports up to 16 analog lines.
To Enable a AFE conversion,the user has to follow these few steps:
-
Select an appropriate reference voltage on ADVREF
-
Configure the AFE according to its requirements and special needs,which could be broken down into several parts:
- Select the resolution by setting or clearing AFEC_MR_LOWRES bit in AFEC_MR (Mode Register)
- Set AFE clock by setting AFEC_MR_PRESCAL bits in AFEC_MR, the clock is calculated with AFEClock = MCK / ((PRESCAL+1) * 2)
- Set Startup Time,Tracking Clock cycles and Transfer Clock respectively in AFEC_MR.
-
Start conversion by setting AFEC_CR_START in AFEC_CR.
For more accurate information, please look at the AFE section of the Datasheet.
Related files :
afec.c
afec.h
afe_dma.c
afe_dma.h