LPC11U14 cannot read all ADC channels

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

LPC11U14 cannot read all ADC channels

218 Views
lpcware
NXP Employee
NXP Employee
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.
0 Kudos
2 Replies

187 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by davidluca3000 on Mon Feb 16 17:52:42 MST 2015
That's it, fixed now, thank you very much!
0 Kudos

187 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by R2D2 on Mon Feb 16 16:42:19 MST 2015

Quote: davidluca3000
... and 3 of them just 0 (pins P0_15, P0_16, P0_22), any idea why I cannot read all of them?



AD functions are IOCON_FUNC1 there  :)
0 Kudos