EmbeddedRelated.com
Forums

LPC1768 ADC read issues

Started by joryn81 September 25, 2009
Hi All,

I've tried posting this in the lpc1000 group but I don't think enough people take a look over there. Hopefully someone on this group has taken a look at the LPC17XX micros.

I've recently gotten a project compiled and running on the LPC1768 (ported from a 2368 project) and everything seems to be running really well except for the ADC.

Specifically the ADC module doesn't appear to be working at all for me right now. I've tried running the demo code that NXP has on its website for the LPC1768 and all I can get out of the unit are fullscale values and minscale values (i.e., 0xFFF and 0x000) consistently on certain channels, i.e, ADDR0 and ADDR5 always contain 0xFFF and the others always contain 0. I have tried both interrupt(burst) mode and individual channel conversions with same results on both. I've also tried 2 different types of boards to verify that the hardware isn't the problem.

Also the Overrun bits seem to be getting set an awful lot and I'm not entirely sure as to the cause of that either. I'm using Rowley Crossworks for debugging/compiling and setting a breakpoint in
the ADC IRQ shows that the reads of the ADDRx registers doesn't appear to clear the overrun or Done bits. I'm looking for any insight that could help me get this analog module working as well as it did for my 2368 project.

I'm sure I left out details so if you need to know anything more just ask.

Thanks for the input.

Regards,
Joe M

An Engineer's Guide to the LPC2100 Series

joryn81 wrote:
> Hi All,
>
> I've tried posting this in the lpc1000 group but I don't think enough people take a look over there. Hopefully someone on this group has taken a look at the LPC17XX micros.
>
> I've recently gotten a project compiled and running on the LPC1768 (ported from a 2368 project) and everything seems to be running really well except for the ADC.
>
> Specifically the ADC module doesn't appear to be working at all for me right now. I've tried running the demo code that NXP has on its website for the LPC1768 and all I can get out of the unit are fullscale values and minscale values (i.e., 0xFFF and 0x000) consistently on certain channels, i.e, ADDR0 and ADDR5 always contain 0xFFF and the others always contain 0. I have tried both interrupt(burst) mode and individual channel conversions with same results on both. I've also tried 2 different types of boards to verify that the hardware isn't the problem.
>
> Also the Overrun bits seem to be getting set an awful lot and I'm not entirely sure as to the cause of that either. I'm using Rowley Crossworks for debugging/compiling and setting a breakpoint in
> the ADC IRQ shows that the reads of the ADDRx registers doesn't appear to clear the overrun or Done bits. I'm looking for any insight that could help me get this analog module working as well as it did for my 2368 project.
>
> I'm sure I left out details so if you need to know anything more just ask.
>
> Thanks for the input.
>
> Regards,
> Joe M
>

Hi Joe,

I'm do not have any experience with the LPC17xx series but it sounds
like the configuration control for the ADC channel is still set for
I/O. Check your configuration.

regards,
Charles
Hi Charles,

Thanks for the response. Again I should mention that I'm using the NXP
sample code, as well as some 2368 code of my own that has been ported to
work with the 1768. The PINSEL registers have all been set and verified
with the debugger as having been set for the required ADC channels.

One thing that I've noticed is that the ADC module appears to be
different than the core that was used in the LPC2xxx parts. Since I
can't seem to find any reference to someone using the ADC properly on
these parts I'm wondering if there's some undocumented errata with these
micros.

Keep the feedback coming, anything that comes to mind to try out I'd be
willing to give a shot. I've pretty much exhausted all my own debugging
attempts.

Thanks and regards,
Joe M
--- In l..., "Charles R. Grenz"
wrote:
> Hi Joe,
>
> I'm do not have any experience with the LPC17xx series but it sounds
> like the configuration control for the ADC channel is still set for
> I/O. Check your configuration.
>
> regards,
> Charles
>

I've only seen this behaviour (in other parts) when not connecting VREF to a
correct reference voltage.

Check VREF pins voltage.

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 91 120 1798
+34 636 52 25 69
skype: ajoajoajo
2009/9/27 joryn81

