EmbeddedRelated.com
Forums
The 2024 Embedded Online Conference

LPC2468 ADC values are always zero

Started by tike64 May 5, 2007
--- tike64 wrote:
> ADC-inputs are mostly at ground (I have measured)
and I exercise
them
> with about 2V.
>

One more suggestion. Recently we have a problem on one
of our boards because of a small negative voltage on
one of the ADC inputs( apr. -0.1 V). The result was
that any ADC measurement on any of the channels was
zero.

Regards
Zdravko Dimitrov

Знанието е лично преживяна истина.

____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html

An Engineer's Guide to the LPC2100 Series

--- Brendan Murphy wrote:
> It needn't be an ADC pin that a 5V i/p can cause problems.
>
> We discovered this a long time ago (before it was documented
> anywhere): we had a 5V UART interface, but because one of the pins on
>
> this could also be configured as an ADC it interfered with the entire
>
> ADC operation.
>
> Note this could be a complete red herring, as I don't know if this
> problem is present on the LPC2468 (and/or you mightn't have any 5V
> anywhere).

Thanks for the suggestions (to also Zdravko and others).

We measured all the pins and indeed we have some pins fed with 5V and
some with 3.45V. They are not the pins of the AD module, though.
Anyway, I programmed them all as logic low outputs (they are fed
through resistors) to prevent the overvoltage. undervoltages we didn't
found (Zdravko's suggestion). But nothing changed.

I also got a binary sample program from NXP which was supposed to work
at least on a LPC2368 board. That one too was unable to show anything
but zero.

Given, that even NXP itself hadn't anything more to offer than a
LPC2368 binary, I'm starting to wonder if there was even one working
LPC2468 device out there.

--

Timo

____________________________________________________________________________________Take the Internet to Go: Yahoo!Go puts the Internet in your pocket: mail, news, photos & more.
http://mobile.yahoo.com/go?refer=1GNXIC
--- In l..., tike64 wrote:
> Given, that even NXP itself hadn't anything more to offer than a
> LPC2368 binary, I'm starting to wonder if there was even one working
> LPC2468 device out there.
>

Hi Timo,

please try this code, tested on an LPC2468.
It's a modified version of your original post.
(It assumes CCLK = 48 MHz, PCLK(ADC) = 12 MHz)

Please note, that you have to wait for the DONE bit to get set.

Rolf

int main( void )
{
int i;
int adc;
uint32_t gdr;
// UART1 for printf
fnUart1Init();

// Connect ADC inputs
// (Only AD0.0 and AD0.1 on available hardware platform)
PINSEL1 = (PINSEL1 & ~0x0003C000) | 0x00014000;

// Enable ADC clock
PCONP |= 1 << 12;

// Run single conversion on several ADC inputs
adc = 0;
while( 1 )
{
// Start conversion
AD0CR = 0x01200200 | (1 << adc);

// End of conversion?
while( !((gdr = AD0GDR) & 0x80000000) )
;

// Show result
printf( "AD0.%d = %d\n",
(int)((gdr >> 24) & 7),
(int)((gdr >> 6) & 0x3FF) );

// Summary after all 8 channels
if( adc == 7 )
printf( "All: 0=%d 1=%d 2=%d 3=%d 4=%d 5=%d 6=%d 7=%d\n",
(AD0DR0 >> 6) & 0x3FF,
(AD0DR1 >> 6) & 0x3FF,
(AD0DR2 >> 6) & 0x3FF,
(AD0DR3 >> 6) & 0x3FF,
(AD0DR4 >> 6) & 0x3FF,
(AD0DR5 >> 6) & 0x3FF,
(AD0DR6 >> 6) & 0x3FF,
(AD0DR7 >> 6) & 0x3FF );

// Wait before starting the conversion on the next channel
for( i = 0 ; i < 1000000 ; i++ )
;

// Next channel
adc = (adc + 1) % 8;
}
}
--- rolfm_9dq wrote:
> please try this code, tested on an LPC2468.

Output is full of zeros...

Do you have a working LPC2468 system?

--

Timo

____________________________________________________________________________________
Sucker-punch spam with award-winning protection.
Try the free Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
Hi Timo,

yes, it runs on the LPC2468 board from Embedded
Artists.

Rolf
--- tike64 schrieb:

> --- rolfm_9dq wrote:
> > please try this code, tested on an LPC2468.
>
> Output is full of zeros...
>
> Do you have a working LPC2468 system?
>
> --
>
> Timo
>
>
>
____________________________________________________________________________________
> Sucker-punch spam with award-winning protection.
> Try the free Yahoo! Mail Beta.
>
http://advision.webevents.yahoo.com/mailbeta/features_spam.html
>

__________________________________ Yahoo! Clever: Sie haben Fragen? Yahoo! Nutzer antworten Ihnen. www.yahoo.de/clever
This may be a wee bit off topic, but on my PCB, I replaced
the LPC2144 chip a couple of times, and the part I have
on that board now has a noise problem in the A/D channel
zero at least. The DC voltage reading won't sit still
like it does in all the other boards I have.

Just an FYI. The parts "CAN" be faulty sometimes.
I also found that I have to put a bigger electrolytic
cap across one of the 3.3V bypass caps for the other
LPC214x parts to be steady. I also bypass the A/D
reference pretty well. Evidently the LPC214x power
supply ripple will mix in with the other voltages (or
ground) and give confusing A/D results if the board
layout isn't perfect.

boB

--- In l..., Rolf Meeser wrote:
>
> Hi Timo,
>
> yes, it runs on the LPC2468 board from Embedded
> Artists.
>
> Rolf
> --- tike64 schrieb:
>
> > --- rolfm_9dq wrote:
> > > please try this code, tested on an LPC2468.
> >
> > Output is full of zeros...
> >
> > Do you have a working LPC2468 system?
> >
> > --
> >
> > Timo
> >
> >
> >
> >
> ____________________________________________________________________________________
> > Sucker-punch spam with award-winning protection.
> > Try the free Yahoo! Mail Beta.
> >
> http://advision.webevents.yahoo.com/mailbeta/features_spam.html
> > __________________________________ Yahoo! Clever: Sie haben
Fragen? Yahoo! Nutzer antworten Ihnen. www.yahoo.de/clever
>
--- In l..., tike64 wrote:
> I'm trying to get the ADC of the LPC2468 working but have
> had no luck so far. The result is always zero...

With joy and happy I can tell that the problem is solved. The solution
is as simple as keeping the DBGEN signal high and selecting the
relevant pins for ADC.

DBGEN pin being low seems to disconnect ADC from pins. The same seems
to happen to internal pullups also. I didn't find any mention from the
documentation about this.

About selecting the pin functions UM promptly says that you don't have
to do that, that ADC is always connected to the pins. This proved to
be false.

In the course I tested these two possibilities many times among many
other things but apparently not at the same time. NXP kindly took our
board and proved that there is nothing wrong with the board nor with
the chip. They didn't see no problem at all because they had to pull
the DBGEN low for JTAG debugger. I didn't use JTAG debugger, but when
I saw the working board I got immediate revelation...

Hopefully this saves someone other from the same kind of grief.

Thanks for the group for trying to help: Rolf, Brendan, Leon, Zdravko,
Chris, boB, Robert, Karl, Mark and Niels

--

Timo

The 2024 Embedded Online Conference