- Direct Memory Access (DMA) controller capable of transferring data between memories and peripherals (ie between the USB and USART) with minimal MCU intervention
- An Event System allows peripherals to trigger actions in other peripherals (think interrupts) without the need for the MCU to get involved directly. Peripherals supported include ADC, DAC, DMA, and all the ports.
- AWex - Advanced Waveform Extension for extremely precise waveform generation
- Hi-Res - High Resolution Extension for AWeX and timers.
- IR Communications module
- AES and DES crypto engines
- External Bus Interface to fast-track external memory
- An Analog-to-Digital converter and Digital-to-analog converters
Not having a PDIP version makes it more difficult to get into the Xmega line because to prototype and program your Xmega you will need specific hardware that interfaces to the SMD (surface mount) chips. But if you don't get into the Xmega line you are missing out on such good peripherals and coding fun, so what's a guy to do?
This instructable will walk you through making a complete, working AVR Xmega programming and development board. This board will allow you to connect Xmega chips, program them, then put them in your device in the field (or in your house!).
Teachers! Did you use this instructable in your classroom?
Add a Teacher Note to share how you incorporated it into your lesson.
Step 1: Requirements
The Xmega programming and development board requires a few pieces of hardware to complete the build that you may or may not have lying about your place. First, the design was etched onto 1oz double-sided copper clad and a silk screen layer was then layered over the top. This entails having a 3.25" x 3.75" double-sided copper clad board (a 1/2oz board works well, too), your favourite etchant, soldering equipment, etc.
The second part includes the chip carrier, which can be purchased from futurelec.com. You may need the TQFP44 carrier for ATXmega32A4 and other TQFP44 chips, while the TQFP64 carrier can be used for the ATXmega64/128/256A3's. From the website I mentioned in this paragraph, the cost is $1.20 and $1.30, respectively. That's very economical for an adapter board.
Finally, you'll need the electronic components that I use in this design. The components range from double-row female sockets to 10uF tantalum capacitors to 3mm LED's. To avoid listing every part in my design here, I've attached a BOM at the bottom of the page.
I've skipped mentioning anything about software as that's dependent on your style and flow. I prefer using NetBeans IDE with custom-compiled AVR GCC toolchain on a Solaris UNIX system, although AVR Studio, NetBeans, and Visual Studio are options on Windows. This is all ancillary to our hardware build that we'll get into when you turn the page!
Step 2: ATXmega Programming Board Design
The DesignMy primary design for the board came from suggestions in Atmel's AVR042: Hardware Considerations guide as well as eyeballing different reference designs. The board accepts DC power and has an on-board regulator for clean 3.3V power. I decided to use the internal 32MHz oscillator and only include a 32kHz watch crystal for real time clock management. It also has support for USART-to-USB via an FTDI chip on a USB BUB from Moderndevice.com for $14, so pin headers are on the board for that. I'm a big fan of visual indication of action, so I've included a green 3mm LED to indicate power and a red 3mm LED connected to the reset switch to verify a hard reset of the chip.
My primary goal, though, was to produce a board that allowed access to most all pins without having to setup the many decoupling capacitors needed for each new chip to be programmed. As mentioned, the programming interface is PDI because it doesn't support SPI and I don't have a JTAG debugger/programmer (it's on my wishlist) so there's no JTAG support on the board.
Included below are pictures of the latest design along with Eagle CAD schematic and board files. I've also created a panel of bottom, mirrored top, and silkscreen layers at 300dpi (consider printing at 1200dpi) in PDF format. This is what I use to print out on transparency or toner transfer paper, so I've included it as a convenience. Take a minute to look at the layout of the board.
Idioms of Hardware DesignIf you've taken a minute to look at the board you've probably noticed that it can be broken into little pieces that I like to call Hardware Design Idioms (or Patterns). These are little circuits that you make over and over again for each (or many) designs. I've partitioned the whole design into the following idioms:
PowerThe power subsystem is the component I make the most on my boards because I've found pulling too many mA from USB can cause serious problems (I burned a USB hub once). Plus having its own power subsystem allows you to just hook it up to a DC wall wart from 5V to ~20V and run it stand-alone while you program. An external source of power is necessary if you're using the AVRISP mkII as it doesn't supply the board with power like some of the other programmers out there.
The basic design of the power component is simple and straight-forward. A DC jack accepts a plug that delivers power with a rather large polarized capacitor across the positive and negative rails. Run (+) into an LDO regulator of fixed 3.3V followed by two more filtering capacitors at 1uF and 0.1uF. They do not need to be polarized as the schematic suggests.
The final (+) rail out of the last capacitor is a very stable, regulated 3.3V. You may choose to use through-hole components over the SMD components I've used and that's totally up to you. I use what I have on hand for the most part. I've also used a 27uH inductor on the AVCC port to make the analog power a little cleaner.
I've also included two other power constituents: a two-pronged header for exporting power, and a 3-pin jumper used to indicate whether the power is coming from the DC jack or from the USB. It's your option. Picture below.
ResetI almost always include a reset circuit in my designs. It's handy. This hardware pattern consists of the following:
- Pull up !RESET to Vcc
- Connect one side of tactile switch to the !RESET with the other side connected to a resistor/LED pair going to ground.
- Strap a 0.1uF capacitor between both sides of the switch (ie both pins you used).
Push the reset button, the red LED comes on, and release. The ATXmega chip is hardware reset and reboots. See the picture below.
DecouplingIn analog designs, decoupling (or bypass here) is used to shunt high-frequency signals on the power line to ground. This is found at the analog Vcc input. In digital designs, the purpose is different. The amperage draw from the MCU and onboard devices is an average and when many pins are in use and operation, the current draw can be hundreds of mA or more. The capacitors placed across the Vcc and ground act as mini reservoirs of charge that can supply a port the current it needs when the power supply is a distance away. It's optimal to place these capacitors as insanely close to the port they are servicing as possible.
In my design, you'll find the decoupling capacitors under the carrier chip (that is, between the dual-row sockets This inclusion is important at the ATXmega, AVR32, and ARM levels because many of these chips have many Vcc and AVcc connections that must all be decoupled. It's a pain to do it manually....just don't do it. Do it on the programming board and be done with it.
USBI often like to have an outlet for debug output. An LCD can be too restricting for getting lots of debug data from your firmware. Therefore, I often include a 6-pin right-angle pin header that interfaces to the Modern Devices' USB BUB module. It allows you to simply write to your RS232 USART and is passed over USB via an FTDI chip. On the PC, I then use AVR Terminal to visualize my debug data. This is invaluable (for me, at least).
You may choose to remove this if you don't have the USB capabilities, although for $14 the USB BUB is a great buy. Picture below.
CrystalContrary to the hardware design found in many AVR designs, a 16MHz or 20MHz external crystal isn't really used for the system clock on Xmegas. I use the internal 32MHz oscillator and only include a 32kHz watch crystal for use in real time clock timekeeping. It's not necessary to use, but it's on board if you need timekeeping functionality. Again, it's parallel capacitive and uses two small (usually 18pF to 22pF) capacitors to GND.
As an added benefit, the PLL can use the external 32kHz crystal for runtime compensation of temperature and drift, thereby further enhancing the accuracy of the 32MHz oscillator.
ProgrammingNow, what would a programming board be without a programming interface? Here we use a simple 2x3 male pin header; the same as used for SPI programming. Check below for the pinout of the PDI interface. I simply provide power and make the two appropriate PDI connections and call it a day. PDI eliminates the need for SPI isolation resistors.
SocketsSo, for the ATXmega programming/devel board, you'll find it bristling with socket headers. There are four (2 in parallel) dual-row 2 x 8 female headers to accept the 2x8 male headers from the Xmega carrier board. I've also tried to bring out as many MCU pins to headers for access in development and these can be found in the single row female headers around the outside edges. These are marked with a silk screen layer indicating what pin is brought out to which socket.
This wraps up the hardware idioms. The complete design is an amalgamation of these patterns with a few ancillary side-items (like an inductor filter for analog power) thrown in to complete the design.
Step 3: Build Your Board
Your mission, should you chose to accept it, is to print to toner transfer paper (with or without your modifications), transfer to your copper clad board, etch and drill -- or follow whatever established etching protocol you use. Although I've successfully etched 0.12 traces, you will notice I enlarged the traces and pads for easier homemade etching. When you are finished the board should look something like the pictures below.
At this point (or before I silkscreen), I take steel wool and buff both sides while wearing nitrile gloves to give the copper a super shine and remove any built-up oxidation or oil from fingerprints.
Pin your vias first (since homemade etching doesn't through-hole plate, I've found it more effective to solder a wire from top to bottom layers. Next place your SMD components, if you have any, followed by resistors, capacitors, switches. Finally, place your taller components, such as the headers and power jack. Before you power it, place standoffs in the corners.
Your finished board might look like the one below.
Step 4: Carrier Board
Soldering TQFP44/48/64 chips is surprisingly simple.
- Wipe off the carrier board to remove dirt, dust, and fingerprint oil.
- Put a light coat of solder flux over the pin pads on the carrier board
- Place the MCU in the correct orientation on the board (notice where pin 1 is) and hold it down. I use the head of an eraser on a pencil because it has good grip but is soft on the chip.
- After ensuring all pins are aligned on their correct pads, solder one corner.
- Get solder on your gun and run it across the pins quickly. Don't worry about cross connects. Make sure all pins have solder.
- Take solder wick and wick up any excess solder on all four sides.
- Check your work with a loupe or high-power magnifying glass.
Next step: get it goin' on!
Step 5: Attach Carrier and PDI
You're now ready to attach the carrier board to the female counterparts on the board. Seat it nice and firmly. Connect a DC power source and the power light should light up. Push the reset button and the red LED should flash.
Next connect your PDI programmer to the PDI interface. In the picture below you'll see the carrier on the programming board as well as a pic of the board connected to AVR Studio via an AVRISP mkII where I query the device for its signature.
The only thing left is for you program the chip to do whatever you are using the Xmega for. There are plenty of socket ports to play with and extend your own design.
Step 6: Conclussion
In this instructable, I've shared my knowledge and some insight into building your own complete AVR ATXmega programming/development board. This will allow you to break into the low-power, full-featured Xmega chip market to use in your own custom designs.
I hope this instructable was helpful and useful to you. As always, I am open to suggestions for improving this and any of my instructables. Feel free to leave comments, send me an email, or catch me on iRC on freenode.net as nevdull.