Question

I am currently working on a project using an Arduino Uno (rev3) board. Eventually I might let it run independantly from Arduino and that got me thinking how the whole programming and bootloader stuff works.

Here is what I know/assume so far:

  1. The board has two chips: The ATmega328 (main chip) and the ATmega16u2 (used as a USB-to-serial bidge).

  2. The firmware of the ATmega16u2 can be changed by activating DFU-mode and using e.g. DFU-Programmer. The Arduino can then be recognized as a HDI / Midi device but is no longer programmable.

  3. When programming the ATmega328, the chip is being reset and on restart the bootloader will load and write the new program via its serial connection and the ATmega16u2-bridge. The ISP-interface of the chip is not used for uploading the new program. Who is initiating the reset in the first place?

  4. The Arduino can be used as a ISP-Programmer to program other external chips. For that some firmware is loaded onto the AATmega328 an the ISP-pins of the chip to be programmed are connected to the one on the Arduino board. Then the Arduino-IDE is configured to use the Atmega328 as a programmer rather than reprogram it.

I hope, at least most of what I have written is correct. My questions then are:

If I put a new/blank AVR onto my board, how does the bootloader get onto that chip? How does the "Burn Bootloader" command work?

Is it possible to upload a hex file to the ATmega328 WITHOUT uploading a bootloader first? Can this be done by using speciaf firmware on the ATmega16u2?

Thanks!

Johannes

Was it helpful?

Solution

An ISP programmer (either ArduinoISP or a discrete programmer such as USBasp) can be used to program the flash, EEPROM, fuse bits, and lock bits of an AVR without requiring a pre-existing bootloader. It uses the SPI pins on the device to send commands to the device to manipulate the non-volatile storage contents.

The ATmega16U2 only has UART connections to the '328; there is no way to program using the UART without a bootloader on the '328.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top