LPC1788 ADC Burst Mode Issues

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

LPC1788 ADC Burst Mode Issues

1,203 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Tue Oct 04 03:17:53 MST 2011
I am trying to converter two ADC channels (0 and 2) in burst mode.
The issue is that it always returns 0 as the converted value so something must be wrong.
It appears that the ADC is performing conversion but maybe the pin config is not right (however I have triple checked it and cannot find the issue, hence this post).

The code use by the ADC is as such:
LPC_ADC->CR = (1 << 21) | (9 << 8); // Set PDN bit -> operational | CLKDIV = 9+1 -> 10MHz ADC clock
LPC_ADC->INTEN = 0; // disable all IRQs for ADC.

...

LPC_IOCON->P0_23 = (1 << 8) + 0x1; // ADC0[0]
LPC_IOCON->P0_25 = (1 << 8) + 0x1; // ADC0[2]

...

LPC_ADC->CR &= 0xFFFEFF00; // deselect all channels. Stop ADC.
LPC_ADC->CR |= (1 << 0) | (1 << 2);// sel Channels
LPC_ADC->CR |= (1 << 16); // Burst mode ON!
volatile uint32_t dataRegister;
do {
dataRegister = LPC_ADC->DR[0];
} while ((dataRegister & ADC_DONE) == 0);
// Now can process last sample
ProcessData(dataRegister);
do {
dataRegister = LPC_ADC->DR[2];
} while ((dataRegister & ADC_DONE) == 0);
LPC_ADC->CR &= ~(1 << 16); // STOP bursting...last one will be done anyway


Note that the PCON (power control) has the ADC bit enabled.

Unfortunately, the dataRegister always returns 0 for the converted bits.
I have check the pins on the LPC and the voltage is not zero (actually about 2V with a 3.3V supply). The analog VREFP and VDDA are connected to 3.3V and VSSA to GND.
The fact that conversions are happening (otherwise would be stuck in the do while loop), and that the result is always zero seems to point to a wrong IO Config but I can't find it...

Any help with this would be greatly appreciated.

Thank you.

Alex
0 Kudos
Reply
2 Replies

1,110 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Wed Oct 05 15:49:54 MST 2011
Closing it per previous post.
0 Kudos
Reply

1,110 Views
lpcware
NXP Employee
NXP Employee
Content originally posted in LPCWare by kralux on Wed Oct 05 00:40:01 MST 2011
Found out that this code works really well actually.
The main issue was that my LPC1788 had gone bad because of an accidental potential on one of the ADC pins (4.5V) which ended up killing the ADC internals and it would always return 0.
0 Kudos
Reply