Description
Describe the problem
The Arduino boards platform framework allows pluggable monitor port settings to be configured via properties in the board definition:
https://arduino.github.io/arduino-cli/dev/platform-specification/#port-configuration
🐛 When Arduino IDE sends the monitor open request message, it passes an apparently hard coded complete port configuration, overriding any custom port settings from the board definition.
To reproduce
Equipment
A board that has an auto-reset circuit that causes the board to reset when its port's DTR or RTS control signal is asserted:
ⓘ The scope of the bug is not limited to these boards only, but this set was selected for use in the demo.
Demo
- Select File > Quit (or Arduino > Quit Arduino for macOS users) from the Arduino IDE menus if it is running.
All Arduino IDE windows will close. - Open any text editor.
- Add the following text to a new text file in the editor:
uno.monitor_port.serial.rts=off uno.monitor_port.serial.dtr=off unomini.monitor_port.serial.rts=off unomini.monitor_port.serial.dtr=off nano.monitor_port.serial.rts=off nano.monitor_port.serial.dtr=off mega.monitor_port.serial.rts=off mega.monitor_port.serial.dtr=off
- Save the file with the filename
boards.local.txt
in the following location:- If you are using Linux:
(Where
/home/<username>/.arduino15/packages/arduino/hardware/avr/1.8.6/boards.local.txt
<username>
is your Linux username)
❗ The.arduino15
folder may be hidden by default in your file manager and terminal. - If you are using macOS:
(Where
/Users/<username>/Library/Arduino15/packages/arduino/hardware/avr/1.8.6/boards.local.txt
<username>
is your macOS username)
❗ TheLibrary
folder is hidden by default. You can make it visible by pressing the Command+Shift+. keyboard shortcut. - If you are using Windows:
(Where
C:\Users\<username>\AppData\Local\Arduino15\packages\arduino\hardware\avr\1.8.6\boards.local.txt
<username>
is your Windows username)
❗ If looking for it with your file manager or command line, note that theAppData
folder is hidden by default. On Windows "File Explorer", you can make it visible by opening the "View" menu, then checking the box next to "☐ Hidden items".
- If you are using Linux:
- Start Arduino IDE.
- Connect the Arduino board to your computer with a USB cable.
- Select the appropriate board and port from the Arduino IDE menus.
- If Serial Monitor is running, select Tools > Serial Monitor from the Arduino IDE menus to close it.
- Upload the following sketch to the board:
void setup() { Serial.begin(9600); delay(500); Serial.println("setup"); } void loop() { Serial.println("loop"); delay(1000); }
- Wait for the upload to finish.
- Wait a few more seconds to allow the program to run on the board for a while.
- Select Tools > Serial Monitor from the Arduino IDE menus.
🐛 The board is reset, resulting in "setup
" being printed to Serial Monitor before the "loop
" starts being printed.
This reset would not have occurred if the pluggable monitor port settings from the board definition had been honored, and thus we expect to only see "loop
" in Serial Monitor (since the program has been running for some seconds before Serial Monitor was opened).
Clean up
Delete the boards.local.txt
file you created.
Expected behavior
Arduino IDE only controls the Monitor's baudrate
port setting (according to the menu selection in the Serial Monitor GUI). The platform framework provides all other port settings (either via the defaults or custom settings from the board definition).
Arduino IDE version
Original report
2.3.2
Last verified with
Operating system
Windows
Operating system version
Win11 Home
Additional context
The fault does not occur when I use arduino-cli monitor
or the cc.arduino.cli.commands.v1.ArduinoCoreService.Monitor
request directly, specifying only the baudrate
port setting.
When I enable the arduino.cli.daemon.debug
advanced setting, I see that Arduino IDE sends a cc.arduino.cli.commands.v1.ArduinoCoreService.EnumerateMonitorPortSettings
request, and the response contains the customized rts
and dtr
port setting values (off
):
2024-09-11 21:42:57 2024-09-12T04:42:57.095Z daemon INFO 41 CALLED: /cc.arduino.cli.commands.v1.ArduinoCoreService/EnumerateMonitorPortSettings
41 | REQ: {
41 | "instance": {
41 | "id": 1
41 | },
41 | "port_protocol": "serial",
41 | "fqbn": "arduino:avr:uno"
41 | }
41 | RESP: {
41 | "settings": [
41 | {
41 | "setting_id": "dtr",
41 | "label": "DTR",
41 | "type": "enum",
41 | "enum_values": [
41 | "on",
41 | "off"
41 | ],
41 | "value": "off"
41 | },
41 | {
41 | "setting_id": "parity",
41 | "label": "Parity",
41 | "type": "enum",
41 | "enum_values": [
41 | "none",
41 | "even",
41 | "odd",
41 | "mark",
41 | "space"
41 | ],
41 | "value": "none"
41 | },
41 | {
41 | "setting_id": "rts",
41 | "label": "RTS",
41 | "type": "enum",
41 | "enum_values": [
41 | "on",
41 | "off"
41 | ],
41 | "value": "off"
41 | },
41 | {
41 | "setting_id": "stop_bits",
41 | "label": "Stop bits",
41 | "type": "enum",
41 | "enum_values": [
41 | "1",
41 | "1.5",
41 | "2"
41 | ],
41 | "value": "1"
41 | },
41 | {
41 | "setting_id": "baudrate",
41 | "label": "Baudrate",
41 | "type": "enum",
41 | "enum_values": [
41 | "300",
41 | "600",
41 | "750",
41 | "1200",
41 | "2400",
41 | "4800",
41 | "9600",
41 | "19200",
41 | "31250",
41 | "38400",
41 | "57600",
41 | "74880",
41 | "115200",
41 | "230400",
41 | "250000",
41 | "460800",
41 | "500000",
41 | "921600",
41 | "1000000",
41 | "2000000"
41 | ],
41 | "value": "9600"
41 | },
41 | {
41 | "setting_id": "bits",
41 | "label": "Data bits",
41 | "type": "enum",
41 | "enum_values": [
41 | "5",
41 | "6",
41 | "7",
41 | "8",
41 | "9"
41 | ],
41 | "value": "8"
41 | }
41 | ]
41 | }
41 CALL END
(note the value of the rts
and dtr
settings is off
)
But then that data is not used in the full configuration that is passed in the subsequent monitor open request message:
2024-09-11 21:42:57 2024-09-12T04:42:57.113Z daemon INFO 42 CALLED: /cc.arduino.cli.commands.v1.ArduinoCoreService/Monitor STREAM_REQ STREAM_RESP
2024-09-11 21:42:57 2024-09-12T04:42:57.113Z daemon INFO 42 | REQ: {
42 | "Message": {
42 | "OpenRequest": {
42 | "instance": {
42 | "id": 1
42 | },
42 | "port": {
42 | "address": "COM17",
42 | "protocol": "serial"
42 | },
42 | "fqbn": "arduino:avr:uno",
42 | "port_configuration": {
42 | "settings": [
42 | {
42 | "setting_id": "dtr",
42 | "value": "on"
42 | },
42 | {
42 | "setting_id": "parity",
42 | "value": "none"
42 | },
42 | {
42 | "setting_id": "rts",
42 | "value": "on"
42 | },
42 | {
42 | "setting_id": "stop_bits",
42 | "value": "1"
42 | },
42 | {
42 | "setting_id": "baudrate",
42 | "value": "9600"
42 | },
42 | {
42 | "setting_id": "bits",
42 | "value": "8"
42 | }
42 | ]
42 | }
42 | }
42 | }
42 | }
2024-09-11 21:42:57 2024-09-12T04:42:57.129Z daemon INFO 42 | RESP: {
42 | "Message": {
42 | "Success": true
42 | }
42 | }
(note the value of the rts
and dtr
settings is on
)
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