PDA

View Full Version : What is ADC calibration and how can I activate it in Teensyduino?



darkness
01-29-2013, 04:08 AM
Hi, browsing around the forums and the K20 reference manual (http://cache.freescale.com/files/32bit/doc/ref_manual/K20P48M50SF0RM.pdf), I came across this ADC calibration stated in para 31.4.6. Can anyone explain to me what it does and how can we do this calibration using the registers in Teensyduino? Also, would I expect better ADC accuracy after calibration? Thanks!

PaulStoffregen
01-29-2013, 05:02 PM
Teensyduino automatically does the ADC calibration at startup. It also does a new calibration if you change the ADC configuration with analogReference() or analogReadResolution().

The idea is you can easily use the Arduino functions without worrying how they work.

But if you want to learn more, the code is available in hardware/teensy/cores/teensy3/analog.c. The calibration begins with the analog_init() function and is completed with the wait_for_cal() function.