Board and port
The Tools menu decides where an upload goes: Board, Arduino Uno or Arduino Nano, and Port, the CH340's. The Nano adds a third row, Processor, because Nanos ship with two bootloaders. The IDE cannot fill any of them in for you, because the port does not say what board is behind it.
The rows
Open Tools in the Arduino IDE and set:
- Board: Tools > Board > Arduino AVR Boards > Arduino Uno.
- Processor, which only the Nano has: ATmega328P, or
ATmega328P (Old Bootloader) if the upload says
not in sync. The Nano's Processor row, below, says why. - Port: Tools > Port, the entry that appears when the board is plugged
in. It is the CH340C's port:
COM3or similar on Windows,/dev/cu.usbserial-…on a Mac,/dev/ttyUSB0on Linux.
Pick a wrong choice in the figure and the output pane shows what that mistake
prints. The mistakes end in the same ten lines of not in sync, which is why
the port is worth checking first.
Why the board row matters
Each board in the menu carries a set of settings with it: the chip to compile for, the clock it runs at, and how to upload. For Arduino Uno those are the ATmega328P, 16 MHz, and avrdude talking to the bootloader at 115200 baud. Pick a board that uploads at a different speed and the bootloader never understands a byte of it.
A board on the list with the same chip is not good enough either. Arduino Duemilanove or Diecimila has an ATmega328P too, and uploads at 57600 baud.
It fails on this board every time.The Nano's Processor row
Arduino Nano is the board in this menu with a Processor row, because Nanos are in the field with two bootloaders that listen at different speeds:
- ATmega328P: the newer bootloader, at 115200 baud.
- ATmega328P (Old Bootloader): the older one, at 57600 baud.
We have not checked which one this Nano ships with, so the error is the test.
Start with ATmega328P. If the upload ends with ten not in sync lines and
the port is right, choose ATmega328P (Old Bootloader) and upload again. The
one that works stays right for that board. Arduino Uno has one bootloader and
one speed, so the UNO has no Processor row.
Why the IDE does not guess
The IDE recognises an Arduino-made board by the USB chip's maker and product numbers. This board's USB chip is WCH's CH340C, so the IDE sees a serial port and nothing more. The toolbar's board selector shows the port with no board name, and you choose Arduino Uno yourself, once; the IDE remembers the pair.
The same is true of every board with a CH340, which is why a classroom of them can be told apart only by the port each one gets.
The habit
Never memorise a port name. Unplug the board, open Tools > Port, plug it in, and take the entry that appeared. Every sketch in this book prints the Tools rows for both boards in a comment at its top, so they travel with the file.
When it does not work
The IDE recognises boards by the USB chip's maker, and the CH340C is not an Arduino chip. Nothing is wrong. Choose your board under Tools, Board, Arduino Uno or Arduino Nano, and the IDE keeps the pair for next time.
Something answered the port that was not this board's bootloader, or nothing did. Check that the port is the one that appears when you plug the board in and that Board names your board. On a Nano, set Tools, Processor to ATmega328P (Old Bootloader) and upload again: we have not checked which bootloader this Nano ships with, so this is the thing to try, not a rule. Then unplug anything wired to pins 0 and 1.
A board half seated in a shield or socket, or turned round, can be fed and loaded by pins it should not be. Unplug the cable, take the board out, seat it again with the power off, and plug in last.
Port names belong to the computer and can change with the USB socket or after a restart. Choose it again from Tools, Port; the board has not changed.
Unplug the board, open Tools, Port and note the list, then plug it in and open the menu again. The new entry is the board. On a Mac, ignore Bluetooth-Incoming-Port; it is not the board.
Blink, the sketch that comes with the IDE, uploaded to the board, and what happens between pressing Upload and the lamp on pin 13 blinking.
Your first upload: Blink →Edit this page — content/books/atmega328p/board-and-port.mdx
Discuss this article
Ask about this page. The answer stays here, on the page it belongs to, for whoever hits the same wall next.