lpcware

LPC11U14 cannot read all ADC channels

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by davidluca3000 on Mon Feb 16 15:08:03 MST 2015
Hello,
I'm having some problems when reading ADC channels on a LPCXpresso LPC11U14  board, my initialization code is:
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 11, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 12, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 13, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 14, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 15, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));//SW
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 16, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 22, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
Chip_IOCON_PinMuxSet(LPC_IOCON, JOYSTICK_GPIO_PORT0_NUM, 23, (IOCON_FUNC2 | IOCON_ADMODE_EN | IOCON_HYS_EN));
/* ADC Init */
Chip_ADC_Init(LPC_ADC, &ADCSetup);

static short ADCout[8];
for(ADC_CHANNEL_T ch = ADC_CH0; ch <= ADC_CH7; ch++)
{
Chip_ADC_EnableChannel(LPC_ADC, ch, ENABLE);
Chip_ADC_SetStartMode(LPC_ADC, ADC_START_NOW, ADC_TRIGGERMODE_RISING);
/* Waiting for A/D conversion complete */
while(Chip_ADC_ReadStatus(LPC_ADC, ch, ADC_DR_DONE_STAT) != SET){}
/* Read ADC value */
Chip_ADC_ReadValue(LPC_ADC, ch, &ADCout[ch]);
}
On each pin there is a 10k potentiometer connected like a voltage divider, I can read values on 5 and 3 of them just 0 (pins P0_15, P0_16, P0_22), any idea why I cannot read all of them? I am disconnecting the USB cable from Jtag side when reading the values.
Thank you in advance,
David.

Outcomes