K60 adc calibration problem

取消
显示结果 
显示  仅  | 搜索替代 
您的意思是: 

K60 adc calibration problem

1,226 次查看
kwonym
Contributor II

I use MK60 and 16Bit ADC of differential mode.

and I copy source code on it.

I always run "ADC_ExecCalib" function after reset.

sometimes, ADC offeset has been got so big diffenent value befor reset.

Do I must run this function every reset? or Can I use this function on only first run?

void InitADCDiffDMA(void)
{
DisableInterrupts;
//**** MCU periphery initialize **********************************************
SIM_Init(SIM_MODULE_CONFIG);
//FLL_Init(FLL_MODULE_CONFIG_FEE_96MHZ);

//test
//InitPITimer1();

//**** VREF config *********************************************************
VREF_Init (VREF_MODULE_TIGHTREG_CONFIG);

//**** PDB config **********************************************************
PDBCH0TRG0_Init (PDB_PRETRG_ON_DEALYED_CONFIG, 0x0010);
PDBCH1TRG0_Init (PDB_PRETRG_ON_DEALYED_CONFIG, 0x0010);
PDB_Init (PDB_MODULE_SWTRG_NO_IRQ_CONFIG( PDB_PRESCALER_1, PDB_MULT_1, 0x1000, 0xFFFF), 1, NULL);

//**** ADC config **********************************************************
//**** ADC calibrations **************************************************
ADC_ExecCalib (ADC0,ADC_MODULE_16B_IREF_HWTRG_CONFIG_U, &ram_adc0);       //DC OK, AC??
ADC_ExecCalib (ADC1,ADC_MODULE_16B_IREF_HWTRG_CONFIG_U, &ram_adc1);       //DC OK, AC??

//**** ADC0,ADC1 initialization ******************************************
ADC_Init  (ADC0, ADC_MODULE_16B_HWTRG_DMA_IREF_USER_CONFIG, ADC_CH_DI_POLL_CONFIG(DAD1), ADC_CH_DI_POLL_CONFIG(DAD1), 2, NULL);
ADC_Init  (ADC1, ADC_MODULE_16B_HWTRG_DMA_IREF_USER_CONFIG, ADC_CH_DI_POLL_CONFIG(DAD1), ADC_CH_DI_POLL_CONFIG(DAD1), 3, NULL);

//**** DMA channel 0 *****************************************************
DMACH0_CH1_Init();
DMACH1_CH1_Init();
//**** Enable all interrupts ***********************************************

EnableInterrupts;
//**** Start PDB ***********************************************************
PDB0_Trigger();
}

0 项奖励
回复
2 回复数

912 次查看
chris_brown
NXP Employee
NXP Employee

Hi Kwon,

Ma Hui is correct but I wanted to recommend that you NOT run the calibration after every reset.  You should only run your calibration one time (under the optimal conditions of your application) and then store them in non-volatile memory.  After every reset, they will need to be re-written to the ADC's calibration registers, but you shouldn't have to run the calibration again. 

I also wanted to point you to this document which explains a little more about the ADC calibration and gives some recommendations on which conditions you should run your calibrations under. 

16-bit SAR ADC calibration

Best regards,

Chris

0 项奖励
回复

912 次查看
Hui_Ma
NXP TechSupport
NXP TechSupport

Hi,

The ADC with below info about ADC calibration function:

Calibration must be run, or valid calibration values written, after any reset and before a conversion is initiated.


Have a great day,
best regards,

Ma Hui

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 项奖励
回复