K64 ADC measurement

Document created by Fang Li Employee on Sep 29, 2018
Version 1Show Document
  • View in full screen mode

As most of people familiar with FRDM-K64F which is a bit old but it is still a hot device in the market. This document focused on the ADC measurement to verify the deviation.


In general, the sample code were modified /come with MCUXpresso SDK, which is an ADC polling example.

ADC reading was done by two ways:
1) Polling the status register of ADC conversion complete flag until ADC conversion is done.
2) CPU core is in sleep right after ADC conversion is started by software trigger. Interrupt is generated when ADC conversion is done and CPU core wakes up by this interrupt.

The value of ADC reading is measured 5000 times. And, it is averaged, also calculate max/min value.
Finally, the standard deviation is calculated based on the 5000 measured value.
PRINTF is a terminal console and print out by semi-hosting.

Interrupt method or polling method can been selected by the define of INTERRUPT or POLLING.

#define INTERRUPT 0   //ADC conversion wait for “INTERRUPT” should be defined to 1
#define POLLING 1   //ADC conversion wait for “POLLING” should be defined to 1