lpcware

Non working ADC on LPC824

Discussion created by lpcware Employee on Jun 15, 2016
Latest reply on Jun 15, 2016 by lpcware
Content originally posted in LPCWare by remcopoelstra on Thu Mar 12 02:58:14 MST 2015
Hi,

I'm trying to get the ADC on the LPC824. I currently apply either 0V or 3V3 on channel 0, but as a result I always get back a value in the range 0x20-0x30.
Enabled the channel 0 pin in SWM.
I've enabled power and clock to the ADC.
Run the calibration.
Setup a clock of 500kHz
Enabled a burst sequence.
Since my source has quite a high impedance (1kOhm), I see the ripple of the ADC on the signal and it's 20kHz, as expected.
In the debugger I see that the values in the data registers get updated all the time, but the range is always 0x20-0x30.
I checked VREFP and VREFN and they are 3V3 and 0V.

Condensed code:

Chip_SWM_EnableFixedPin(SWM_FIXED_ADC0);
Chip_ADC_Init(LPC_ADC,0); //This will enable power and clock
Chip_ADC_StartCalibration(LPC_ADC);
while(!Chip_ADC_IsCalibrationDone(LPC_ADC));
Chip_ADC_SetClockRate(LPC_ADC,500000); //500kHz
Chip_ADC_SetupSequencer(LPC_ADC,ADC_SEQA_IDX,
ADC_SEQ_CTRL_CHANSEL(0)|
ADC_SEQ_CTRL_MODE_EOS);
Chip_ADC_EnableSequencer(LPC_ADC,ADC_SEQA_IDX);
Chip_ADC_StartBurstSequencer(LPC_ADC,ADC_SEQA_IDX);


What am I doing wrong? Did I miss something?

Thanks in advance.

Kind regards,

Remco Poelstra

Outcomes