LPC5536-EVK voltage reference: driver_examples/vref_1_example requires jumper cable?

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

LPC5536-EVK voltage reference: driver_examples/vref_1_example requires jumper cable?

Jump to solution
1,009 Views
danielholala
Senior Contributor II

Hi,

I have an LPC5536-EVK and have been playing with the analog features.

The LPC553x includes a voltage reference. The voltage reference provides a buffered reference voltage for use as an external reference, which can be set to from 1.0 V to 2.1 V.

To test the internal voltage reference, I ran driver example "vref_1_example" from the LPC5536 SDK 2.14.0This test uses the ADC to measure different voltage settings of internal VREF.

However, the value measured by ADC does not correlate with the VREF trimming except if I put a jumper cable from VREF_OUT (pin  16 @ J12) to BEMF_B/CUR_B (pin 3 @ J9).

It seems to me that this example requires an jumper cable. Is this correct?
Why does the source code does not contain an information about this prerequisite?

 

Labels (1)
0 Kudos
Reply
1 Solution
911 Views
danielholala
Senior Contributor II

Hello XiangJun Rong,

I found the documentation. After you import the example from the SDk, the documentation "readme.txt" can be found in the "doc" folder. And it mentions the jumper cable.

I guess I missed that one.

Case closed .-)

Cheers
Daniel

View solution in original post

0 Kudos
Reply
4 Replies
970 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

The answer is Yes. If you use ADC to sample external analog voltage, you have to select the analog channel in software, and connect the analog channel to the analog voltage with a cable.

From software perspective, pls check the code:

In the firmware of the *vref_1_example, this is the code to initialize ADC:

#define DEMO_LPADC_BASE ADC0
/* Use adc to measure VREF_OUT. */
#define DEMO_LPADC_USER_CHANNEL 8U

static void LPADC_Configuration(void)
{
lpadc_config_t mLpadcConfigStruct;
lpadc_conv_trigger_config_t mLpadcTriggerConfigStruct;
lpadc_conv_command_config_t mLpadcCommandConfigStruct;

LPADC_GetDefaultConfig(&mLpadcConfigStruct);
mLpadcConfigStruct.enableAnalogPreliminary = true;
#if defined(DEMO_LPADC_VREF_SOURCE)
mLpadcConfigStruct.referenceVoltageSource = DEMO_LPADC_VREF_SOURCE;
#endif /* DEMO_LPADC_VREF_SOURCE */
#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS) && FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS
mLpadcConfigStruct.conversionAverageMode = kLPADC_ConversionAverage128;
#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CAL_AVGS */
LPADC_Init(DEMO_LPADC_BASE, &mLpadcConfigStruct);

#if defined(FSL_FEATURE_LPADC_HAS_CTRL_CALOFS) && FSL_FEATURE_LPADC_HAS_CTRL_CALOFS
#if defined(FSL_FEATURE_LPADC_HAS_OFSTRIM) && FSL_FEATURE_LPADC_HAS_OFSTRIM
LPADC_DoOffsetCalibration(DEMO_LPADC_BASE);
#endif /* FSL_FEATURE_LPADC_HAS_OFSTRIM */
/* Request gain calibration. */
LPADC_DoAutoCalibration(DEMO_LPADC_BASE);
#endif /* FSL_FEATURE_LPADC_HAS_CTRL_CALOFS */
#if (defined(FSL_FEATURE_LPADC_HAS_CFG_CALOFS) && FSL_FEATURE_LPADC_HAS_CFG_CALOFS)
/* Do auto calibration. */
LPADC_DoAutoCalibration(DEMO_LPADC_BASE);
#endif /* FSL_FEATURE_LPADC_HAS_CFG_CALOFS */

/* Set conversion CMD configuration. */
LPADC_GetDefaultConvCommandConfig(&mLpadcCommandConfigStruct);
mLpadcCommandConfigStruct.channelNumber = DEMO_LPADC_USER_CHANNEL;
#if defined(FSL_FEATURE_LPADC_HAS_CMDL_MODE) && FSL_FEATURE_LPADC_HAS_CMDL_MODE
mLpadcCommandConfigStruct.conversionResolutionMode = kLPADC_ConversionResolutionHigh;
#endif /* FSL_FEATURE_LPADC_HAS_CMDL_MODE */
LPADC_SetConvCommandConfig(DEMO_LPADC_BASE, DEMO_LPADC_USER_CMDID, &mLpadcCommandConfigStruct);

......

}

The software select the ADC0_8A channel, which corresponds to the P0_31 pin for the LPC5536.

The P0_31 is connected to the pin3 of J9.

 

xiangjun_rong_0-1696736685165.png

Of course, you can use the ADC0_3A to sample Vrefout, in the case, you can change:

#define DEMO_LPADC_USER_CHANNEL 3U

From hardware perspective, connect the Vrefout(pin16 of J12) to pin1 of J9.

Hope it can help you

BR

XiangJun Rong

 

948 Views
danielholala
Senior Contributor II

Hello!

Thank you @xiangjun_rong  for the explanation.

I am just wondering why NXP leaves that as an exercise for the user? IMHO, the information about the jumper cable should be included in the example documentation, code, printout, etc.

Further, we could do away with a jumper cable by setting

#define DEMO_LPADC_USER_CHANNEL 5U

as, according to the manual, ADC channel 5 is connected to VREF_OUT.

danielholala_0-1696837762001.png

This way the example works "out of the box".

That makes a lot of sense to me. What about you?

Cheers
Daniel

 

 

 

 

0 Kudos
Reply
945 Views
xiangjun_rong
NXP TechSupport
NXP TechSupport

Hi,

Yes, you can use ADC0_5A channel to sample the VTEF_OUT voltage, because they are connected internally.

But the ADC example can simulate customer real environment, for example, the customer has to do the pin assignment for ADC analog channel.

BR

XiangJun Rong

0 Kudos
Reply
912 Views
danielholala
Senior Contributor II

Hello XiangJun Rong,

I found the documentation. After you import the example from the SDk, the documentation "readme.txt" can be found in the "doc" folder. And it mentions the jumper cable.

I guess I missed that one.

Case closed .-)

Cheers
Daniel

0 Kudos
Reply