How to use USART on the Atmel AT90USBKEY / AT90USB1287

When programming the Atmel AT90USB1287 it is very helpful to have a UART connection for debugging purposes. To avoid reinventing the wheel, I will use Peter Fleury’s uartlibrary. Additional documentation an sample code can be found here.

First, we will wire some standard jumpercables to the AT90USBKEY. According to the datasheet of the AT90USB1287 and the datasheet of the AT90USBKEY the pins are available at the connector J4, more specifically:

USART1 Transmit Pin = PD3 = AT90USBKEY -> J4 Pin 7 -> White
USART1 Receive Pin = PD2 = AT90USBKEY -> J4 Pin 8 -> Green
Ground = AT90USBKEY -> J4 Pin 2 -> Black

AT90USBKEY2 J4

My UART to USB Cable has the following wiring:

RX -> Green
TX -> White
GND -> Black
VCC -> Red

Now its time for a little sample program:

Build it and flash it to your AT90USBKEY. Remember that you must bring your AT90USBKEY into DFU mode for programming with FLIP.

Now you can start a terminal:

Now you can press the RST button to actually run the program on the microcontroller and should see a nice Hello World greeting.

AVR development on Mac OSX

I have seen people using virtual machines on their Macs just for AVR development. Fortunately, that is entirely unnecessary. Here is how to set up for AVR development on a Mac.

First install the avr toolchain:

Install Eclipse CDT with avrdude plugin and follow this tutorial and you are set.