Hello everyone,
I'm trying to get the ADC of the LPC2468 working but have had no luck
so far. The result is always zero. I have checked the voltages (VREF,
VDDA, VSSA and relevant AD0 inputs), PINSEL registers (which should
have no effect, though) and PCON register. When I write 0x0120FF01 to
AD0CR the DONE bits will go high after a short time (and clear by
reading them) in AD0GDR and ADDR0 registers as expected but the result
field, bits 6..15, stays zero.
I have tried several devices.
I wonder, is there anybody out there who has got the ADC working?
Any ideas?
--
Timo
____________________________________________________________________________________
Expecting? Get great news right away with email Auto-Check.
Try the Yahoo! Mail Beta.
http://advision.webevents.yahoo.com/mailbeta/newmail_tools.html
LPC2468 ADC values are always zero
Started by ●May 5, 2007
Reply by ●May 5, 20072007-05-05
--- tike64 wrote:
> Hello everyone,
>
> I'm trying to get the ADC of the LPC2468 working but
> have had no luck
> so far. The result is always zero. I have checked
> the voltages (VREF,
> VDDA, VSSA and relevant AD0 inputs), PINSEL
> registers (which should
> have no effect, though) and PCON register. When I
> write 0x0120FF01 to
> AD0CR the DONE bits will go high after a short time
> (and clear by
> reading them) in AD0GDR and ADDR0 registers as
> expected but the result
> field, bits 6..15, stays zero.
>
> I have tried several devices.
>
> I wonder, is there anybody out there who has got the
> ADC working?
>
> Any ideas?
>
> --
>
> Timo
>
Hello Timo,
You should write the SEL and START bitfields of AD0CR
in two separate writes:
AD0CR = 0x0020FF01;
AD0CR |= (1<<24);
There is a note about this in the UM of the other
members of LPC2000. I can't see this note in the
LPC2468 UM. But it looks that the ADC is the same.
Try writing AD0CR as the above example.
Regards
Zdravko Dimitrov
Знанието е лично преживяна истина.
__________________________________________________
> Hello everyone,
>
> I'm trying to get the ADC of the LPC2468 working but
> have had no luck
> so far. The result is always zero. I have checked
> the voltages (VREF,
> VDDA, VSSA and relevant AD0 inputs), PINSEL
> registers (which should
> have no effect, though) and PCON register. When I
> write 0x0120FF01 to
> AD0CR the DONE bits will go high after a short time
> (and clear by
> reading them) in AD0GDR and ADDR0 registers as
> expected but the result
> field, bits 6..15, stays zero.
>
> I have tried several devices.
>
> I wonder, is there anybody out there who has got the
> ADC working?
>
> Any ideas?
>
> --
>
> Timo
>
Hello Timo,
You should write the SEL and START bitfields of AD0CR
in two separate writes:
AD0CR = 0x0020FF01;
AD0CR |= (1<<24);
There is a note about this in the UM of the other
members of LPC2000. I can't see this note in the
LPC2468 UM. But it looks that the ADC is the same.
Try writing AD0CR as the above example.
Regards
Zdravko Dimitrov
Знанието е лично преживяна истина.
__________________________________________________
Reply by ●May 5, 20072007-05-05
--- In l..., tike64 wrote:
>
> Hello everyone,
>
> I'm trying to get the ADC of the LPC2468 working but have had no luck
> so far. The result is always zero. I have checked the voltages (VREF,
> VDDA, VSSA and relevant AD0 inputs), PINSEL registers (which should
> have no effect, though) and PCON register. When I write 0x0120FF01 to
> AD0CR the DONE bits will go high after a short time (and clear by
> reading them) in AD0GDR and ADDR0 registers as expected but the result
> field, bits 6..15, stays zero.
>
> I have tried several devices.
>
> I wonder, is there anybody out there who has got the ADC working?
>
> Any ideas?
This very simple ADC test program for the LPC2148 works OK:
** Processor clock = 12 MHz
** default PCLK = 3 MHz on reset
**
*/
#include
int main(void)
{
unsigned short int val;
PINSEL1 = 0x01000000; // P0.28 set for AD0.1 input
AD0CR = 0x00210002; // setup A/D AD0.1 input (pin 13), 11
clocks/10 bits
AD0CR |= 0x01000000; // start conversion
while (1)
{
val = AD0DR1; // get ADC data
val = ((val >>6) & 0x03FF); // extract result
asm("nop");
}
}
Leon
>
> Hello everyone,
>
> I'm trying to get the ADC of the LPC2468 working but have had no luck
> so far. The result is always zero. I have checked the voltages (VREF,
> VDDA, VSSA and relevant AD0 inputs), PINSEL registers (which should
> have no effect, though) and PCON register. When I write 0x0120FF01 to
> AD0CR the DONE bits will go high after a short time (and clear by
> reading them) in AD0GDR and ADDR0 registers as expected but the result
> field, bits 6..15, stays zero.
>
> I have tried several devices.
>
> I wonder, is there anybody out there who has got the ADC working?
>
> Any ideas?
This very simple ADC test program for the LPC2148 works OK:
** Processor clock = 12 MHz
** default PCLK = 3 MHz on reset
**
*/
#include
int main(void)
{
unsigned short int val;
PINSEL1 = 0x01000000; // P0.28 set for AD0.1 input
AD0CR = 0x00210002; // setup A/D AD0.1 input (pin 13), 11
clocks/10 bits
AD0CR |= 0x01000000; // start conversion
while (1)
{
val = AD0DR1; // get ADC data
val = ((val >>6) & 0x03FF); // extract result
asm("nop");
}
}
Leon
Reply by ●May 7, 20072007-05-07
--- 3gpabko wrote:
> You should write the SEL and START bitfields of AD0CR
> in two separate writes:
>
> AD0CR = 0x0020FF01;
> AD0CR |= (1<<24);
Thanks for answering. No change, unfortunately. I tried exactly like
you said and also like this:
AD0CR = 0x0020FF01;
AD0CR = 0x0120FF01;
Nothing changes, AD0GDR and ADDR0 registers read always 0x80000000 or
plain zero.
Any more ideas?
--
Timo
____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
> You should write the SEL and START bitfields of AD0CR
> in two separate writes:
>
> AD0CR = 0x0020FF01;
> AD0CR |= (1<<24);
Thanks for answering. No change, unfortunately. I tried exactly like
you said and also like this:
AD0CR = 0x0020FF01;
AD0CR = 0x0120FF01;
Nothing changes, AD0GDR and ADDR0 registers read always 0x80000000 or
plain zero.
Any more ideas?
--
Timo
____________________________________________________________________________________
Don't get soaked. Take a quick peak at the forecast
with the Yahoo! Search weather shortcut.
http://tools.search.yahoo.com/shortcuts/#loc_weather
Reply by ●May 9, 20072007-05-09
--- tike64 wrote:
> -
> -
> Nothing changes, AD0GDR and ADDR0 registers read always 0x80000000 or
> plain zero.
>
> Any more ideas?
Isn't there anybody out there who have a working LPC24xx or LPC23xx ADC
or any other ideas?
--
Timo
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform0121
> -
> -
> Nothing changes, AD0GDR and ADDR0 registers read always 0x80000000 or
> plain zero.
>
> Any more ideas?
Isn't there anybody out there who have a working LPC24xx or LPC23xx ADC
or any other ideas?
--
Timo
____________________________________________________________________________________
Be a PS3 game guru.
Get your game face on with the latest PS3 news and previews at Yahoo! Games.
http://videogames.yahoo.com/platform?platform0121
Reply by ●May 9, 20072007-05-09
I've used several different LPC MCUs and never had any problem with the
ADCs. My guess is there is something wrong with your code that you have over
looked. Check all of your statements that affect the ADC and re-read the
documentation very carefully, also the errata.
I have a design right now beginning with the LPC2468. I don't know where you got "several parts", I only have (1) sample. You won't find many people who have used this part yet, because they are still damn hard to get. There were suppose to be more out in May but so far zip.
Chris.
I have a design right now beginning with the LPC2468. I don't know where you got "several parts", I only have (1) sample. You won't find many people who have used this part yet, because they are still damn hard to get. There were suppose to be more out in May but so far zip.
Chris.
Reply by ●May 9, 20072007-05-09
--- s...@hotmail.com wrote:
> I've used several different LPC MCUs and never had any problem with
> the ADCs. My guess is there is something wrong with your code that
> you have over looked.
Well, yes, that's also my guess. That is too often the case. But it
only makes the pain greater.
> Check all of your statements that affect the ADC and re-read the
> documentation very carefully, also the errata.
Believe me, I have checked everything and read datasheet and UM quite
many times. But some times reading again doesn't help if you have a
blind spot in your eye, figuratively.
Errata doesn't say anything (except about the DONE bit, which doesn't
apply here).
> I have a design right now beginning with the LPC2468. I don't know
> where you got "several parts", I only have (1) sample. You won't
> find many people who have used this part yet, because they are still
> damn hard to get. There were suppose to be more out in May but so
> far zip.
Too bad. Unfortunately we have soldered them all ;)
How long are you from trying the ADC? Would you please tell about your
mileage with it when you have tried it?
--
Timo
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
> I've used several different LPC MCUs and never had any problem with
> the ADCs. My guess is there is something wrong with your code that
> you have over looked.
Well, yes, that's also my guess. That is too often the case. But it
only makes the pain greater.
> Check all of your statements that affect the ADC and re-read the
> documentation very carefully, also the errata.
Believe me, I have checked everything and read datasheet and UM quite
many times. But some times reading again doesn't help if you have a
blind spot in your eye, figuratively.
Errata doesn't say anything (except about the DONE bit, which doesn't
apply here).
> I have a design right now beginning with the LPC2468. I don't know
> where you got "several parts", I only have (1) sample. You won't
> find many people who have used this part yet, because they are still
> damn hard to get. There were suppose to be more out in May but so
> far zip.
Too bad. Unfortunately we have soldered them all ;)
How long are you from trying the ADC? Would you please tell about your
mileage with it when you have tried it?
--
Timo
____________________________________________________________________________________
Never miss an email again!
Yahoo! Toolbar alerts you the instant new Mail arrives.
http://tools.search.yahoo.com/toolbar/features/mail/
Reply by ●May 9, 20072007-05-09
----- Original Message -----
From: "tike64"
To:
Sent: Wednesday, May 09, 2007 8:29 AM
Subject: Re: [lpc2000] LPC2468 ADC values are always zero
> --- s...@hotmail.com wrote:
>> I've used several different LPC MCUs and never had any problem with
>> the ADCs. My guess is there is something wrong with your code that
>> you have over looked.
>
> Well, yes, that's also my guess. That is too often the case. But it
> only makes the pain greater.
>
>> Check all of your statements that affect the ADC and re-read the
>> documentation very carefully, also the errata.
>
> Believe me, I have checked everything and read datasheet and UM quite
> many times. But some times reading again doesn't help if you have a
> blind spot in your eye, figuratively.
>
> Errata doesn't say anything (except about the DONE bit, which doesn't
> apply here).
>
You could post your ADC code, someone will probably see where you are going
wrong.
Leon
From: "tike64"
To:
Sent: Wednesday, May 09, 2007 8:29 AM
Subject: Re: [lpc2000] LPC2468 ADC values are always zero
> --- s...@hotmail.com wrote:
>> I've used several different LPC MCUs and never had any problem with
>> the ADCs. My guess is there is something wrong with your code that
>> you have over looked.
>
> Well, yes, that's also my guess. That is too often the case. But it
> only makes the pain greater.
>
>> Check all of your statements that affect the ADC and re-read the
>> documentation very carefully, also the errata.
>
> Believe me, I have checked everything and read datasheet and UM quite
> many times. But some times reading again doesn't help if you have a
> blind spot in your eye, figuratively.
>
> Errata doesn't say anything (except about the DONE bit, which doesn't
> apply here).
>
You could post your ADC code, someone will probably see where you are going
wrong.
Leon
Reply by ●May 9, 20072007-05-09
--- In l..., tike64 wrote:
>
> --- sig5534@... wrote:
> > I've used several different LPC MCUs and never had any problem
with
> > the ADCs. My guess is there is something wrong with your code
that
> > you have over looked.
>
> Well, yes, that's also my guess. That is too often the case. But it
> only makes the pain greater.
>
> > Check all of your statements that affect the ADC and re-read the
> > documentation very carefully, also the errata.
>
> Believe me, I have checked everything and read datasheet and UM
quite
> many times. But some times reading again doesn't help if you have a
> blind spot in your eye, figuratively.
>
> Errata doesn't say anything (except about the DONE bit, which
doesn't
> apply here).
>
> > I have a design right now beginning with the LPC2468. I don't
know
> > where you got "several parts", I only have (1) sample. You won't
> > find many people who have used this part yet, because they are
still
> > damn hard to get. There were suppose to be more out in May but so
> > far zip.
>
> Too bad. Unfortunately we have soldered them all ;)
>
> How long are you from trying the ADC? Would you please tell about
your
> mileage with it when you have tried it?
>
> --
>
> Timo
Have you checked the peripheral power control register?
I think the documented default value may be incorrect on at least
some of the parts, though this was some time ago.
If you can get it, maybe try some other code (known to work) on your
system. Or try your own code on some other system. This should
isolate whether the problem is h/w or s/w related.
Brendan
>
> --- sig5534@... wrote:
> > I've used several different LPC MCUs and never had any problem
with
> > the ADCs. My guess is there is something wrong with your code
that
> > you have over looked.
>
> Well, yes, that's also my guess. That is too often the case. But it
> only makes the pain greater.
>
> > Check all of your statements that affect the ADC and re-read the
> > documentation very carefully, also the errata.
>
> Believe me, I have checked everything and read datasheet and UM
quite
> many times. But some times reading again doesn't help if you have a
> blind spot in your eye, figuratively.
>
> Errata doesn't say anything (except about the DONE bit, which
doesn't
> apply here).
>
> > I have a design right now beginning with the LPC2468. I don't
know
> > where you got "several parts", I only have (1) sample. You won't
> > find many people who have used this part yet, because they are
still
> > damn hard to get. There were suppose to be more out in May but so
> > far zip.
>
> Too bad. Unfortunately we have soldered them all ;)
>
> How long are you from trying the ADC? Would you please tell about
your
> mileage with it when you have tried it?
>
> --
>
> Timo
Have you checked the peripheral power control register?
I think the documented default value may be incorrect on at least
some of the parts, though this was some time ago.
If you can get it, maybe try some other code (known to work) on your
system. Or try your own code on some other system. This should
isolate whether the problem is h/w or s/w related.
Brendan
Reply by ●May 9, 20072007-05-09
--- Leon wrote:
> You could post your ADC code, someone will probably see where you are
> going wrong.
Ok, I inline relevant parts here:
#include
#define PINSEL_BASE_ADDR 0xE002C000
#define PINSEL0 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x00))
#define PINSEL1 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x04))
#define PINSEL3 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x0C))
#define SCB_BASE_ADDR 0xE01FC000
#define PCONP (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x0C4))
#define AD0 (*(struct ad *)0xE0034000)
struct ad {
volatile unsigned long
cr, gdr, pad, inten, dr[8], stat; };
volatile int
Timer; // 10ms counter
int
main(void) {
static unsigned adreg[16], add[16];
int adt, i;
PINSEL0 = 0x4F000A54; // I have checked these
PINSEL1 = 0x14155C05; // to keep their values
PINSEL3 = 0xF0802080;
PCONP |= 1 << 12;
AD0.cr = 0x0020FF01;
adt = Timer;
while (1) {
if (Timer - adt >= 0) {
adt = Timer + 100;
/* Start command for channel 0 */
AD0.cr = 0x0120FF01;
/* This is how I have also tried
AD0.cr &= ~0x000000FF;
AD0.cr |= 1 << 24 | 1;
*/
/* and third variation
AD0.cr = 0x0020FF00 | 1 << adc;
AD0.cr = 0x0120FF00 | 1 << adc;
*/
for (i = 0; i < 16; ++i) add[i] = ((unsigned *)&AD0)[i];
for (i = 0; i < 16; ++i) if (adreg[i] != add[i]) {
adreg[i] = add[i];
printf("AD0[%02i]: %08X\n", i, adreg[i]); }
if (add[1] & 0x80000000) {
/* This was in NXP's example bundle but nothing changed
AD0.cr &= ~0x07000000;
*/
printf("AD0: %03i\n",
(add[1] & 0xFFFF) * 1000 + 0x8000 >> 16); }}}}
--
Timo
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/
> You could post your ADC code, someone will probably see where you are
> going wrong.
Ok, I inline relevant parts here:
#include
#define PINSEL_BASE_ADDR 0xE002C000
#define PINSEL0 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x00))
#define PINSEL1 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x04))
#define PINSEL3 (*(volatile unsigned long *)(PINSEL_BASE_ADDR + 0x0C))
#define SCB_BASE_ADDR 0xE01FC000
#define PCONP (*(volatile unsigned long *)(SCB_BASE_ADDR + 0x0C4))
#define AD0 (*(struct ad *)0xE0034000)
struct ad {
volatile unsigned long
cr, gdr, pad, inten, dr[8], stat; };
volatile int
Timer; // 10ms counter
int
main(void) {
static unsigned adreg[16], add[16];
int adt, i;
PINSEL0 = 0x4F000A54; // I have checked these
PINSEL1 = 0x14155C05; // to keep their values
PINSEL3 = 0xF0802080;
PCONP |= 1 << 12;
AD0.cr = 0x0020FF01;
adt = Timer;
while (1) {
if (Timer - adt >= 0) {
adt = Timer + 100;
/* Start command for channel 0 */
AD0.cr = 0x0120FF01;
/* This is how I have also tried
AD0.cr &= ~0x000000FF;
AD0.cr |= 1 << 24 | 1;
*/
/* and third variation
AD0.cr = 0x0020FF00 | 1 << adc;
AD0.cr = 0x0120FF00 | 1 << adc;
*/
for (i = 0; i < 16; ++i) add[i] = ((unsigned *)&AD0)[i];
for (i = 0; i < 16; ++i) if (adreg[i] != add[i]) {
adreg[i] = add[i];
printf("AD0[%02i]: %08X\n", i, adreg[i]); }
if (add[1] & 0x80000000) {
/* This was in NXP's example bundle but nothing changed
AD0.cr &= ~0x07000000;
*/
printf("AD0: %03i\n",
(add[1] & 0xFFFF) * 1000 + 0x8000 >> 16); }}}}
--
Timo
____________________________________________________________________________________
It's here! Your new message!
Get new email alerts with the free Yahoo! Toolbar.
http://tools.search.yahoo.com/toolbar/features/mail/