PDA

View Full Version : TC1793 / TC1798 ADC calibration is needed for Dave generated code



Travis
Jun 20th, 2013, 02:23 AM
Hi all

We discovered a small mistake in the DAVE code generation for TC1793/TC1798 that ADC calibration is done while the Analog module is OFF. This is incorrect and will cause ADC values to be unstable.

The correct procedures should be to turn ON the Analog module (ADC0,1,2) and follow by the calibration.

The correct codes in Bold is as shown below. Please give this a try.


/// -----------------------------------------------------------------------
/// Configure global configuration register:
/// -----------------------------------------------------------------------
/// - start power up calibration
/// - don't disable Post Calibration
/// - no mux test mode

ADC0_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC0 kernel //Rework for calibration
ADC1_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC1 kernel //Rework for calibration
ADC2_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC2 kernel //Rework for calibration
ADC0_GLOBCFG.U = 0x00000020; // load global configuration register


while((ADC2_GLOBSTR.U & 0x0004)); //wait for calibration to finish (CAL=0)

//Rework for calibration ADC0_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC0 kernel
//Rework for calibration ADC1_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC1 kernel
//Rework for calibration ADC2_GLOBCTR.U |= 0x00000300; // turn on Analog part for ADC2 kernel


G@@d luck ...