Probably most proper microcontroller programming method is using a bootloader program. Because you don’t need any special programming adapters or special knowledge – you need to connect a standard cable from your PC to target board and run a special program on PC which communicates with MCU bootloader program. The idea is simple:
If the microcontroller is preconfigured then after reset, it starts running not from start memory location which is usually at 0x0000 address, but at some specific location, where usually bootloader lies.
All AVR ATmega family microcontrollers can be programmed with a bootloader. Program start address depends on AVR fuse settings. If settings say that program counter PC has to jump to bootloader section after reset, then first of all bootloader has to be executed. Bootloaders can be various sizes and can use different algorithms and interfaces from where the program will be loaded. Sources can be Flashcards (MMC/SD), I2C, USART, SPI, and USB.
Variety of AVR bootloaders
Most of AVR bootloaders are using COM port for connectivity with PC. This can be OK if USB-USART bridge is used. As a matter of fact, it is not always to run somebody’s written bootloader for the first time. Usually, it may require some customizations, reading help documents. IN the list you can see a list of most popular bootloaders available (there may be more):
- Atmex, https://ladyada.net/techproj/Atmex/, COM, 19200bps, Assembler; JAvrProg(Java), ATtiny2313 (8-16Mhz);
- Bootloader Programmer, Peter Dannegger, https://www.mikrocontroller.net/topic/12181, COM, Assembler; ATmega8/16/32/128;
- AVRProg-compatible Bootloader, Martin Thomas, https://www.siwawi.arubi.uni-kl.de/avr_projects/, COM, WinAVR (C); AVRProg; Various AVRs and speeds;
- USBisp Bootloader, Matthias Weisser, https://www.matwei.de/doku.php?id=en:electronics:usbisp, USB, COM, AVR-GCC(C); AVRProg; STK-500; ATmega8, FT245BM;6MHz;
- DL5NEG, Herbert Dingfelder, https://www.herbert-dingfelder.de/bootloader/bootloader.html, COM, 19200bps, ASM, AVRProg; ATmega8 7.3728MHz;
- Chip45boot, Erik Lins, https://www.chip45.com/index.pl?page=chip45bootâŒ©=en, COM, 11500bps, WinAVR; HyperTerminal; Various AVR
- STK500-Bootloader, Pascal Stang, https://hubbard.engr.scu.edu/embedded/avr/bootloader/, COM, Hex; AVRProg; STK500; ATmega8-128; 7.3 – 22.1MHz
- AVR109 (AVR Butterfly), Atmel, https://www.atmel.com, COM, IAR(C); ATmega series; 12MHz;
- AVRUSBBoot, Thomas Fischl, https://www.fischl.de/avrusbboot/, USB, AVR-GCC; ATmega8(other Megas); 12MHz;
- Megaload, Sylvain Bissonnette, https://www.microsyl.com/megaload/megaload.html, COM, 11500bps, ICCAVR(C); Megaload.NET; Various AVR;
- Bootload HID, https://www.obdev.at/products/avrusb/bootloadhid.html, USB, HID, WinAVR; ATmega8;
- Crypto_Boot, https://avrusb.wikidot.com/project:crypto-boot, USB, IAR(C); Crypted AES; ATmega32; 12MHz.
There are even more bootloaders but most of them are for COM port. These can be adapted to USB by using USART to USB bridges like FT245BM. But probably it is more convenient when USB is connected directly to MCU and communication part is done by firmware USB driver.