| Author |
Message |
|
|
Posted: Aug 23, 2011 - 08:10 AM |
|


Joined: Mar 27, 2006
Posts: 244
Location: Vancouver, BC
|
|
I'm working on a project involving temperature measuring which needs some degree of precision. As a result, the 10-bit ADC on the atmega's aren't enough, so I have decided to try an XMEGA since they are 12 bits. I have 10 temperature sensors, so the large amount of on-chip ADC inputs lends itself well to the application. I also want to have an 16x2 line LCD interfaced to this project. My question is, what "special" things should I know before I go and design my xmega circuit? What are the main differences? I think I am going to go with the ATXMEGA128 for my first trial as it seems to have more than enough features for me. I have heard there are a couple buggy peripherals on the xmega chips, but not sure if this is still true.
Christan |
_________________ -Christan
Summer Student, Chief Tinkerer
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 11:02 AM |
|


Joined: Mar 28, 2001
Posts: 20374
Location: Sydney, Australia (Gum trees, Koalas and Kangaroos, No Edelweiss)
|
|
| Just remember that's only 3.3V operation. |
_________________ John Samperi
Ampertronics Pty. Ltd.
www.ampertronics.com.au
* Electronic Design * Custom Products * Contract Assembly
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 05:44 PM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
The adcs do have issues, but they can be worked around by using an external voltage reference. I do like the multiple peripheral modules, and their uniformity. I'm in pre-production testing of an industrial controller and everything seems fine. I did burn up a day trying to get the adc to start- there apparently is an error in a gcc include file somewhere that likely mistranslates a register address. Changing from "blah.blah.blah" to "blah_blah_blah" style fixed it. FWIW, this was for the 192D3 part. If something straightforward isn't working that should be, keep this in mind  |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 06:55 PM |
|


Joined: Dec 11, 2007
Posts: 6849
Location: Cleveland, OH
|
|
In addition to the above,
Take a look at the ADC's available. The "A1" series has 2 ADCs, each with 8, single ended inputs.
The "D4" series has one ADC, with 12 single ended inputs.
Point being, look at the specific manual for the chip you intend to use.
If you like to bread board your circuits then note that the Xmegas are SMD only, so bread boarding isn't a very good option.
For initial development on an Xmega you may want to consider getting an Atmel Xplain Xmega board, or one of Gabotronic's Xmega modules. Several Freaks have his Xprotolab , me included.
Neither of these will bring out just what you need pin wise, but either will let you get started as you further define the needs of your system.
If you go with the Atmel Xplain, note that it originally referred to the Xmega demo board. There are now several versions of it, and also the Xplained board, which has an ATmega1284P, not an Xmega. Look carefully at what you are ordering.
When you develop your own board, as JS stated they are 3 V devices. (Hence order some 3 V LCDs, etc.)
More important, however, if you use a linear regulator, note that 3 V linear regulators are NOT like 5 V linear regulators. 7805's are about indestructable. The 3 V linear regulators require more care in their design.
The pin outs can be different, (Argh...), and they can be VERY PARTICULAR when it comes to the Cout range and Cout's ESR.
None of this is difficult, it just requires close attention to detail. You can't pull a generic cap out of your supply and use if for Cout.
Lastly, personally, I found hand soldering the Xmega to be a challenge. It was the first time in ~ 30 years I ever needed liquid flux. I'm sure I can get better at soldering the Xmega with its 0.5 mm lead pitch (?? I don't recall what it was for sure), with practice, but soldering it proved to be an unexpected learning curve.
Good luck with your project.
JC
Oh man, house just shook! Think we just had an earthhquake. |
|
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 07:08 PM |
|


