Atmel kindly gave me an Xplain Xmega board at one of their Xmega seminars. It’s a useful tool for ATXmega development, but it does have a couple of problems. I thought I’d mention the ones I’ve tripped over, in case anybody else sees the same problems.
Board Doesn’t Restart Properly
I’ve found that when the AVRISP2 programmer is plugged in, the Xplain always reboots properly. But when the programmer is unplugged and the board is “on its own”, so to speak, it doesn’t always reboot properly and the code in the Xmega128 doesn’t always run.
The reason is a hardware problem on the board. Atmel’s Xmega documentation states that the Xmega processors have a weak internal pullup on the reset line. If there are any external devices on the reset line, an additional external pullup may be required.
This is the case with Xplain. The ATXmega128 reset line also routes to the AT90USB1287 part on the board. It seems this small additional load is problematic for the Xmega. Adding a 10k pullup resistor to the Xmega reset line solved the problem and allowed the Xmega to reboot properly every time.
Take a look at the Xplain schematic (available on the Atmel website) to see where the reset signal goes. Personally, I found it very easy to solder an 0603 10k resistor on the back of the Xmega programming connector header, between pins 4 & 6. The 0603 was the perfect size to fit between the solder joints for pins 4 & 6 on the back of the board. But, a regular leaded resistor would work fine too.
USB Serial Interface Doesn’t Work
Yep, lots of people have pointed that out. The AT90USB1287 is supposed to implement a “virtual COM port”, allowing the Xmega to transmit & receive at 9600 board, and have that available over USB thanks to the 1287. In theory. In practice, not so much. Atmel’s USB-to-serial interface doesn’t seem to work as advertised. I was able to confirm on my board that I was giving the AT90USB1287 the 9600 baud serial data it expected, but the thing never worked. I tried different drivers etc from the Atmel website, to no avail.
In theory you can reprogram the 1287 via the USB port, using Atmel’s “FLIP” utility (available on their website). For me, that didn’t work either, and I really tried hard. No FLIP for me!
So what to do? Here are a couple of options.
- Apparently this code works, if you can get it into the AT90USB1287:
Build the “XMEGABridge” project, program the resulting .hex file into the 1287, and you’ll have a working USB to serial interface. Of course the big trick is actually doing the programming. If you can get FLIP to work, great. Otherwise, you’ll need to program the 1287 via its 10-pin JTAG programming header. Note I said “JTAG” – you’ll need a JTAG programmer, not the AVRISP2.
- Give up on the 1287 completely & solder a MAX232 device and DB9 connector to the board instead. This option worked for me because I had the parts required at hand, so it was fairly easy & quick. I would imagine this might not be the case for everyone though.
Programming Atmel AVR processors has become a little more difficult with Atmel’s use of a 6-pin connector on their popular AVRISP2 programmer. This is a great little programmer, fast, cheap, and USB based.
But why oh why did they put a 6-pin connector on it, instead of the 10-pin connector they use almost everywhere else? Almost all of their development boards, including the Xplain, have 10-pin programming headers. But this little programmer has a 6-pin connector. So you need to make yourself an adaptor board, or adaptor cable, before you can even use it. What were they thinking?
In fact, ideally you need to make two different 6-to-10 pin adaptors. One for Xmega devices that use the PDI programming interface (see my previous post for pinouts), and a different one for all the other AVR parts that use the older “SPI” or “ISP” programming interface.
There you have it. A pull-up resistor to cure the “Xplain doesn’t reset” problem, and a couple of options if your Xplain USB to serial doesn’t work. Have fun!