0
\$\begingroup\$

I have an ATMega32u4.

My question is about the bootloader section. How does this device pretend to be a com port while connected to USB? What makes the computer think it is a com port and how can I implement this myself?

  1. When I connect my device to a PC, it shows up as a keyboard on a Windows machine that is connected to COM5 while the physical layer of it happens via USB.

  2. I have a simple blink program flashed on to it, so where does this "keyboard" device come from?

  3. I went to Arduino IDE and compiled a simple uart sketch that loops and sends a string via UART which is again not a real UART but physicaly it happens over USB.

Could someone explain this to me? I can't get my head around it.

\$\endgroup\$
0
0
\$\begingroup\$

Try an Internet search using the keywords "Arduino bootloader". You'll easily find websites that discuss the inner workings of an Arduino board's bootloader.

See also the data sheets on Microchip's website for their ATmega32u4 product. There you'll find a data sheet that describes the chip's "USB DFU bootloader."

Also search for "USB CDC" or "USB communication device class".

My guess is, when you connect the Arduino to the PC via a USB cable, the PC's operating system performs plug-and-play device discovery, and the bootloader software or other firmware on the ATmega32u4 tells the desktop computer that it (the ATmega32u4) is a serial communications device; consequently, Windows registers the device as a COM port. This behavior is similar to an FT232R chip which is commonly found in USB-to-RS232 adapter cables.

The desktop computer's operating system might fail to correctly detect the Arduino as a serial communications device (a COM port) if the operating system or some part of the operating system is out-of-date or buggy (e.g., an installed device driver is out of date or buggy), or if the bootloader software or other firmware on the ATmega32u4 is out-of-date or buggy, or both. For example, the OS might incorrectly detect that the device is a human interface device (HID) such as a keyboard or mouse.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.