Where can I get an ATMEGA32U4 with a pre-programmed boot loader?

Hi all,
I want to start building my projects on a custom PCB, but I don't know where to find an ATMEGA32U4 with a pre-programmed bootloader. Where can I find one, and if there arent any available, how can I flash the Arduino Leo Bootloader onto the microcontroller with another Leo?

Using LEO as ISP programmer:

Upload ArduinoISP sketch, from IDE examples, to the LEO.

Connect hardware SPI pins MISO, MOSI, SCK and RESET as per the description in the ISP sketch opening comments. No cap required on the RESET line.

You can connect LEDs (with resistors) to the following pins if you like:
9: Heartbeat - shows the programmer is running
8: Error - Lights up if something goes wrong (use red if that makes sense)
7: Programming - In communication with the slave

Select "Arduino Leonardo" as the Board in IDE Tools

Select "Arduino as ISP (ATmega32U4)" as the Programmer in the IDE Tools

Click "Burn Bootloader" in the IDE Tools and you are done (takes quite a while to burn). Works a treat.

If I remember correctly the "Blink" sketch is also uploaded as part of the boot burn and starts running. (If you connect a LED, with resistor, to pin 13 it starts blinking).

I use the Atmega32U4 in my home made boards when I need USB uploads etc - definitely the easiest option.

Have fun.
Willem.

Yeah - include the 6-pin ISP header on the board and bootload the assembled board yourself.

Willem43:
Using LEO as ISP programmer:

Upload ArduinoISP sketch, from IDE examples, to the LEO.

Connect hardware SPI pins MISO, MOSI, SCK and RESET as per the description in the ISP sketch opening comments. No cap required on the RESET line.

You can connect LEDs (with resistors) to the following pins if you like:
9: Heartbeat - shows the programmer is running
8: Error - Lights up if something goes wrong (use red if that makes sense)
7: Programming - In communication with the slave

Select "Arduino Leonardo" as the Board in IDE Tools

Select "Arduino as ISP (ATmega32U4)" as the Programmer in the IDE Tools

Click "Burn Bootloader" in the IDE Tools and you are done (takes quite a while to burn). Works a treat.

If I remember correctly the "Blink" sketch is also uploaded as part of the boot burn and starts running. (If you connect a LED, with resistor, to pin 13 it starts blinking).

I use the Atmega32U4 in my home made boards when I need USB uploads etc - definitely the easiest option.

Have fun.
Willem.

Thank you so much for the help, just one question. To upload my programs, would I use the same connection, and just upload the sketch as usual, after I've burned the bootloader of course

The "bootloader" is the thing that lets you upload via USB (though, "burn bootloader" also sets the "fuses" which configure clock speed - so confusingly in Arduino, "burn bootloader" is still a necessary step even when uploading via ICSP/ISP instead of through the bootloader.

I would imagine that if you chose to use a '32u4 instead of a less expensive (and probably more capable, as you can get much spiffier parts than the aging 32u4 if you don't need the real USB) part, you are doing that because of the native USB functionality, so you'd already be including a USB port, which once the chip was bootloaded, could also be used to upload a sketch?

If not using the native USB, why use a 32u4?

DrAzzy:
...If not using the native USB, why use a 32u4?

Thats a good point, that being said my next question is, what pins on the 32u4 are the ones for usb connection?

catrassi:
Thats a good point, that being said my next question is, what pins on the 32u4 are the ones for usb connection?

Physical pins 2 through 7. See my comments in other thread too.

Don't use a 32u4 unless you need USB as opposed to just serial connection like a pro mini/nano/etc (the uno/nano just have a USB-serial interface chip on the board - not sure how familiar you are with the differences between the designs).

For like a quarter of the price of the '32u4, you could get a 4809, for example, with 50% more flash, more than 2x the ram (hell, if DxCore was a little more mature, I'd compare the specs and price of an AVR128DA48 to the 32u4 - but my DxCore is still a little rough around the edges.... the new generation of AVR devices just absolutely buries the old ones, and their pricing is way better too)... or if you want to stick with classic peripherals, could go with a '328PB shrug that's what I use these days when I want something bigger than tinyavr with classic peripherals.