LPC mini kit analog comparator howto ?

9 replies [Last post]
gertk
Offline
Joined: 2013-07-14
Posts: 15

I am trying to get the analog comparator to work on the mini kit/demo board but so far it just refuses to react on my analog input signal (I2 pin 5)

The positive input is connected to the ladder, the negative to analog in on pin 5 (which is connected to a potmeter connected between ground and Vdd). I am simply testing the output bit in the control register but it reads always as zero.

0
Your rating: None

Comment viewing options

Select your preferred way to display the comments and click "Save settings" to activate your changes.
Wouter's picture
Wouter
Offline
Joined: 2012-02-01
Posts: 171

Hi Gert,

Our sample code bundle has a comparator example:
http://www.lpcware.com/node/11538/256

You can use this as a reference.

Regards,
Wouter

gertk
Offline
Joined: 2013-07-14
Posts: 15

Still can not get it to work..
Both the LPC_CMP->CTRL and LPC_CMP->LAD register are stuck at zero (even after writing the appropriate bits for selecting the VP and VM inputs. Or are they write only ?

Also I think I found a typo in the manual (both PDF and online):

ACMP_I2 I PIO0_0/ACMP_I2/CLKIN Comparator input 2. Disable the CLKIN function in the PINSASSIGN1BIT0 register. PINENABLE0 SWM PINENABLE0 addressOffset = 0x1C0

Should this not be PIO0_1/ACMP_I2/CLKIN ??

http://docs.lpcware.com/lpc800um/RegisterMaps/acmp/r-Pindescription.html

gertk
Offline
Joined: 2013-07-14
Posts: 15

Seems my analog comparator registers are non existent...

If I check PDRUNCFG it gives me 0x6d70 which should mean the comparator part is powered.

Writing (anything) in the CTRL register and reading it back gives always 0, same for the LAD register, whatever is written. Even set up my own direct pointers to the registers with the same result, always zero.

Is my LPC defective ?

gertk
Offline
Joined: 2013-07-14
Posts: 15

Just heard that the early LPC810 had a fault in the comparator part... I think I have been bitten by that. Sad
Wasted hours..

caohua0902@126.com
Offline
Joined: 2012-12-15
Posts: 9

Hi,Wouter:

I done the same test as Gertk's. The comparator also can't work on my own board whose MCU is LPC810M021.

Then I downloaded the sample code bundle for http://www.lpcware.com/node/11538/256, it worked on LPC812M101FDH20, but didn't on LPC810M021.

I checked the registers on LPC810M021 and LPC812M101 when it's running via Keil MDK. The content in LPC812M101's registers had changed, but that in LPC810M101 hadn't never changed. Reading it back gives always 0 ,just as Gertk's description.

Please checked it ,thanks.

Regards,

Yours, CaoHua.

gertk
Offline
Joined: 2013-07-14
Posts: 15

Thanks for confirming the problem.
Trying to find a replacement LPC810 DIP8 ...

Wouter's picture
Wouter
Offline
Joined: 2012-02-01
Posts: 171

Hi Gert, CaoHua,

Sorry for my late response, this thread somehow had fallen out of my scope...
I did a quick porting of the LPC812 analog comparator example from LPCOpen to the 8-pin LPC810, and indeed experienced problems with the comparator.
I need some more time to look into this, but will get back to you ASAP.

Regards,
Wouter

Wouter's picture
Wouter
Offline
Joined: 2012-02-01
Posts: 171

Update:
DIP 8 devices with rev. 2A are affected by this issue; indeed the analog comparator in not working on these parts.
The next device revision 4C (DIP 8 package) will have a functional comparator.

We are currently working on updating the documentation, an official errata will be published soon.

gertk
Offline
Joined: 2013-07-14
Posts: 15

Nice to see it is officially acknowledged.

So we can expect some correct working samples 'real soon now' ?

feedback