I have a problem using the sequences of the LPC822.
When I select multiple channels to be read in a sequence and I select single step everything is fine and the correct values are read. However when disabling single step one channel (10) gives me wrong values. The incorrect value is consistent though, it wil always be the same incorrect value.
Anyone got any idea what this could possibly be? Source code down below. A convertion is triggered manually by the MRT every 100ms.
/* Power up ADC and enable ADC clock */
/* Perform ADC calibration */
LPC_ADC->CTRL = ADC_CR_CLKDIV((SystemCoreClock / 500000) - 1) | ADC_CR_CALMODEBIT;
while((LPC_ADC->CTRL & ADC_CR_CALMODEBIT) != 0); // Wait until the CALLMODE bit clears
/* Set the ADC clock divider for maximum speed */
LPC_ADC->CTRL = ADC_CR_CLKDIV(0);
/* Configure SEQA as to read the current, temperature and voltage */
LPC_ADC->SEQ_CTRL = ADC_SEQ_CTRL_CHANSEL(3) | ADC_SEQ_CTRL_CHANSEL(10) | ADC_SEQ_CTRL_CHANSEL(11);
/* Trigger polarity is positive edge */
LPC_ADC->SEQ_CTRL |= ADC_SEQ_CTRL_HWTRIG_POLPOS;
/* Interrupt at end of sequence */
LPC_ADC->SEQ_CTRL |= ADC_SEQ_CTRL_MODE_EOS;
/* Enable SEQA */
LPC_ADC->SEQ_CTRL |= ADC_SEQ_CTRL_SEQ_ENA;
/* Enable interrupts for SEQA */
LPC_ADC->INTEN = ADC_INTEN_SEQA_ENABLE;
state.current = CONVERT_ADC_CURRENT(ADC_DR_RESULT(LPC_ADC->DR));
state.temperature = CONVERT_ADC_TEMPERATURE(ADC_DR_RESULT(LPC_ADC->DR));
state.voltage = CONVERT_ADC_VOLTAGE(ADC_DR_RESULT(LPC_ADC->DR));