ADC measurements in Xmega A series

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

I am a little bit confused reading the datasheet so far for xmega A series devices. It seems you need to place AREF for port A and AREF for port B if you want to utilize both the port pins. On top of that once you use PA0 as AREF you have just lost a pin for measuring an analog input...so now you can only measure 7 inputs instead of 8. Am I correct?

Also how is the differential measurements done? I dont understand. Lets say I have 3 phase (for BLDC motors) I want to measure (differential) between each phase and the motor ground which is not necessarily the power supply ground. Since I will be using a shunt resistor for current measurements.

How could this arrangement work?

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

Just checking but have you already read this:

http://blog.frankvh.com/2010/01/...

and this:

http://blog.frankvh.com/2010/09/...

Not only does it explain the design problems in the ADCs but will give you a general idea of how they are used.

There'll be one of the AVR13nn app notes that covers ADC on Xmega too.

EDIT: it's AVR1300 in fact.

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

Also, *if* I'm recalling correctly, on dual adc chips you only need one port pin for connecting an external ref to *both* adcs. In the setup, each adc can be told to use either pa0 or pb0 as external ref input, so have both use pa0, for example.

Tom Pappano
Tulsa, Oklahoma

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

If I recall, if the XMega you are using has two ADCs, then ADCA must use PortA, and ADCB must use PortB. It is NOT clear whether you can use external AREF on one port for both ADCA and ADCB.

For Differential operation, you can use one pin for your motor ground, and 3 additional pins- one for each of your phases. You have four channels to work with, so you are covered. Each channel can do differential measurements between any two pins. There are some constraints- for differential operation, analog input pins 0-3 are the only pins that can be selected as "negative" input. If using differential input with gain, then analog input pins 4-7 must be used as the "negative" input. No big deal- it's just something that tripped me up at first.

Don't believe all the sour grapes about the XMega ADC- if you use a good external VRef, the XMega A series works great.

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

oh boy all this doesnt sound very hopeful for me :(

thanks clawson for the links.
my situation is a bit complicated...when I designed my bldc controller using the atmega164 previously I actually used the motor +ve (12V then voltage devided using resistors) as the AREF for the ADC....this way to detect zero crossing I just has to find 128 (halfway 256 when measuring in 8 bits) level in the 3 phase BEMF ADC values.

I then used a knows (zener diode) voltage and fed it to another ADC channel in order to be able to convert the ADC raw value scale and use it to calculate the shunt current which was being measured raw on another ADC pin...am I making sense?

So ultimately there are 3 phases, 1 voltage reference measurement, 1 shunt current (voltage level really) measurements to be done....all up 5!

I was hoping to do similar here with xmega as well. This 2.7V ADC measurement margin is soooo bad! Its peanuts.

I plan to connect my motor +ve avain on AREF here. Then I was considering having another 3 ADC pins to 3 phase BEMFs, and another ADC negative pin to go to Motor Ground to give me differential for all the 3 phases. I then wanted to configure 2 other ADC (no need to be differential) pins to measure the actual known voltage and the shunt current.

Please note my AREF if connected to Motor +ve, it is going to have some good noise, but this is not too bad since for the 3 phase BEMF measurements I only just need to know if they are halfway (raw value roughly around 128). The only thing is then that the voltage readings of the zener diode reference will not be absolutely accurate...which isnt that bad since I only use it to calculate the shunt current reading.

Any suggestions?
On a side note...does anyone think I MUST be using differential measurements to get the phase BEMF values? The reason I thought I should is that when the motor takes a lot of current there will be voltage drop across the shunt resistor...hence the motor ground will be ABOVE the actual ground...and the microcontroller ground is the actual ground...so I thought the ADC measurements will be offset and no good.

Last Edited: Thu. Sep 15, 2011 - 08:57 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Quote:
It is NOT clear whether you can use external AREF on one port for both ADCA and ADCB.

See the REFCTRL register description in the "Xmega A" manual

Tom Pappano
Tulsa, Oklahoma

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

no one comment on my above post?

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

anyone can suggest a nice n simple way to translate a 2.5->5.0VDC to 0->2.7VDC range so that xmega ADC can measure it?

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

luvocean1 wrote:
anyone can suggest a nice n simple way to translate a 2.5->5.0VDC to 0->2.7VDC range so that xmega ADC can measure it?

I thought we had this discussion just recently, but a quick look didn't pop up the thread. Short answer: use an op-amp.

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

uum... i dont recall havint this discussion...but I have read a few things in the datasheet for ACS756. I have posted here https://www.avrfreaks.net/index.p...

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

frankvh wrote:
I thought we had this discussion just recently, but a quick look didn't pop up the thread. Short answer: use an op-amp.

Ah, here we go. Essentially the same question came up here (need to scroll down a bit):
https://www.avrfreaks.net/index.php?name=PNphpBB2&file=viewtopic&t=111394&highlight=