Nick_Pyner:
I believe the serial monitor can be configured not to do this, and there will be suitable instruction on this forum.
You're right that it can be configured. However, this feature was only recently formally documented, so you might not find mention of it on the forum.
I'll provide the link here for anyone who is interested:
https://arduino.github.io/arduino-cli/latest/platform-specification/#serial-monitor-control-signal-configuration
This requires modifying the board definition that is in the boards platform's boards.txt
file.
The naive approach would be to edit that boards.txt
file directly. That will work fine, but the problem is that you would need to redo the modification after every time you updated to a new version of the boards platform. There are a couple of better alternative approaches, which I will describe below. You can pick whichever one of the two is most convenient for you:
"Extension" platform
The Arduino boards platform system has a nice feature where you can reference resources from other installed platforms:
https://arduino.github.io/arduino-cli/latest/platform-specification/#referencing-another-core-variant-or-tool
This allows you to create your own platforms that can be as minimal as a few lines in a single text file.
In this case, your custom platform can consist of a single board definition in a boards.txt
file, which references all other resources from the official "Arduino AVR Boards" platform of the Nano:
nano_no_sm_reset.name=Arduino Nano (disable Serial Monitor reset)
nano_no_sm_reset.upload_port.0.board=nano
nano_no_sm_reset.upload.tool=arduino:avrdude
nano_no_sm_reset.upload.tool.default=arduino:avrdude
nano_no_sm_reset.upload.tool.network=arduino:arduino_ota
nano_no_sm_reset.upload.protocol=arduino
nano_no_sm_reset.bootloader.tool=arduino:avrdude
nano_no_sm_reset.bootloader.tool.default=arduino:avrdude
nano_no_sm_reset.bootloader.unlock_bits=0x3F
nano_no_sm_reset.bootloader.lock_bits=0x0F
nano_no_sm_reset.build.f_cpu=16000000L
nano_no_sm_reset.build.board=AVR_NANO
nano_no_sm_reset.build.core=arduino:arduino
nano_no_sm_reset.build.variant=arduino:eightanaloginputs
## Arduino Nano w/ ATmega328P
## --------------------------
nano_no_sm_reset.menu.cpu.atmega328=ATmega328P
nano_no_sm_reset.menu.cpu.atmega328.upload.maximum_size=30720
nano_no_sm_reset.menu.cpu.atmega328.upload.maximum_data_size=2048
nano_no_sm_reset.menu.cpu.atmega328.upload.speed=115200
nano_no_sm_reset.menu.cpu.atmega328.bootloader.low_fuses=0xFF
nano_no_sm_reset.menu.cpu.atmega328.bootloader.high_fuses=0xDA
nano_no_sm_reset.menu.cpu.atmega328.bootloader.extended_fuses=0xFD
nano_no_sm_reset.menu.cpu.atmega328.bootloader.file=optiboot/optiboot_atmega328.hex
nano_no_sm_reset.menu.cpu.atmega328.build.mcu=atmega328p
## Arduino Nano w/ ATmega328P (old bootloader)
## --------------------------
nano_no_sm_reset.menu.cpu.atmega328old=ATmega328P (Old Bootloader)
nano_no_sm_reset.menu.cpu.atmega328old.upload.maximum_size=30720
nano_no_sm_reset.menu.cpu.atmega328old.upload.maximum_data_size=2048
nano_no_sm_reset.menu.cpu.atmega328old.upload.speed=57600
nano_no_sm_reset.menu.cpu.atmega328old.bootloader.low_fuses=0xFF
nano_no_sm_reset.menu.cpu.atmega328old.bootloader.high_fuses=0xDA
nano_no_sm_reset.menu.cpu.atmega328old.bootloader.extended_fuses=0xFD
nano_no_sm_reset.menu.cpu.atmega328old.bootloader.file=atmega/ATmegaBOOT_168_atmega328.hex
nano_no_sm_reset.menu.cpu.atmega328old.build.mcu=atmega328p
# Don't reset when Serial Monitor is opened
nano_no_sm_reset.serial.disableDTR=true
nano_no_sm_reset.serial.disableRTS=true
## Arduino Nano w/ ATmega168
## -------------------------
nano_no_sm_reset.menu.cpu.atmega168=ATmega168
nano_no_sm_reset.menu.cpu.atmega168.upload.maximum_size=14336
nano_no_sm_reset.menu.cpu.atmega168.upload.maximum_data_size=1024
nano_no_sm_reset.menu.cpu.atmega168.upload.speed=19200
nano_no_sm_reset.menu.cpu.atmega168.bootloader.low_fuses=0xff
nano_no_sm_reset.menu.cpu.atmega168.bootloader.high_fuses=0xdd
nano_no_sm_reset.menu.cpu.atmega168.bootloader.extended_fuses=0xF8
nano_no_sm_reset.menu.cpu.atmega168.bootloader.file=atmega/ATmegaBOOT_168_diecimila.hex
nano_no_sm_reset.menu.cpu.atmega168.build.mcu=atmega168
boards.local.txt
You can make modifications to an existing boards platform without having to edit the files of the platform by putting your modifications in a file named boards.local.txt
and then placing that file in the root of the platform:
https://arduino.github.io/arduino-cli/latest/platform-specification/#boardslocaltxt
# Don't reset when Serial Monitor is opened
nano.serial.disableDTR=true
nano.serial.disableRTS=true
You will still need to replace your boards.local.txt
file after every update you make to the platform. If you save a copy of your boards.local.txt
file in a safe place, this will be as simple as just copying the existing file to the platform folder.