I'm trying to use an external voltage reference with the Tiva C LaunchPad ADC - but for some reason it just won't use it...
I followed the instructions on http://www.ti.com/lit/ds/symlink/tm4c1294ncpdt.pdf page 1164 and 1861. The latter page states:
"VREFA+ = Positive external voltage reference for ADC, when VREF field in the ADCCTL register is 0x1"
I assume "VREFA+" is the "VREF" pin 34 (see http://www.ti.com/lit/ug/spmu365a/spmu365a.pdf page 15) on the Tiva C LaunchPad and I got a REF5040 divided to 3.079V connected to that pin.
This is the code I'm setting things up with:
#define ADC_REF_EXT_3V 0x00000001 // External 3V reference
void ADCInit(void) { MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1); MAP_ADCReferenceSet(ADC1_BASE, ADC_REF_EXT_3V); // this define is 0x1 like demanded by page 1861 MAP_ADCHardwareOversampleConfigure(ADC1_BASE, 1); MAP_ADCSequenceConfigure(ADC1_BASE, 3, ADC_TRIGGER_TIMER, 0); MAP_ADCSequenceStepConfigure(ADC1_BASE, 3, 0, ADC_CTL_CH3 | ADC_CTL_IE | ADC_CTL_END); MAP_ADCSequenceEnable(ADC1_BASE, 3); MAP_ADCIntEnable(ADC1_BASE, 3); MAP_IntEnable(INT_ADC1SS3); MAP_ADCIntClear(ADC1_BASE, 3); } void ADCPinInit(void) { MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE); MAP_GPIOPinTypeADC(GPIO_PORTE_BASE, GPIO_PIN_0); }
However, all the samples I get are based on the internal voltage reference - exactly like setting
MAP_ADCReferenceSet(ADC1_BASE, ADC_REF_INT);
Am I missing something here or is this feature somehow broken on the Tiva C? Unfortunately I couldn't find anything on this issue yet...
Do I also get page 1861 right, that only 2.4V - 3.3V references are supported and there is no way around this?