Joined: Dec 11, 2007
Posts: 6849
Location: Cleveland, OH
|
|
Sorry Christan, I don't mean to derail your thread.
Just had an Earthquake centered in Virginia, and I felt the house shake here in Cleveland.
People are evacuating highrise buildings downtown.
I felt a small aftershock a minute or two later, but it is over.
[/derail]
JC |
|
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 07:58 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
Even if you use the external reference the A/D on the xmega has some issues. You have to measure the ground reference and subtract this from your readings if you are using single ended mode (otherwise you end up with about 6 bits worth of 'noise' in your result!). You can avoid this by using differential mode, but this also requires using the SIGNED mode which reduces you to 11 bits of precision.
PS I've managed to solder .5mm parts by hand. Carefully align the part with all the pads and solder one pin. Recheck alignment and solder another pin on the far side of the chip from the first. Repeat for the last two sides. Then carefully solder the rest of the pins. Don't worry too much about solder bridges (they WILL happen). Remove excess solder (bridges) between pins using solder wick (coat wick with flux first). Don't drag the wick across the pins when removing it, pull it away from ALL the pins at the same time while still HOT! |
|
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 09:23 PM |
|


Joined: Mar 27, 2006
Posts: 244
Location: Vancouver, BC
|
|
Hey guys thanks for the good insight. I'll have no problem soldering it as I do small stuff like this pretty often. I just use paste and heat gun and remove any bridges with wick (like kscharf mentioned). JC - glad the earthquake wasn't worse than it ended up being. The world has had some bad luck with those lately!
I am a little concerned with the ADC issues as I would really like 12-bits of data without sacrificing bits for noise or signed bits. If i can use all 12-bits I can get down to 0.1 degree resolution which would be idea (or 0.5 degrees with 11-bits). Using differential mode would mean that I would need 20 inputs for 10 sensors - not very doable.
I good idea would be to get an xplained before I design this to get a feel for the xmega like JC mentioned. hmmm |
_________________ -Christan
Summer Student, Chief Tinkerer
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 10:17 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
|
triden wrote:
Using differential mode would mean that I would need 20 inputs for 10 sensors - not very doable.
hmmm
Actually you can have several differential inputs share a common negative input (ground) and have separate positive inputs. Read the documentation on the ADC carefully. You do lose one input for the reference pin though. |
|
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 10:42 PM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
| You *do* get the use of all 12 bits using signed differential with an external reference. |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 10:53 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
|
tpappano wrote:
You *do* get the use of all 12 bits using signed differential with an external reference.
Read the ADC documentation carefully. The ADC does NOT actually measure negative voltages. The reference is against ground. The differential measurement allows you to measure against two voltages that are each above ground, and you take the difference, which could be negative. However, if you ground one of the two inputs you will ONLY SEE a positive result, or 11 bits worth of data. If you are measuring a voltage with respect to ground (single signal) you ONLY get 11 bits worth of data in the differential configuration. |
|
|
| |
|
|
|
|
|
Posted: Aug 23, 2011 - 11:25 PM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
Tie your external reference to PA0 (for example) use the mux setup options to tie the "-" differential input also to PA0 (Vref). Using differential signed mode, the adc now reads -2048 thru 2047 for signal inputs of 0 to 2*Vref. I'll leave it for the students to convert -2048 thru 2047 to 0 thru 4095 Because the xmega adc still is what it is, you must of course employ gain and offset correction, but this will give stable and linear results. |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 02:27 AM |
|

Joined: Mar 30, 2008
Posts: 51
Location: Perth, WA, Australia
|
|
Some people have recommendedvarious boards to get, I'd personally recommend a TQFP to DIP adapter from http://www.proto-advantage.com.
They will let you select the XMega IC you want as a digikey part number and they will order it and assemble it for you. This gives you a breadboard ready MCU unit without any of the limitations on which pins are available on the prototype boards so you can develop and test across the whole MCU device. You also get to test all your power interface before committing to your design.
I got myself up and running MUCH faster this way than messing about with my Atmel XPlained board, and it's (undocumented) lack of PDI support out the box, and it's cumbersome DFU/FLIP utilities and poor USART implementation (still unsolved under Linux).
With a naked MCU IC you have at least eliminated a huge chunk of unknowns when it comes to debugging.
As for the ADC, 12 Bits accuracy is virtually impossible on the current devices, even with robust external reference voltages - 10 bits is even pushing it. You also sacrifice some inputs for the ARef. (2 out of 16 on the A128) |
|
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 02:38 AM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
|
Quote:
As for the ADC, 12 Bits accuracy is virtually impossible on the current devices, even with robust external reference voltages
Can you elaborate? My experience is that using the method I describe, performance becomes what one would expect from the typical 12 bit converter. |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 02:56 AM |
|

