Confused setting up the ADC External interface pins.

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

Confused setting up the ADC External interface pins.

448 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by andypevy on Wed May 06 08:40:11 MST 2015
Hi,  Looking at the spec relating to the ADC Input pins, it seems to indicate that I should use
Pin Function 0 to select the ADC input.

However looking at the demo code in both the NXP provided examples and the html
documantation, it says :-


Basic driver use model
Follow these basic steps to setup and use the ADC driver.

Step 1 : Perform setup prior to using ROM
The ROM drivers don't setup clocking, pin muxing, etc. Setup the pin muxing, peripheral clocking, and reset the peripheral prior to calling the ROM functions. Before using the driver, perform setup functions the ROM driver doesn't perform. These include enabling the clock, resetting the peripheral, and setting up any pin muxing and pin mode to analog needed for the peripheral. The setup for this may vary per software platform used. The setup code below is from LPCOpen.

/* Below code sets 12-ADC Pins to Analog mode, pins to inactive, neither pull-up nor pull-down. */
/* A typical application will enable only channels that are used */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 29, IOCON_MODE_INACT | IOCON_FUNC1 | IOCON_ANALOG_EN); /* ADC CH0 */
Chip_IOCON_PinMuxSet(LPC_IOCON, 0, 30, IOCON_MODE_INACT | IOCON_FUNC1 | IOCON_ANALOG_EN); /* ADC CH1 */

Chop here for brevity...

/* Power up ADC and enable ADC base clock */
Chip_SYSCTL_PowerUp(PDRUNCFG_PD_ADC0 | PDRUNCFG_PD_VD7_ENA | PDRUNCFG_PD_VREFP_SW);
Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_ADC0);


Which specifically selects IOCON_FUNC1 rather than 0.

IOCON_FUNC1 is specified as R - Reserved in the Pin Description in UM10850 chapter 7 .

All the other settings make sense.

So which is correct, the code or the Spec ??.

Thanks,
Andy



Labels (1)
0 Kudos
2 Replies

409 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bhoomil on Wed Jun 03 03:59:42 MST 2015
I think in user manual FUNC0 & FUNC1 are club together in one column. may be it is part of printing mistake!!! but thanks for locating towards them.
0 Kudos

409 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by nerd herd on Wed May 06 11:20:51 MST 2015
Hi andypevy,

What you have found is true, the sample code and UM spec do not match up. I have tested the ADC example and it seems that whether the pins are selected as FUNC0 or FUNC1, the pins still function as ADC pins. For now, please use FUNC0. I will investigate further on why there is a discrepancy.
0 Kudos