> Hi Charles,
>
> Thanks for the response. Again I should mention that I'm using the NXP
> sample code, as well as some 2368 code of my own that has been ported to
> work with the 1768. The PINSEL registers have all been set and verified
> with the debugger as having been set for the required ADC channels.
>
> One thing that I've noticed is that the ADC module appears to be
> different than the core that was used in the LPC2xxx parts. Since I
> can't seem to find any reference to someone using the ADC properly on
> these parts I'm wondering if there's some undocumented errata with these
> micros.
>
> Keep the feedback coming, anything that comes to mind to try out I'd be
> willing to give a shot. I've pretty much exhausted all my own debugging
> attempts.
>
> Thanks and regards,
> Joe M
>
> --- In l... , "Charles R.
> Grenz"
> wrote:
>
> > Hi Joe,
> >
> > I'm do not have any experience with the LPC17xx series but it sounds
> > like the configuration control for the ADC channel is still set for
> > I/O. Check your configuration.
> >
> > regards,
> > Charles
> >
>


Hello Joe,

> One thing that I've noticed is that the ADC module appears to be
> different than the core that was used in the LPC2xxx parts. Since I
> can't seem to find any reference to someone using the ADC properly
> on these parts I'm wondering if there's some undocumented errata
> with these micros.

Perhaps you see something in looking into keil ADC code for LPC17xx:

http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc17xx.keil.zip

Regards,

Martin

hi
can you please send me the sample codes , because i am the beginner to lpc2136, i need beginner level codes , like to get input from a pin , to read adc
________________________________
From: joryn81
To: l...
Sent: Sunday, September 27, 2009 11:47:50 PM
Subject: [lpc2000] Re: LPC1768 ADC read issues


Hi Charles,

Thanks for the response. Again I should mention that I'm using the NXP
sample code, as well as some 2368 code of my own that has been ported to
work with the 1768. The PINSEL registers have all been set and verified
with the debugger as having been set for the required ADC channels.

One thing that I've noticed is that the ADC module appears to be
different than the core that was used in the LPC2xxx parts. Since I
can't seem to find any reference to someone using the ADC properly on
these parts I'm wondering if there's some undocumented errata with these
micros.

Keep the feedback coming, anything that comes to mind to try out I'd be
willing to give a shot. I've pretty much exhausted all my own debugging
attempts.

Thanks and regards,
Joe M

--- In lpc2000@yahoogroups .com, "Charles R. Grenz"
wrote:
> Hi Joe,
>
> I'm do not have any experience with the LPC17xx series but it sounds
> like the configuration control for the ADC channel is still set for
> I/O. Check your configuration.
>
> regards,
> Charles
>





--- In l..., "joryn81" wrote:
>
> Hi All,
>
> I've tried posting this in the lpc1000 group but I don't think enough people take a look over there. Hopefully someone on this group has taken a look at the LPC17XX micros.
>
> I've recently gotten a project compiled and running on the LPC1768 (ported from a 2368 project) and everything seems to be running really well except for the ADC.
>
> Specifically the ADC module doesn't appear to be working at all for me right now. I've tried running the demo code that NXP has on its website for the LPC1768 and all I can get out of the unit are fullscale values and minscale values (i.e., 0xFFF and 0x000) consistently on certain channels, i.e, ADDR0 and ADDR5 always contain 0xFFF and the others always contain 0. I have tried both interrupt(burst) mode and individual channel conversions with same results on both. I've also tried 2 different types of boards to verify that the hardware isn't the problem.
>
> Also the Overrun bits seem to be getting set an awful lot and I'm not entirely sure as to the cause of that either. I'm using Rowley Crossworks for debugging/compiling and setting a breakpoint in
> the ADC IRQ shows that the reads of the ADDRx registers doesn't appear to clear the overrun or Done bits. I'm looking for any insight that could help me get this analog module working as well as it did for my 2368 project.
>
> I'm sure I left out details so if you need to know anything more just ask.
>
> Thanks for the input.
>
> Regards,
> Joe M
>

Hi Joe,

Check all the JTAG pins.
At least in the LPC2468, DBGEN = 0 puts the processor in Boundary Scan Mode, which forces the DAC and ADC modules to the OFF state.
Perhaps, you only need to move a jumper...

Best Regards,
Gabriel.

Hi Martin,

This is actually the demo code from NXP that I was referring to in my original post. Using this code gives me the same results as my own, so either both are broken or neither are :) There doesn't appear to be anything special in the ADC driver for the Keil board so I'm wondering if it was even modified for use on that 1768 (as opposed to just a port of the lpc2000 series code).

Thanks,
Joe

