USB Serial firmware for ATmega32U4


This post shows how to create USB Serial firmware for the ATmega32U4 found on Adrafruit’s excellent breakout board, using Atmel Studio 7. The design of the breakout board is available at GitHub, so is the Fritzing part used in the figure below. The source code of the USB Serial firmware discussed here can also be forked at GitHub.

Screen Shot 2016-10-28 at 10.02.24.png

Source code

Creation of source code with Atmel Studio 7 is described in post Arduino USB Serial firmware from scratch. Choose adafruit_u4 as the board for LUFA Board Support (driver).

The code has been adapted to blink the same LED when receiving and transmitting data, because the breakout board has just one LED to indicate that.

Flash using JTAGICE3

See the wiring diagram above to see how JTAGICE3 can be wired to the ICSP header on the breakout board. The Device Programming dialog can then be used to program flash memory on the MCU as shown below.

screen-shot-2016-10-28-at-10-27-19.png

Test

The converter can be tested by using another USB Serial converter connected to RX and TX wires shown in the wiring diagram. Note that the wire ending with TX should be connected to RX on the other converter, similarly the wire ending with RX should be connected to TX.

Troubleshooting tips

The breakout board ships from Adafruit in USB powered mode. That makes it ideal as a USB Serial adapter because it can be powered from the PC it is plugged into.

If your USB host device does not provide enough current on VBUS, you can cut the VCC solder jumper on the other side, and provide 3.3V at the VCC header pin.

Screen Shot 2016-11-14 at 12.11.11.png

Atmel has a detailed application note on USB that has recommendations you should take into consideration in your designs.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s