ADC internal 1.1V reference not working

Go To Last Post
6 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi,

on a ATMEGA328p i am trying to set the internal 1.1V reference of the ADC by simply setting the ADMUX: ADMUX = 0xC0;

(Datasheet Table 24-3, internal 1.1V)

With this upper two bits set the internal reference should be set, but i cannot measure any voltage (0.01V) on the AREF pin.

But i should be capable to measure, since following the shematic in the data sheet this voltage is connected to the pin when the bits are set correctly.

Also they talk about to connect a capacitor to this pin for decoupling.

 

When i set the ADMUX register to: ADMUX = 0x40; i can measure almost the input voltage although it is about 0.1V less (AVCC = 3.240, ADMUX = 3.146)

So with the reference set to AVCC it seems to work, why not with the internal?

 

I also tried to enable the ADC by setting PRR |= 0x01; but this does not help. Do i need annother register to set correctly (nothing found)

This topic has a solution.
Last Edited: Tue. Aug 29, 2017 - 07:47 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

http://www.avrfreaks.net/comment...

 

Post a complete test program that demonstrates the symptoms.  Tell AVR model, and clock speed.  Tell language, toolchain, version, and optimization settings.

 

Tell what you expect to happen, and tell what >>is<< happening.

In this case, a schematic and/or wiring diagram in addition to the program.

 

Did you mean voltage on the AREF pin?

 

0.1V drop, with proper cap, seems like a lot -- unless, e.g., you are running continual overspeed conversions with no storage cap.  Thus, the schematic and code query.

 

 

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

This reply has been marked as the solution. 
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I also tried to enable the ADC by setting PRR |= 0x01; but this does not help.

No kidding.  Setting PRADC will >>power-down<< the ADC, not enable it.

 

However, it is not enough to refrain from powering down the ADC.  You must also enable it:

ADCSRA = (1<<ADEN);

Note that, while this will turn on the 1.1V Vbg, it is not enough for actually using the ADC.

 

Also, be aware that the Vbg is a high-impedance voltage source.  You must not place any load on AREF.

 

EDIT: Vbg will also be enabled if BOD is enabled, and when the AC is configured to use Vbg.

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Tue. Aug 29, 2017 - 07:42 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Sorry, of course setting to 0, not to one;

Yes this helps (setting ADEN). Better reading the datasheet would help, it's late! Just though that it would be enabled with just removing the power reduction bit.

Still wondering why it worked with the AVCC settings...

Thank you

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

delphinis wrote:
Still wondering why it worked with the AVCC settings...

Well, according to your measurements it >>kind of<< worked.  What levels are you getting now?  I'd still like to see the code and schematics.  Otherwise it is blind arrow shots.

You can put lipstick on a pig, but it is still a pig.

I've never met a pig I didn't like, as long as you have some salt and pepper.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Still wondering why it worked with the AVCC settings...

It works for AVCC because AVCC is always active.  VBG is only active at certain times:

 

Better reading the datasheet would help

The buck stops there (usually).

 

Note that, with the ADC powered down via PRADC, you lose the ability to manipulate the ADC's configuration registers, including ADUMX and REFS[1:0].

"Experience is what enables you to recognise a mistake the second time you make it."

"Good judgement comes from experience.  Experience comes from bad judgement."

"When you hear hoofbeats, think horses, not unicorns."

"Fast.  Cheap.  Good.  Pick two."

"Read a lot.  Write a lot."

"We see a lot of arses on handlebars around here." - [J Ekdahl]

 

Last Edited: Tue. Aug 29, 2017 - 08:52 PM