--- In l..., "capiman26061973" wrote:
>
> Hello Joe,
>
> > One thing that I've noticed is that the ADC module appears to be
> > different than the core that was used in the LPC2xxx parts. Since I
> > can't seem to find any reference to someone using the ADC properly
> > on these parts I'm wondering if there's some undocumented errata
> > with these micros.
>
> Perhaps you see something in looking into keil ADC code for LPC17xx:
>
> http://www.standardics.nxp.com/support/documents/microcontrollers/zip/code.bundle.lpc17xx.keil.zip
>
> Regards,
>
> Martin
>

Hi Miguel,

I've verified that the VRef pin is connected to 3.3V, only consideration might be that the VRef is not filtered or isolated from the VCC 3.3V. I don't think this would cause problems, but thought it best to mention it.

Thanks,
Joe

--- In l..., Miguel Angel wrote:
>
> I've only seen this behaviour (in other parts) when not connecting VREF to a
> correct reference voltage.
>
> Check VREF pins voltage.
>
> Miguel Angel Ajo Pelayo
> http://www.nbee.es
> +34 91 120 1798
> +34 636 52 25 69
> skype: ajoajoajo
> 2009/9/27 joryn81 >
> >
> > Hi Charles,
> >
> > Thanks for the response. Again I should mention that I'm using the NXP
> > sample code, as well as some 2368 code of my own that has been ported to
> > work with the 1768. The PINSEL registers have all been set and verified
> > with the debugger as having been set for the required ADC channels.
> >
> > One thing that I've noticed is that the ADC module appears to be
> > different than the core that was used in the LPC2xxx parts. Since I
> > can't seem to find any reference to someone using the ADC properly on
> > these parts I'm wondering if there's some undocumented errata with these
> > micros.
> >
> > Keep the feedback coming, anything that comes to mind to try out I'd be
> > willing to give a shot. I've pretty much exhausted all my own debugging
> > attempts.
> >
> > Thanks and regards,
> > Joe M
> >
> > --- In l... , "Charles R.
> > Grenz"
> > wrote:
> >
> > > Hi Joe,
> > >
> > > I'm do not have any experience with the LPC17xx series but it sounds
> > > like the configuration control for the ADC channel is still set for
> > > I/O. Check your configuration.
> > >
> > > regards,
> > > Charles
> > >
> >
> >
> >
>
>

Check Gabriel's suggestion about DBGEN pin, may be that's the problem(boundary
scan enabled).

Gabriel.. so.. if you enable debug, you couldn't use ADC? There is no way to
fix that?

Miguel Angel Ajo Pelayo
http://www.nbee.es
+34 91 120 1798
+34 636 52 25 69
skype: ajoajoajo
2009/9/28 joryn81

> Hi Miguel,
>
> I've verified that the VRef pin is connected to 3.3V, only consideration
> might be that the VRef is not filtered or isolated from the VCC 3.3V. I
> don't think this would cause problems, but thought it best to mention it.
>
> Thanks,
> Joe
> --- In l... , Miguel Angel
> wrote:
> >
> > I've only seen this behaviour (in other parts) when not connecting VREF
> to a
> > correct reference voltage.
> >
> > Check VREF pins voltage.
> >
> > Miguel Angel Ajo Pelayo
> > http://www.nbee.es
> > +34 91 120 1798
> > +34 636 52 25 69
> > skype: ajoajoajo
> >
> >
> > 2009/9/27 joryn81
> >
> > >
> > >
> > > Hi Charles,
> > >
> > > Thanks for the response. Again I should mention that I'm using the NXP
> > > sample code, as well as some 2368 code of my own that has been ported
> to
> > > work with the 1768. The PINSEL registers have all been set and verified
> > > with the debugger as having been set for the required ADC channels.
> > >
> > > One thing that I've noticed is that the ADC module appears to be
> > > different than the core that was used in the LPC2xxx parts. Since I
> > > can't seem to find any reference to someone using the ADC properly on
> > > these parts I'm wondering if there's some undocumented errata with
> these
> > > micros.
> > >
> > > Keep the feedback coming, anything that comes to mind to try out I'd be
> > > willing to give a shot. I've pretty much exhausted all my own debugging
> > > attempts.
> > >
> > > Thanks and regards,
> > > Joe M
> > >
> > > --- In l... > 40yahoogroups.com>, "Charles R.
> > > Grenz"
> > > wrote:
> > >
> > > > Hi Joe,
> > > >
> > > > I'm do not have any experience with the LPC17xx series but it sounds
> > > > like the configuration control for the ADC channel is still set for
> > > > I/O. Check your configuration.
> > > >
> > > > regards,
> > > > Charles
> > > >
> > >
> > >
> > >
> >
> >
> >
> >
>