Open per1234 opened 2 years ago
I am seeing similar issues with version 2.0.0-rc6 of the IDE running on macOS 12.3.1 with an Arduino Uno WiFi Rev2 board. If I upload via the IDE, I get mostly garbled output in the Serial Monitor, however, if I upload via the arduino-cli tool, the output is correct whether it is viewed through the screen command or with arduino-cli monitor.
Reopening because the fix has been reverted: https://github.com/arduino/serial-monitor/pull/39
We need to investigate this issue further and find a better solution.
@per1234
I have noticed that the number of characters is equal to the ones printed, but the line ending is missing.
For "hello world" it should be 12 chars, rather than 11 when println()
is used.
I am wild-guessing here, but it could be that on some Windows (not int'l English systems) the character encoding plays a role (ISO-8859-12 vs 8859-1 or other encoding). As I climb the conspiracy theory ladder I might say that how that particular text output view handles the text is to be further investigated.
The flow of operations is as follows, and it causes a chopping of the output printed, but it shouldn't grant the replacement of valid characters with squares.
shortening the string might produce a different output
these are our findings for now
@ubidefeo @per1234 I have the same issue but number of squares is deafferent than number of characters:
I tried switching system, keyboard and regional settings from polish to united states and number of squares was the same. I switched arduino to usb 2.0 and squares disappeared but hello word was printed two time in serial monitor. Before uploading it to arduino and after uploading. The first one has some strange characters in it.
Tried this on my old mac (MacBook Air 13 inch, Early 2015, macOS Monterey 12.6.5) and at the beginning it looked like it was also printing two times in one run but after I ran it twice it worked just fine (printed just once every run without any squares). I supposed something was left in the memory from previous tests.
edit: delay (on windows 10) at the beginning of the setup fixed it for me. It looks like new run catches some data from previous run and it is unable to parse it.
When I change baud to 115200 it is able to parse it and with one run I get two hello worlds
If my analyze is not helpful please delete it. I'm new to arduino and above might be just normal behavior.
I am able to partially replicate this issue on my laptop (Windows 11) with a Arduino Uno with IDE 2.1.1 as well as the latest nightly build
hello world
is printed in the Serial MonitorZoomed in image on the Serial monitor. Red numbers indicate number of boxes. I cannot copy and paste into, the boxes shrink into a single � symbol.
On line 4, the Serial Monitor displays hhello world
. This suggests that the board was going to print hello world
, but then reset before finishing the output. The output is consistent with @ubidefeo 's hypothesis.
The square boxes are more consistent in the nightly build, alternating between 30 and 31
Note: I am using a USB hub to connect the Uno to my laptop.
Describe the problem
The first output printed to Serial Monitor after an upload is some "garbage" characters.
To reproduce
Equipment
Steps
Serial
:🐛 The output starts with some unexpected content:
Expected behavior
Serial monitor output always reflects the data sent by the board.
Arduino IDE version
2.0.0-rc5-snapshot-4de7737
Operating system
Windows
Operating system version
10
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 spurious output still occurs even if you add a delay before the print, so it is not a matter of timing from initialization as is sometimes the cause of corrupted serial output.
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:
Originally reported at https://forum.arduino.cc/t/serial-monitor-contains-garbage-after-upload/972312
Additional reports
Issue checklist