This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

SW-EK-TM4C1294XL: Problem converting 8 simultaneous channels of ADCs

Part Number: SW-EK-TM4C1294XL

Good morning TI,

I'm having trouble using Tiva's ADCs (TM4C12294XL), my project needs to read 8 channels simultaneously every 500Hz, but in this code below I can read the channels of the ADCs: 0,1,2 and 3 of Correctly, but channels 8, 9 and 10 have inconsistent readings, could you give me support for what is wrong with my project?

//Setting ADC Channels

void setupADCs()
{
SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOE);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOE);

SysCtlPeripheralReset(SYSCTL_PERIPH_GPIOB);
SysCtlPeripheralEnable(SYSCTL_PERIPH_GPIOB);

SysCtlPeripheralReset(SYSCTL_PERIPH_ADC0);
SysCtlPeripheralEnable(SYSCTL_PERIPH_ADC0);

ADCSequenceDisable(ADC0_BASE, 0);

ADCHardwareOversampleConfigure(ADC0_BASE, ADC_SAMPLE_BUF_SIZE);

SysCtlDelay(10);

GPIOPinTypeADC(
GPIO_PORTE_BASE,
GPIO_PIN_5 | GPIO_PIN_4 | GPIO_PIN_3 | GPIO_PIN_2 | GPIO_PIN_1
| GPIO_PIN_0);

GPIOPinTypeADC(
GPIO_PORTB_BASE,
GPIO_PIN_4);


ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_PROCESSOR, 0);
//ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_ALWAYS, 0);
//ADCSequenceConfigure(ADC0_BASE, 0, ADC_TRIGGER_TIMER, 0);

ADCSequenceStepConfigure(ADC0_BASE, 0, 0, ADC_CTL_CH0);
ADCSequenceStepConfigure(ADC0_BASE, 0, 1, ADC_CTL_CH1);
ADCSequenceStepConfigure(ADC0_BASE, 0, 2, ADC_CTL_CH2);
ADCSequenceStepConfigure(ADC0_BASE, 0, 3, ADC_CTL_CH3);
ADCSequenceStepConfigure(ADC0_BASE, 0, 8, ADC_CTL_CH8);
ADCSequenceStepConfigure(ADC0_BASE, 0, 9, ADC_CTL_CH9);
ADCSequenceStepConfigure(ADC0_BASE, 0, 10,
(ADC_CTL_CH10 | ADC_CTL_IE | ADC_CTL_END));

ADCSequenceEnable(ADC0_BASE, 0);
// ADCSequenceEnable(ADC0_BASE, 1);
// ADCSequenceEnable(ADC0_BASE, 2);
// ADCSequenceEnable(ADC0_BASE, 3);
// ADCSequenceEnable(ADC0_BASE, 8);
// ADCSequenceEnable(ADC0_BASE, 9);
// ADCSequenceEnable(ADC0_BASE, 10);

IntEnable(INT_ADC0SS0);
}

//Rotine Call ISR Readind ADCs

