Xmega 4 breakout (2011)¶
Overview¶
I've been working on several projects where I want to use a small, low cost, power efficient microcontroller. I played around with several of the ATtiny processors, however none of them seemed to have the right combination of features. Having read a little about the XMEGA line, it seemed like an interesting side project to experiment with.
None of the xmega processors are available in DIP packaging, so it seemed like an opportunity to design a surface mount breakout board and try my hand at soldering surface mount parts. This is meant to just be a short document describing the board and some of the issues I ran into.
Design¶
The overall goal was to build a breakout board that would make it easy to prototype with a low end xmega processor. The cheapest part is the ATxmega16D4, which is where I started. The board also needed to be easy to use for prototyping, since I wasn't sure what they were going to be used for. Finally, I wanted it to be able to use a serial bootloader for programming.
Features¶
All pins broken out to two single rows of 0.1" headers.
Small enough to fit (just barely) in a standard solderless breadboard.
Standard six pin serial header for use with 3.3V FTDI Breakout boards. This is the same design used on the Arduino Pro and Diavolino boards.
Room for a jumper to enable or disable auto-reset from the serial connection. This design allows easy serial programming, but also makes it easy to disable auto-reset when it's not needed.
Room for an external 32.768 kHz crystal oscillator. This allows the xmega to run using its internal 32 MHz clock, while providing a higher accuracy, lower power clock for keeping track of time while sleeping. Inspired by this experiment at JeeLabs.
Resettable fuse on the power line.
Just enough other parts to run. This includes a PDI port for programming, a reset button, and bypass capacitors. This is enough to make the board usable and cheap and to allow room for flexible expansion.
One of the nice thing about the xmega line is that all the D4 and A4 processors have the same pinout. So the board will work just as well with everything from the 16D4 to the 128A4 processors.
Support¶
The xmega line uses a PDI programming interface, which is different than the ISP interface used by the mega and tiny chips. The only low cost programmers I know of are the official Atmel AVRISP mkII and the LUFA based clone from Dean Camera. One issue with the Atmel programmer, is that it requires Windows to update the firmware. The programmer I got from DigiKey in 2011 required updating the firmware to work.
From the software side, the xmega chips can be programmed with the same toolchain as the mega and tiny lines, namely avr-gcc and avrdude (or the official AVR Studio). The D series of chips don't appear to have configuration values in avrdude, but they have the same memory layout as the A series of chips, so it's easy to fix.
For a bootloader, I've been using avr-xboot, which supports serial programming as well as a lot of other protocols.
I haven't been using any programming libraries, but the latest Wiring libraries do have support for xmega processors.
Issues¶
I seem to have accuracy problems with the external watch crystal. It does allow very low powered sleep modes, but the frequency seems to be significantly off. It's possible the board design is causing problems (see AVR186 for PCB guidelines for oscillators). I haven't spent a lot of time testing or debugging this problem yet.
On my mac, programming with the AVRISP mkII is really slow. It turns out there's a usb read call that always times out, and has a very long timeout value. Reducing the timeout significantly reduces the latency for programming the device. Again, I haven't spent much time debugging.
Links¶
Source files available on github.
My local modifications to the xboot code. In particular, this includes my settings for the serial programming the 16D4.
My local modifications of avrdude, which includes the AVRISP mkII timeout fix as well as configuration values for the ATxmega16D4.