I don't understand LPC824 analog input behaviour

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

I don't understand LPC824 analog input behaviour

525 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bthomas on Fri Apr 08 08:14:47 MST 2016
I have built a board with a LPC824. Amongst other things it utilizes 2 analog inputs, ADC_9 and ADC_10. ADC_9 is connected to a potmeter, ADC_10 is connected to an analog multiplexer (4051). The inputs of the analog multiplexer are 0-5V signals. As these exceed 3.3V, there is a voltage divider of 12k (upper) and 22k (lower) on each input.

The behaviour I observe is that, on the selected channel, a voltage appears when the channel is selected and without anything input to the divider.  So to simplify this: ADC_10 has a resistor of 22k to ground and a voltage appears on the input of the ADC.  I disabled the internal pull-ups and I am sure this works, as the voltage increased quite a lot when I enable the pull-ups. The voltage I measure is ~180mV. I did notice that the analog inputs have a quite low impedance of 100k, but I assume this 100k is to ground so I don't understand where the current comes from that creates this voltage drop over the 22k resistor.

Even a bit more strange, if I enable ADC_9, connected to the potmeter, the voltage on the resistor on ADC_10 changes with the position of the potmeter, thus with the voltage on ADC_9.

I saw messages here and elsewhere of people describing similar behavior but I have not seen any reply that was confirmed to be the solution.

Anyone has any idea?
Labels (1)
0 Kudos
2 Replies

321 Views
lpcware
NXP Employee
NXP Employee
bump
0 Kudos

321 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by bthomas on Mon Apr 11 08:33:36 MST 2016
Additional information: I reduced the hardware to single LPC824 chip, 2 100nF capacitors, FTDI USB uart cable connected to uart, 3.3V supplied by bench power supply. P0_13 connected to 22k resistor connected to ground. There is still a voltage over the 22k resistor and the ADC input value is not anywhere near to 0.

UART demo:
build date: Apr 11 2016 build time: 17:14:06
speed 30000000 Hz
entering mainloop
adc: e8021d10


Software reduced to basically:

int main(void)
{
  Chip_SystemInit();
SystemCoreClockUpdate();
UART_Init();
  Chip_UART_Init(DEBUG_UART);
  Chip_UART_ConfigData(DEBUG_UART, UART_CFG_DATALEN_8 | UART_CFG_PARITY_NONE | UART_CFG_STOPLEN_1);
  Chip_Clock_SetUSARTNBaseClockRate((115200 * 16), true);
  Chip_UART_SetBaud(DEBUG_UART, 115200);
  Chip_UART_Enable(DEBUG_UART);
  Chip_UART_TXEnable(DEBUG_UART);

  Chip_GPIO_Init(LPC_GPIO_PORT);
ansi_clr_screen();
printf("UART demo:\r\n"
       "build date: " __DATE__ " build time: " __TIME__ "\r\n"
       "speed %lu Hz\r\n",Chip_Clock_GetSystemClockRate());

  /* Enable the clock to the Switch Matrix */
  Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_SWM);
  Chip_SWM_EnableFixedPin(SWM_FIXED_ADC10); // mux output

  Chip_Clock_EnablePeriphClock(SYSCTL_CLOCK_IOCON);
  LPC_IOCON->PIO0[IOCON_PIO13] = 0x80;
  Chip_Clock_DisablePeriphClock(SYSCTL_CLOCK_IOCON);

  Chip_ADC_Init(LPC_ADC, 0);

  /* Need to do a calibration after initialization and trim */
  Chip_ADC_StartCalibration(LPC_ADC);
  while (!(Chip_ADC_IsCalibrationDone(LPC_ADC))) {}

  /* Setup for maximum ADC clock rate using sycnchronous clocking */
  Chip_ADC_SetClockRate(LPC_ADC, ADC_MAX_SAMPLE_RATE);
  Chip_ADC_SetupSequencer(LPC_ADC, ADC_SEQA_IDX,
              (ADC_SEQ_CTRL_CHANSEL(10) | ADC_SEQ_CTRL_MODE_EOS));

  /* Disable the clock to the Switch Matrix to save power */
  Chip_ADC_SetSequencerBits(LPC_ADC, ADC_SEQA_IDX, ADC_SEQ_CTRL_SEQ_ENA | ADC_SEQ_CTRL_BURST);

/* Enable SysTick Timer */
SysTick_Config(SystemCoreClock / TICKRATE_HZ);

printf("entering mainloop\r\n>");
/* Loop forever */
while (1) {
    printf("adc: %x  \r", Chip_ADC_GetDataReg(LPC_ADC, 10));
  cmdline();
}


Schematic of test circuit added as attachment

0 Kudos