Description
Describe the problem
Because the USB communication with the user's computer is handled directly by the primary microcontroller (rather than a separate chip as on the Uno, Mega, etc.), a special process is used when uploading to the native USB boards:
- IDE (actually Arduino CLI under the hood) momentarily opens a serial connection to the board (AKA "touch") at 1200 bps as a signal to the board that it should go into bootloader mode.
- Board switches from application into bootloader mode, which causes its CDC serial port to disappear for a short time.
- IDE waits for a new port to appear.
This port (which might be different from the one the board had previously) will be used for the upload. - If no new port appears after some time, the IDE proceeds. The port the board had previously will be used for the upload.
- IDE uploads the sketch to the board
🐛 If Serial Monitor or Serial Plotter is open during the upload, the "1200 bps touch" does not go through, the board stays in application mode, the IDE never sees the new port appear, the IDE attempts to upload to the board which does not have the bootloader running, the upload fails.
To reproduce
Equipment
Any native USB type Arduino board. Including:
- Leonardo
- Micro
- Yun, Yun Rev2
- MKR
- Nano 33 IoT
- Zero (use the "Native USB" port)
- Portenta H7
- Nano 33 BLE
- Nano 33 RP2040
- Due (use either port)
- 101
Steps
- Connect the board to your computer.
- Select the board and port in the Arduino IDE.
- Open the Serial Monitor view.
- Attempt to upload a sketch to the board.
🐛 The upload fails.
If you have Show verbose output during > ☐ upload enabled in the IDE preferences, you will see something like this in the Output panel:
Performing 1200-bps touch reset on serial port COM31
Waiting for upload port...
No upload port found, using address:"COM31" label:"COM31" protocol:"serial" protocol_label:"Serial Port (USB)" as fallback
Expected behavior
Serial Monitor does not interfere with uploads.
Arduino IDE version
2.0.0-rc7
Operating system
Windows
Operating system version
10
Additional context
I have not been able to reproduce this on my Linux machine, so it may be Windows-specific.
I bisected the issue to df8658e (does not occur when using the build for 4c55807).
The issue also affects the Nano Every. Even though this is not a native USB board, it still uses the "1200 bps touch" feature.
Uploading works fine once I close the Serial Monitor view.
Uploading does succeed with Serial Monitor open if I manually put the board into bootloader mode before the upload (e.g., press the reset button twice on most boards).
Arduino IDE 1.x handles uploading under these conditions as expected.
Issue checklist
- I searched for previous reports in the issue tracker
- I verified the problem still occurs when using the latest nightly build
- My report contains all necessary details