LPC553x ADC VREF dependency

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC553x ADC VREF dependency

Jump to solution
1,735 Views
asund
Contributor II

On the LPC553x system I am using, the ADC has terrible results unless the internal VREF module and the low power bandgap is enabled prior to use of the ADC module. I initially did not turn on the VREF module because my board design uses an external reference through the VREFP pin.

I suspect the voltage reference must be used in the autocalibration process or somewhere internally in the SAR conversion. This is fine, and it's now documented in revision 2 of the processor family reference manual, but the Config Tools code generation interface doesn't warn you of this when instantiating just an ADC module.

Interestingly, if I drop the ADC module clock rate to 8MHz I can get usable results out without enabling the bandgap reference.

0 Kudos
Reply
1 Solution
1,679 Views
alejandra_guzman
NXP Employee
NXP Employee

Thanks for the feedback, I have submitted a change request to our config tools team. 

View solution in original post

2 Replies
1,687 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Regarding your question, even if you do not use the on-chip Voltage Reference as ADC voltage reference, you have to configure the on-chip Voltage Reference.

xiangjun_rong_0-1684739263364.png

This is the ADC code for the LPC5536:

/* Disable VREF power down */
POWER_DisablePD(kPDRUNCFG_PD_VREF);

VREF_GetDefaultConfig(&vrefConfig);
vrefConfig.bufferMode = kVREF_ModeBandgapOnly;
vrefConfig.enableInternalVoltageRegulator = false;
vrefConfig.enableVrefOut = false;
VREF_Init(VREF, &vrefConfig);

Regarding the ADC clock, I suppose that the 8MHz is too slow. This is the value you should set up:

xiangjun_rong_1-1684739499553.png

Regarding the ADC result which is not stable, I suggest you set a big value for the g_LpadcCommandConfigStruct.sampleTimeMode = kLPADC_SampleTimeADCK131;


/* Set conversion CMD configuration. */
LPADC_GetDefaultConvCommandConfig(&g_LpadcCommandConfigStruct);
g_LpadcCommandConfigStruct.channelNumber = xxxx;
g_LpadcCommandConfigStruct.sampleChannelMode = DEMO_LPADC_SAMPLE_CHANNEL_MODE;
g_LpadcCommandConfigStruct.sampleTimeMode = kLPADC_SampleTimeADCK131;
g_LpadcCommandConfigStruct.hardwareAverageMode = kLPADC_HardwareAverageCount128;
#if defined(FSL_FEATURE_LPADC_TEMP_SENS_BUFFER_SIZE)
g_LpadcCommandConfigStruct.loopCount = FSL_FEATURE_LPADC_TEMP_SENS_BUFFER_SIZE - 1U;
#endif /* FSL_FEATURE_LPADC_TEMP_SENS_BUFFER_SIZE */
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_MODE) && FSL_FEATURE_LPADC_HAS_CMDL_MODE
g_LpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
#endif /* FSL_FEATURE_LPADC_HAS_CMDL_MODE */
LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, DEMO_LPADC_USER_CMDID, &g_LpadcCommandConfigStruct);

Especially, when  the analog channel source has large impedance.

Hope it can help you

BR

XiangJun Rong

 

1,680 Views
alejandra_guzman
NXP Employee
NXP Employee

Thanks for the feedback, I have submitted a change request to our config tools team.