0

I am learning UART and the problem that i have is understanding what happens when i send serial data to my PC via USB which is built in to the Arduino uno board.

For incoming serial data i am using Terminal v1.9b and it basically lets me to set some parameters and listen to incoming data on Software serial port and or write to it.

The process:

  1. Atmega328p's Baud rate is set to 9600
  2. Terminal connects to it (it performs a reset) and i get my data in.

Very simple, it all works and i don't have a problem with it. What my question is: I assume that my PC doesn't talk to atmega328p directly since it has no USB interface. it talks to a bootloader chip which converts the USB to UART and then i receive that message on my atmega328p. How does that chip know which baud rate we agreed to. OR "Terminal" sends the baud rate to that bootloading chip via usb protocol and it sets its UART settings ?

8
  • 1
    The Arduino boards featuring a USB connector have a FT232RL converter chip. The PC has to tell the FT232RL through the USB which bitrate to use. It has to be the same as that the ATmega328 on the Arduino board is set to.
    – Janka
    Commented Oct 27, 2018 at 21:09
  • 1
    on my arduino it is not ft2332rl, i am using UNO, i thing it is atmega8 with U
    – Anton Stafeyev
    Commented Oct 27, 2018 at 21:21
  • Arduino UNO Rev. 3 CH340 Clone Board
    – Anton Stafeyev
    Commented Oct 27, 2018 at 21:25
  • Even Arduino website mentions the MegaU8 is used as a USB-to-serial chip, so what @Janka said still applies. Should be the answer.
    – Justme
    Commented Oct 27, 2018 at 21:30
  • 1
    That's a completely different question. The MegaU8 is programmed to be a standard USB serial port, so it is a serial port and it will work with standard serial port drivers that come with Windows and every software compatible with serial ports can use it. If you want to write custom drivers, you would also need to rewrite the MegaU8 firmware so that it does not look like a USB serial port any more.
    – Justme
    Commented Oct 27, 2018 at 21:50

1 Answer 1

4

The bootloader runs in the 328, and just as your application programs do, it sets a UART baud-rate for uploading programs to the Uno.

Current bootloaders use 115200 baud for upload; the most recent previous ones used 57600 baud. Setting that is part of the bootloader code. Whatever your application program last set for a baud-rate doesn't matter; if you reset the Uno, the bootloader sets the UART to the known upload baud-rate, and waits briefly for the PC to begin an upload, and jumps to the currently loaded application program if no upload is begun.

Your PC's Arduino IDE configuration is written to use the known bootloader baudrate (you can see that in the avrdude command). In fact, since I have some boards with soldered-in chips with the older, 57600 baud bootloader burned in them, I have two Uno-board configurations in my IDE; one for those older chips, and one for the current ones.

2
  • Thanks for the answer, yeah i figured what bootloader is, and my question was not asked correctly. Since i have another USB to serial converter it shows up as a COM device on my computer. What would it take to actually make this device appear as USB storage for example. would i need to write the driver for it ? and how would i apply the driver to the chip if i have no way of changing it's PID. Commented Oct 29, 2018 at 14:47
  • This is really a new question, but the short answer is, you'd have to reprogram the Uno's USB processor (Atmega 8U2) to act like whatever other kind of USB device.
    – JRobert
    Commented Oct 29, 2018 at 20:42

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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