Hi there,
I am reading some ADC conversions with and without oversampling (just to find the best option), but oversampling is generating unexpected results.
These are some raw values taken every two seconds WITH hw oversampling (minding only the ISys value):
[3/17 11:26:09.6]= VBatX10 222 | ISys 1544 =
[3/17 11:26:11.6]= VBatX10 222 | ISys 1543 =
[3/17 11:26:13.6]= VBatX10 222 | ISys 1549 =
[3/17 11:26:15.6]= VBatX10 222 | ISys 1546 =
[3/17 11:26:17.6]= VBatX10 222 | ISys 1545 =
[3/17 11:26:19.6]= VBatX10 222 | ISys 1544 =
[3/17 11:26:21.6]= VBatX10 222 | ISys 1543 =
And these are readings under similar conditions, but WITHOUT oversampling set (these are more like the expected values):
[3/17 11:26:29.7]= VBatX10 221 | ISys 1748 =
[3/17 11:26:31.7]= VBatX10 222 | ISys 1770 =
[3/17 11:26:33.7]= VBatX10 220 | ISys 1752 =
[3/17 11:26:35.7]= VBatX10 222 | ISys 1752 =
[3/17 11:26:37.7]= VBatX10 222 | ISys 1762 =
[3/17 11:26:39.7]= VBatX10 222 | ISys 1779 =
[3/17 11:26:41.7]= VBatX10 221 | ISys 1747 =
The configuration for the readings can be seen in the code below (oversample line commented here):
MAP_SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC1); while(!(SysCtlPeripheralReady(SYSCTL_PERIPH_ADC1))); // MAP_ADCHardwareOversampleConfigure(ADC1_BASE, 64); MAP_ADCSequenceDisable(ADC1_BASE, 0); // Good practice to disable a sequence before configuring it MAP_ADCSequenceConfigure(ADC1_BASE, 0, ADC_TRIGGER_PROCESSOR, 0); // Base1, Sequence0, Processor, Priority0 MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 0, ADC_CTL_CH3); // V_Bat MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 1, ADC_CTL_CH2); // V_Aux MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 2, ADC_CTL_CH0); // I_System MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 3, ADC_CTL_CH11); // I_Extern MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 4, ADC_CTL_CH1); // I_Charge MAP_ADCSequenceStepConfigure(ADC1_BASE, 0, 5, ADC_CTL_TS | ADC_CTL_IE | ADC_CTL_END); // IC Temperature // The last step needs to inform that it is the END, and also causes an interrupt MAP_ADCIntClear(ADC1_BASE, 0); ADCIntEnable(ADC1_BASE, 0); IntEnable(INT_ADC1SS0); MAP_ADCSequenceEnable(ADC1_BASE, 0);
Looking at the signal on a scope does not suggest any ripple, noise or something that could trick the ADC at an oversampling rate, or at least I could not see it.
Any lights as to what could be causing this? Thanks!