Cortex-M/EFM322013. 5. 1. 20:30

EFM32G210 EVM - ADC 테스트 (Potentiometer 값을 TFT LCD 그래프로 표시하기)

EFM32G210 EVM - ADC 테스트 (Potentiometer 값을 TFT LCD 그래프로 표시하기)

EFM32G210은 8개의 12bit ADC포트가 있고 1개의 온도센서가 내장되어 있다. 

EFM32 ADC의 특징은 아래와 같다.

Ultra low power precision analog peripherals

 - 12-bit 1M samples/s Analog to Digital Converter

 - 4 single ended channels/2 differential channels

 - On-chip temperature sensor

 - Conversion tailgating for predictable latency

EFM32 ADC 블록도




EFM32G210f128 ADC 핀맵

EFM32 ADC 테스트 동영상

EFM32에 연결된 가변저항(Potentiometer) 값을 TFT LCD의 그래프로 표시하는 예제

EFM32 ADC 초기화 함수

void AdcInit(unsigned int Channel)


  ADC_Init_TypeDef init = ADC_INIT_DEFAULT;

  ADC_InitSingle_TypeDef singleInit = ADC_INITSINGLE_DEFAULT;

SYSTEM_ChipRevision_TypeDef chipRev;

/* ADC errata for rev B when using VDD as reference, need to multiply */

/* result by 2 */


if ((chipRev.major == 1) && (chipRev.minor == 1))


errataShift = 1;



CMU_ClockEnable(cmuClock_ADC0, true);

/* Init common issues for both single conversion and scan mode */

init.timebase = ADC_TimebaseCalc(0);

/* Might as well finish conversion as quickly as possibly since polling */

/* for completion. */

init.prescale = ADC_PrescaleCalc(7000000, 0);

/* WARMUPMODE must be set to Normal according to ref manual before */

/* entering EM2. In this example, the warmup time is not a big problem */

/* due to relatively infrequent polling. Leave at default NORMAL, */

ADC_Init(ADC0, &init);

/* Init for single conversion use. */

singleInit.reference = adcRefVDD;

singleInit.input = Channel; /* According to DVK HW design */

singleInit.resolution = adcRes8Bit; /* Use at least 8 bit since unlinear voltage */

ADC_InitSingle(ADC0, &singleInit);


EFM32 ADC Read 함수

//Read ADC Value

unsigned int AdcRead(unsigned char port)


    ADC_IntClear(ADC0, ADC_IF_SINGLE);

    ADC_Start(ADC0, adcStartSingle);

    /* Wait for completion */

    while (!(ADC_IntGet(ADC0) & ADC_IF_SINGLE));

    return ADC_DataSingleGet(ADC0) << errataShift;


Posted by nexp

댓글을 달아 주세요