Joined: Mar 30, 2008
Posts: 51
Location: Perth, WA, Australia
|
|
I'll point you to this blog...
http://blog.frankvh.com/2010/01/03/atme ... solutions/
In my experience, using just a passive potentiometer, I still cannot reliably get a stable 10 bit reading consistently. The same device and circuit on an ATMega168 is much more reliable and stable. This is even with a 2.048V reference voltage feeding both the ARef and the Pot circuit. |
|
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 03:47 AM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
| Everything Frank says is right on target. Do what I describe above and you should get nice stable and linear 12 bit readings. Note that all I'm adding to what Frank suggests is to definitely use an external reference and tie -diff input to Vref in order to gain full 12 bit operation. Try this and let us know what you find. |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 05:02 AM |
|

Joined: Mar 30, 2008
Posts: 51
Location: Perth, WA, Australia
|
|
@tpappano - Tom,
I've just read your comments on Franks site. Can you confirm that you actually used a VREF and -diff voltage of 1.25V (Both sourced on PIN0) and you were measuring +diff values of between 0 and 2.5V ?
This sounds intriguing, I'll have to try this. What is your 1.25V reference derived from ?
Euan. |
|
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 05:12 AM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
| I actually use a 1.225v reference in a SOT23 package by Zetex. This gives a 2.45v full scale range for the adc. |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 04:24 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
|
tpappano wrote:
Tie your external reference to PA0 (for example) use the mux setup options to tie the "-" differential input also to PA0 (Vref). Using differential signed mode, the adc now reads -2048 thru 2047 for signal inputs of 0 to 2*Vref. I'll leave it for the students to convert -2048 thru 2047 to 0 thru 4095  Because the xmega adc still is what it is, you must of course employ gain and offset correction, but this will give stable and linear results.
With the ADC reference on PA0 and the negative diff input also on PA0 a zero voltage on the positive diff input will result in a reading corresponding full negative or 800H (-2048). If the positive input is set to the reference voltage (max positive input allowed) then the differential sum would be zero. Still only an 11 bit range, all you did was force the output to be in twos complement form.
My reading of the ADC operation leads me to understand that the input voltage on either the positive or negative inputs can NOT exceed the reference voltage. It would be very interesting if your connection actually allows the positive input in differential mode to accept 2X the reference voltage. NOTE: The max allowed reference voltage is VCC-0.06, and the same should apply to the positive or negative differential inputs (which means your reference has to be less than (VCC-0.06)/2. |
|
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 05:09 PM |
|

Joined: Dec 01, 2003
Posts: 2502
|
|
|
Quote:
Read the documentation on the ADC carefully. You do lose one input for the...
Quote:
Read the ADC documentation carefully. The ADC does NOT actually...
Quote:
My reading of the ADC operation leads me to understand that the input voltage on either the positive...
I see that you have *read* about the adc, have you actually tried *using* it?  |
_________________ Tom Pappano
Tulsa, Oklahoma
|
| |
|
|
|
|
|
Posted: Aug 24, 2011 - 08:59 PM |
|


Joined: Aug 04, 2004
Posts: 1822
Location: Davie, FL
|
|
| Actually we have used it in a simple application to read the battery voltage on a unit (tested on the xplain). The application followed the atmel notes. We used the internal reference and tried both the single ended and differential modes. After I did the preliminary research and coding another engineer tested the code and was able to get useful readings. I did not try the idea of using the differential mode with an external reference on the negative input pin. Atmel's documentation would seem to not support this ... then again their documentation is sometimes as buggy as their silicon. What gave you the idea to try that? |
|
|
| |
|
|
|
|
|