Other Parts Discussed in Thread: TM4C129XNCZAD,
Tool/software:
Hi,
We recently updated our embedded microcontroller from the tm4c129xnczad to the TM4C1294NCPDT.
The ADC setup method (c++) was :
(tm4c129xnczad )
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
SysCtlADCSpeedSet(SYSCTL_ADCSPEED_125KSPS);
ADCSequenceDisable(ADC0_BASE, 0);
ADCHardwareOversampleConfigure(ADC0_BASE, 64);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0,
ADC_CTL_CH0 | ADC_CTL_IE);
adc = new TivaWareIntegratedADCDriver(ADC0_BASE, 0, 0);
((TivaWareIntegratedADCDriver*) adc)->setSharedBuffer(*adcSharedBuffer);
...
ADCIntEnable(ADC0_BASE, 0);
ADCSequenceEnable(ADC0_BASE, 0);
and worked fine.
After the processor driver update the macro SysCtlADCSpeedSet is not available anymore so the code that replace it looks like this:
(TM4C1294NCPDT)
ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_EIGHTH, 64);
The problem is that the adc feedback is not accurate. In idle state all the adc feedbacks goes from 1 to 1353 every second.
Is the code for the new processor correct in the ADC setup? Is there an other way to do this?
This is the complete method for the new microcontroller:
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);
ADCClockConfigSet(ADC0_BASE, ADC_CLOCK_SRC_PLL | ADC_CLOCK_RATE_EIGHTH, 64);
ADCSequenceDisable(ADC0_BASE, 0);
ADCHardwareOversampleConfigure(ADC0_BASE, 64);
ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 0,
ADC_CTL_CH0 | ADC_CTL_IE);
adc= new TivaWareIntegratedADCDriver(ADC0_BASE, 0, 0);
((TivaWareIntegratedADCDriver*) adc)->setSharedBuffer(*adcSharedBuffer);
...
ADCIntEnable(ADC0_BASE, 0);
ADCSequenceEnable(ADC0_BASE, 0);