Hi Jorge,
I am just back from vacation today... thank you for your reply.
I am using the SDk and as far as I can tell I am already doing everything you have suggested.
I configure and enable the VREF using VREF_DRV_Init() with the following configuration :
vref_user_config_t vrefInit = {
.chopOscEnable = true,
.trimValue = VREF_DRV_GetTrimValue(0),
.regulatorEnable = true,
.soccEnable = true ,
.bufferMode = kVrefModeLowPowerBuffer };
Then configure the ADC using ADC16_DRV_Init() and the following configuration :
adc16_converter_config_t adcInit = {
.lowPowerEnable = true,
.clkDividerMode = kAdc16ClkDividerOf8,
.longSampleTimeEnable = true,
.resolution = kAdc16ResolutionBitOfSingleEndAs10,
.clkSrc = kAdc16ClkSrcOfAltClk,
.asyncClkEnable = false,
.highSpeedEnable = false,
.longSampleCycleMode = kAdc16LongSampleCycleOf24,
.hwTriggerEnable = false,
.refVoltSrc = kAdc16RefVoltSrcOfValt,
//.refVoltSrc = kAdc16RefVoltSrcOfVref,
.continuousConvEnable = false,
.dmaEnable = false } ;
I measure 1.194V on the 100nF capacitor on PTE30, so it appears the reference is enabled and working.
I measure 0.479V at the ADC channel pin, and with the .refVoltSrc = kAdc16RefVoltSrcOfValt, I get a conversion result of 0x093 (147d), which seems to suggest the reference votlage is 3.3V.
I just noticed however that if I select .refVoltSrc = kAdc16RefVoltSrcOfVref, the conversion result is 0x19E (414d), which looks like the reference is 1.2V nominal.
I have checked the value of the REFSEL bits in ADC0_SC2 and kAdc16RefVoltSrcOfValt sets REFSEL = 1 and kAdc16RefVoltSrcOfVref sets REFSEL = 0, so the SDK is setting the right values however the effect seems the be backwards... REFSEL = 1 appears to select the Vrefh whereas REFSEL = 0 appears to select Valth..
Is it possible that either the documentation of the REFSEL bits (or the silicon implementation, since the way it's documented seems logical) is backwards?
Nick