Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

[SOLVED] Do Atmega16u2/32u4 chips contain a bootloader to be programming with USB

Status
Not open for further replies.

redsees

Junior Member level 1
Joined
Jan 30, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
313
Do Atmega16u2/32u4 chips contain a bootloader to be programmed with USB

Hello everyone,

I wanted to start working on Atmega16u2/32u4 and such chips typically because of the existence of a USB interface (D-/D+/UGND pins).
I'm not talking about working on the chip with the Arduino IDE, I'm going to build my firmware using the Atmel studio and the usual AVR toolchain.

So, my question is, could these chips (specifically the 16u2/32u4) be programmed by simply plugging a USB port into the D-/D+/UGND pins and that's it?
No need for any bootloader?

I'm mainly willing to build that circuit (please ignore the battery part, the power would be from the 5Vdc from the USB):
https://cdn-learn.adafruit.com/assets/assets/000/028/445/original/microcomputers_feathershc.png

So can I just build the above circuit, plug in my USB and start developing?

Mentioning a similar case, AFAIK the bootloader in the Atmega328p (Arduino Uno board) is used to just make the latter chip programmable using the UART interface instead of the SPI, and the Atmega16u2 was the conversion circuitry between USB-to-serial.
I've been programming the Atmega16u2's (in the Uno boards) using the USB using dfu-programmer tools. are the Atmega16u2's in the Uno boards come preprogrammed with bootloaders to support being programmed by USB?

Much Regards
 

FenTrac

Full Member level 4
Joined
Jul 6, 2014
Messages
208
Helped
37
Reputation
74
Reaction score
41
Trophy points
1,308
Location
West Coast
Activity points
3,077
According to the 16U2 datasheet it comes with a factory USB bootloader installed. I have only used 16U2's as USB to serial converters using the Arduino combined DFU software included with the Arduino IDE software. The post below appears to be from someone using the factory bootloader that may be of interest.
https://electronics.stackexchange.com/questions/281420/stock-factory-bootloader-in-atmega16u2

The physical interface for USB to the 16U2 can be referenced from Arduino UNO schematics.
 
  • Like
Reactions: redsees

    redsees

    Points: 2
    Helpful Answer Positive Rating

FenTrac

Full Member level 4
Joined
Jul 6, 2014
Messages
208
Helped
37
Reputation
74
Reaction score
41
Trophy points
1,308
Location
West Coast
Activity points
3,077
Some additional searching found an Atmel application note about using the Flip program to upload software with the factory bootloder. The note does not specify the ATmega16U2, but the 16U2 is an updated version of the AT90USB162 listed in the note. Flip version 3.4.7 lists the ATmega16U2 as a supported device.

https://ww1.microchip.com/downloads/en/DeviceDoc/doc7618.pdf
 

redsees

Junior Member level 1
Joined
Jan 30, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
313
Thank you Fentrac.

Exactly after your first reply yesterday, I searched a bit and found the datasheet you shared in your second reply.
I quote:

The 8bits mega AVR with USB interface devices are factory configured with a USB bootloader located in the on-chip flash boot section of the controller.
This USB bootloader allows to perform In-System Programming from an USB host controller without removing the part from the system or without a pre-programmed application, and without any external programming interface.

So both the Atmega16u2/32u4 and some others come with a USB Bootloader. But that raises another question, coming with a preconfigured bootloader, that means I won't be able to burn any custom bootloaders of mine without overwriting/removing the USB bootloader?
 

KlausST

Super Moderator
Staff member
Joined
Apr 17, 2014
Messages
19,928
Helped
4,368
Reputation
8,745
Reaction score
4,347
Trophy points
1,393
Activity points
131,909
Hi,

But that raises another question, coming with a preconfigured bootloader, that means I won't be able to burn any custom bootloaders of mine without overwriting/removing the USB bootloader?
Do you need two different bootloaders at the same time?

Klaus
 

redsees

Junior Member level 1
Joined
Jan 30, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
313
Do you need two different bootloaders at the same time?

That was just a quick question that popped up when I found that some chips come with a preloaded bootloaders.
I was just wondering in case I ever needed for some projects to write a bootloader that does some tasks before executing the flash firmware, in that case I think I would either have to overwrite the USB bootloader with mine, or try to concatenate both of my bootloader and the USB one into a single code.
 

FenTrac

Full Member level 4
Joined
Jul 6, 2014
Messages
208
Helped
37
Reputation
74
Reaction score
41
Trophy points
1,308
Location
West Coast
Activity points
3,077
The factory bootloader can be set by fuses to be act in several ways. Using the hardware method, it will enter the bootloader or the application depending on the logic level of the HWBE pin at reset. If it is set to boot the application, you could have a different bootloader installed as an application.
 

redsees

Junior Member level 1
Joined
Jan 30, 2016
Messages
18
Helped
0
Reputation
0
Reaction score
0
Trophy points
1
Activity points
313
Thank you guys for all the useful resources and replies.

Thread marked as solved now.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Top