Go Down

Topic: [help] Designing your own Arduino based on Leonardo (atmega32U4) (Read 28181 times) previous topic - next topic


Hello everyone,
I would like to create my own board based on Arduino Leonardo. I bought an fresh atmega32U4 microcontroler and solder it to the board. I added few components like crystal, some capaciotors, few resistors, and USB cable. The atmega32U4 has an USB controller built in so I would like to ask you some questions:

  • Is it possible to burn sketches without Leonardo's official bootloader to the fresh atmega32U4 chip over USB (I mean without external ISP programmer)?

  • Is it possible to burn bootloader onto fresh atmega32U4 over USB (again using only integrated USB controller)?

  • Is it possible to use all of the atmega32U4 chip pins that are not used as digital I/O on leonardo board (like the whole PORTB as digital I/O instead of RX-Led(PB0) and ICSP header(PB1, PB2, PB3)?

This is my current configuration, just atmega32U4 chip, crystal and USB port.

I tryed to find similar topics but with no succes. I have an STK500 programmer, but it would be nice to program just with USB cable.

Thank you, Jakob


Atmel datasheet says the 32U4 is shipped with a bootloader installed.

"All supplied parts are preprogramed with a default USB bootloader"
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Hi CtossRoads,
I am aware of this, but is this bootloader compatible with Arduino IDE?


I don't know. Sounds like you are wired up now, give it a try.
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Maybe check the AVR application notes here as well.


AVR276: USB Software Library for megaAVR with USB Microcontrollers
(file size: 10255299, 27 pages, revision A, updated: 01/2007)

This application note describes the USB software library for megaAVR with USB and illustrates how to develop a USB device or reduced host applications using this library.

AVR277: On-The-Go (OTG) add-on to USB Software Library for megaAVR with USB
(file size: 197131, 15 pages, revision A, updated: 07/2007)

This application note describes the new features brought by the OTG working group and how they are integrated in the USB software library for megaAVR with USB, illustrating how to develop customizable USB OTG applications.

AVR280: USB Host CDC Demonstration on megaAVR with USB
(file size: 1684150, 14 pages, revision A, updated: 09/2007)

This application note describes how to start and implement a Host CDC application using the STK525 or USBKEY starter kit, and finally introduces a simple example of dual USB-UART bridge between two PCs.

AVR282: USB Firmware Upgrade for megaAVR with USB
(file size: 754660, 13 pages, revision A, updated: 01/2008)

This application note describes how to perform the firmware upgrade of the megaAVR with USB products using the on-chip bootloader and FLIP software.

AVR298: USB Audio Demonstration with ATmega32(16)U4
(file size: 209845, 8 pages, revision A, updated: 11/2008)

This application note describes a simple audio project. It allows to quickly test USB hardware using the ATMega32U4 without any driver installation.

Atmel AVR4023: FLIP USB DFU Protocol
(file size: 143KB, 15 pages, revision A, updated: 03/2012)

This application note describes the FLIP USB DFU Protocol. To perform firmware upgrade, Atmel has developed a Flexible in-system programmer (FLIP). This software allows performing In-System Programming from an USB host controller without removing the part from the system or without a preprogrammed application, and without any external programming interface.

The "Other Documents" section might have something useful as well

The Novice Guide to AVR Development

Construct an ATA Hard Drive Controller

Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


I will check AVR application notes tomorow. For now I have connected the atmega to the computer but got this in the "Device manager":

Thank you for your help,


I can program chip without problem over USB with Atmel FLIP software (http://www.atmel.com/tools/FLIP.aspx). But before everything works you will need to do few things:

1) if you will power device just from the USB cable and you wont use external power supply, then you'll need to connect all VCC lines to the Vbus pin. So you will need to connect pins nr. 2, 7, 14, 24, 34 and 44,
2) you will need to add crystall with corresponding capacitors (http://arduino.cc/en/uploads/Main/arduino-leonardo-schematic_3b.pdf)
3) now you are ready to connect the atmega to computer over USB cable. Dont forget to add 22E resistors serial to D+ and D- lines,
4) if you are using Windows, then press Windows button+pause (or go to System) and click on Device manager,
5) there should be now listed device called "atm32u4dfu", if there is, than your wiring is correct. Now press right button and click on update driver. Browse to the Atmel FLIP directory (C://Program Files/Atmel), and click ok. It should load the corresponding driver.
6) go to the Atmel FLIP program and connect the atmega with computer. Now you are ready to upload .hex files to the chip over USB and built in bootloader.



Cool. Glad you got it figured out.

Are you able to change the bootloader to the Arduino/IDE bootloader?
Designing & building electrical circuits for over 25 years.  Screw Shield for Mega/Due/Uno,  Bobuino with ATMega1284P, & other '328P & '1284P creations & offerings at  my website.


Well... I think that you can not replace bootloader. I loaded an arduino blink sketch (.hex) to the Atmega and now it won't connect to computer again. Looks like I will stick with old good SPI method, unleas somebody give me a good hint.


Hi ....

I tried implementing the circuit based on ATMega 32u4 with Leonardo Bootloader. After going through the online resources and the atmega 32u4 datasheet, I tired the circuit as :-

1. ATMega 32u4 soldered on the breadout board ( 44 TQFP to BreadBoard )

2. 22pF Capacitor and 16 MHz Crystal - for the oscillator circuit.

3. USB Circuit with a 500mA Fuse, with 22e series resistor to D+ and D-

4. 0.1 uF cap connected from UCAP to GND.

Burning the Bootloader :

I used Arduino UNO and used it as ISP. Connected the pins( MOSI, MISO, SCK, RST, Vcc and GND) of ATMega32u4 breakoutboard to the respective pins on Arduino UNO.

Selected the Borad Type  as  "Leonardo" and Programmer as "Arduino as ISP "

Then "Burn Bootloader"

After about 30 sec, got the success message as Done uploading bootloader.

ATMega32u4 ISP through Arduino UNO:

I could upload the blinking LED sketch with the Arduino as ISP. Tried it many time and it works flawlessly.

ATMega32u4 Connnected to PC via USB :

When the ATMega 32u4 breakout board was connected to the PC via USB cable, It was successfully detected and in the Device Manager is displayed as "Arduino Leonardo " on "COM21".

However, I am unable to upload the sketch via the USB on to this board.

After, trying to figure out the solution to this problem, I am assuming that during the uploading of the sketch, the bootloader tends to reset the chip. Since, ATMega32u4 has on chip USB, it tends to disconnect the USB connection during the upload process.

I am still trying of find a solution to this problem.

Please guide me if anyone has solved a similar issue

Thanks .



I'm also having this trouble with my own design of the Arduino Leonardo. I'm trying to change the ATmega32U4 fuses to reduce frequency (less consumption) and BOR voltage level limitation.

I'm not able to upload a scketch after reprogramming the fuses. The only way i found was to click 1 second on the reset button immediatly after appearing the "Uploading" string on the Arduino program.

Did you manage to find other solution?



What I did to upload from a PC without using any ide was to create a batch file with the avrdude command for uploading and then using c# I wrote a program that opened and closed the appropriate com port at 1200 (apparently this acts as a software reset signal). I was then able to upload the sketch by running the batch file from the same c# executable. More a proof of concept than anything else, but it does work...


Go Up