Wrong ADC results

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

Hello,

I'm puzzling over a simple problem. I'm sure I miss something. I have a ATXmega32A4 running the internal oscillator @ 32 MHz. On AREF/PA0 there is a voltage reference of 2,048 mV and there are 3 voltages on ADC1..3.

The values read are not consistent with the measured voltages.

I'm using a debugger so I will report the *actual* registers content:

PORTA.DIR = 0x00; all inputs
PORTA.PINxCTRL = 0x00; totem pole (voltages outs from o.a.)
CTRLA = 0x01; ADC enable
CTRLB = 0x00; 12-bit, right adj
REFCTRL = 0x20; vref on port A
EVCTRL = 0xC6;  sweep ch 0,1,2,3 syncsweep
PRESCALER = 0x04; /64, I tried other values
EVSYS.CH0MUX = 0xC0; timer0 ovf (fires @ 100 Hz)

Now the values read:

ADC0 2,048 mV (vref) read: 176
ADC1 6.4 mV read: 1275
ADC2 555.8 mV read: 364
ADC3 98.5 mV read: 882

That doesn't make sense to me.
What should I double check?

Thanks
Marco

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

The Xmega ADC has some major issues.

More details here:
http://www.xbitinc.com/knowledgebase/questions.php?questionid=3

It is good you already have an external vref. But you should also read the results in signed differential mode.

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

Oh no.
Are we saying these MCUs *don't* work?

So I need to change my hardware, make a new PCB, lose the 12-bit resolution just beacuse Atmel sells broken chips?

I migrated from Microchip to Atmel. But if this is the gain I will use another brand.

Sorry for my thoughts and thanks for the link.
My customer won't be happy to know that.

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

Furthermore I can't use ADC4..7 as negative input in differential input w/o gain. So I must use differential input w/ gain. If I set up the gain = 1 it will still affects the reads? According to:

Quote:

Using gain here will also cause some error so do not use any gain at this point.

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

More info here:

http://blog.frankvh.com/category...

(two articles about Xmega ADC).

Quote:

Are we saying these MCUs *don't* work?

They "work" as documented in the errata - depends whether you consider the limitations imposed there "work"ing or not.

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

Thank you very much for the URL. I'm reading the articles.

Ok, but they actually sells something that doesn't work as expected.

Instead of hide the bugs in the errata, should be better to CHANGE the specification in the main datasheet as well as in brochures, presentation pages and so on.

What do you think if you buy a car and then you discover that has only 4 gears, lights works only one at time, etc... Of course, in the "errata" is written but when you bought the description was different...

IMO of course :)

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

Quote:

Ok, but they actually sells something that doesn't work as expected.

Yes they do - they work as (now) documented. When using any compex silicon whether it be AVR, ARM, MIPS or whatever you should always read the errata alongside the datasheet before making the choice to use the device.
Quote:

What do you think if you buy a car and then you discover that has only 4 gears, lights works only one at time, etc...

As long as they'd stuck a note on the windscreen saying "note: only four of the five gears in this car can be used" then I don't think you can have reason to complain. If you didn't read the sticker on the windscreen and bought it anyway then it's surely caveat emptor?

At least mext time you buy silicon you will think on to read any available errata (BTW not all manufacturers are good enough to collate it into the datasheet and often it's a separate, easily over-looked PDF!)

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

Ok, I got the point.

Anyway, if you're happy with this no problem :)
But for me it's not what I'd expect from Atmel!

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

Quote:

But for me it's not what I'd expect from Atmel!

As I say this is not specific to Atmel. What's more the more complex the silicon the higher the likelihood of faults in the design (I'm sure someone's probably got a "law" for that!). If you look at ARM9 or ARM11 based System-on-Chip (SoC) devices there can be 100's of faults where it does not operate according to the original spec.

Remember there's no more magic to silicon designers than to us programmers using their devices - we all make mistakes and there are bugs. Sure silicon is often subject to far more rigorous pre-manufacture testing simply because iof the investments involved but in a complex system there will be faults (I'm sure there's probably another "law" states that unequivocally)

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

Ok, thank you for taking the time to answer me!

EDIT: just to tell you after some changes to both hw and fw now I can read something useful from ADC (11-bit though)