grb
June 4, 2025, 11:50pm
5
Edited to Clarify: The bug referenced below does not apply the the Arduino Nano, so it wouldn't explain the behavior observed by the OP. Nonetheless, I am leaving this comment up, in case someone with an affected board (Arduino Uno, Arduino Uno Mini, Arduino Mega) comes across this thread by forum search.
What you're observing could be due to a known bug:
opened 08:23AM - 24 Mar 22 UTC
topic: code
type: imperfection
topic: CLI
topic: serial monitor
criticality: low
### Describe the problem
The first output printed to Serial Monitor after an up… load is some "garbage" characters.

### To reproduce
#### Equipment
- Arduino board that uses the ATmega16U2 USB chip:
- Arduino Uno
- Arduino Uno Mini
- Arduino Mega
#### Steps
1. Upload a sketch to your board that prints to `Serial`:
```cpp
void setup() {
Serial.begin(9600);
Serial.println("hello world");
}
void loop() {}
```
1. Open the "**Serial Monitor**" view.
🐛 The output starts with some unexpected content:
```text
□□□□□□□□□□□hello world
```
### Expected behavior
Serial monitor output always reflects the data sent by the board.
### Arduino IDE version
#### Original report
2.0.0-rc5-snapshot-4de7737
#### Last verified with
c3adde5
### Operating system
Windows
### Operating system version
- 10
- 11
### Additional context
The number of `□` in the demonstration matches the number of characters that are printed by the sketch.
---
The spurious output does not occur when the output is triggered by resetting the board, so it is specific to the upload operation.
---
The issue does not occur when using Arduino IDE 1.x
---
I have only been able to reproduce this issue with the Arduino boards that use an ATmega16U2 USB to serial adapter chip.
I could not reproduce it when using boards with other USB interfaces:
- Native USB (Leonardo, Nano 33 IoT)
- FTDI FT232R (Nano, Pro Mini)
- WCH CH340 (3rd party boards)
---
Originally reported at https://forum.arduino.cc/t/serial-monitor-contains-garbage-after-upload/972312
#### Additional reports
- https://forum.arduino.cc/t/serial-monitor-confusion/1111552
- https://forum.arduino.cc/t/serial-monitor-prints-boxes-when-opened/1102169
- https://forum.arduino.cc/t/boxes-before-0-in-serial-monitor/1126046
- https://forum.arduino.cc/t/2-1-1-spits-out-garbage-to-serial-monitor-then-proper-output/1152950
- https://forum.arduino.cc/t/ide-2-adruino-uno-serial-monitor-prints-garbage-when-sketch-starts/1299299
- https://forum.arduino.cc/t/squares-appearing-in-serial-monitor/1300361
#### Related
- https://forum.arduino.cc/t/documentation-should-warn-of-incompatible-built-in-examples-e-g-asciitable/1364124
<a name="workaround"></a>
#### Workaround
Add a delay before the first `Serial.print` (etc.) call:
```cpp
void setup() {
Serial.begin(9600);
delay(2000);
}
void loop() {
Serial.println("hello");
delay(1000);
}
```
---
**ⓘ** The choice of 2000 ms for the delay in the snippet above is somewhat arbitrary. You might find that a shorter delay will also serve (1000 ms works for me). Or you might even find that 2000 ms is not sufficiently long. You can do some experimentation to determine the shortest delay that will reliably prevent the garbage output on your system.
---
### Issue checklist
- [X] I searched for previous reports in [the issue tracker](https://github.com/arduino/arduino-ide/issues?q=)
- [X] I verified the problem still occurs when using the latest [nightly build](https://github.com/arduino/arduino-ide#nightly-builds)
- [X] My report contains all necessary details
The available work-arounds if you are affected by this bug are to do one of the following:
Insert a 1–2 second delay immediately after the Serial.begin() command in your code.
After uploading your code, quickly press the board's Reset button once.