void readingADCs(CMD_INPUT *inputRead)
{
uint32_t ui32ADCValues[10]; // lendo os 6 canais ADCs
float readADC;
//uint8_t number_sample;

//number_sample = WaitAndReadADC(ui32ADCValues);

// Read the value from the ADC.
ADCIntClear(ADC0_BASE, 0);

////[TODO] Investigar o tempo de 50us para conversão muito tempo na visão do Feed (04-12-20)
ADCSequenceDataGet(ADC0_BASE, 0, ui32ADCValues);

// WaitAndReadADC(ui32ADCValues);
// inputRead->inletPressAir = (3.0 * (float) ui32ADCValues[0]) / 4096.0;
// inputRead->inletPressO2 = (3.0 * (float) ui32ADCValues[1]) / 4096.0;

// Reading ADC0 (AIR INLET PRESS SENSOR - NXP5700) and digital conversion
// readADC = 3.3 * (((float) ui32ADCValues[0]) / 4096.0);
// inputRead->inletPressAir =readADC;

inputRead->inletPressAir = ((float) ui32ADCValues[0]
- OFFSET_ADC_INLET_PRESS_AIR) * GAIN_INLET_PRESS_AIR;

// Reading ADC1 (O2 INLET PRESS SENSOR - NXP5700) and digital conversion
// readADC = 3.3 * (((float) ui32ADCValues[1]) / 4096.0);
// inputRead->inletPressO2 =readADC;

inputRead->inletPressO2 = ((float) ui32ADCValues[1]
- OFFSET_ADC_INLET_PRESS_O2) * GAIN_INLET_PRESS_O2;


//----------------------------------------------------------------------------------------- LEITURA FLUXO INTERNO AR
//// formula do sensor Fluxo PMF4102V - Flow Rate = [(Vout - 1 V) / 4 V] x Full Scale Flow Rate
//// inputRead->flowAir = (3.3 * (float)ui32ADCValues[2]) / 4096.0;
//// inputRead->flowO2 = (3.3 * (float)ui32ADCValues[3]) / 4096.0;

//// Reading ADC2 (AIR FLOW SENSOR) and digital conversion
//// readADC = 3.3 * (((float) ui32ADCValues[2]) / 4096.0);
//// inputRead->flowAir =readADC;
//// inputRead->flowAir = ((readADC * FULLRANGE_FLOW) / VREF_FLOW) - OFFSET_FLOWAIR;

inputRead->flowAir = ((float) ui32ADCValues[2] * GAIN_FLOW_AIR)
- OFFSET_FLOW_AIR;

//limites min e max
if (inputRead->flowAir < 0)
{
inputRead->flowAir = 0;
}
else if (inputRead->flowAir > 150)
{
inputRead->flowAir = 150;
}

//----------------------------------------------------------------------------------------- LEITURA FLUXO INTERNO O2
// Reading ADC3 (O2 FLOW SENSOR) and digital conversion
// readADC = (3.3 * (float) ui32ADCValues[3]) / 4096.0;
// inputRead->flowO2 = readADC;
// inputRead->flowO2 = ((readADC * FULLRANGE_FLOW) / VREF_FLOW) - OFFSET_FLOWO2;

inputRead->flowO2 = ((float) ui32ADCValues[3] * GAIN_FLOW_O2)
- OFFSET_FLOW_O2;

//limites min e max
if (inputRead->flowO2 < 0)
{
inputRead->flowO2 = 0;
}
else if (inputRead->flowO2 > 150)
{
inputRead->flowO2 = 150;
}

//----------------------------------------------------------------------------------------- LEITURA PRESSÃO INSPIRATÓRIA
//Reading ADC8 (Inspiratory Pressure) and digital conversion
//inputRead->inspPress = (3.3 * (float) ui32ADCValues[4]) / 4096.0;

// readADC = (3.3 * (float) ui32ADCValues[4]) / 4096.0;
// inputRead->inspPress = readADC;

inputRead->inspPress = ((float) ui32ADCValues[4] * GAIN_PINSP) - OFFSET_PINSP;


//limites min e max
if (inputRead->inspPress < 0)
{
inputRead->inspPress = 0;
}
else if (inputRead->inspPress > 140)
{
inputRead->inspPress = 140;
}


// Reading ADC9 (Oxygen sensor) and digital conversion
//inputRead->cellO2 = (3.3 * (float) ui32ADCValues[5]) / 4096.0;

readADC = (3.3 * (float) ui32ADCValues[5]) / 4096.0;

readADC -= 0.678; // Offset
// inputRead->cellO2 = readADC;

//inputRead->cellO2 = ((float) ui32ADCValues[5] * GAIN_CELL_O2) - OFFSET_CELL_O2;
//inputRead->cellO2 = (0.6488 *(float) ui32ADCValues[5] ) + 86.375;
inputRead->cellO2 = (0.0228 * readADC ) + 21.0;

//limites min e max

if (inputRead->cellO2 < 0)
{
inputRead->cellO2 = 0;
}
else if (inputRead->cellO2 > 105)
{
inputRead->cellO2 = 105;
}

// Reading ADC10 (Pilot Exhalation Pressure) and digital conversion
//inputRead->inspPress = (3.3 * (float) ui32ADCValues[6]) / 4096.0;

readADC = (3.3 * (float) ui32ADCValues[6]) / 4096.0;
inputRead->expPilotPress = readADC;

// inputRead->expPilotPress = ((float) ui32ADCValues[6] * GAIN_PILOT_EXHALATION) - OFFSET_PILOT_EXHALATION;

ADCProcessorTrigger(ADC0_BASE, 0);
}

..."