Setup running twice

The UNO, Nano, and several other Arduino boards will often reset when the serial port is opened. Depending on the board, IDE, and operating system, you may see one or even two resets. This behavior is related to the auto-reset circuitry and the USB interface.

My usual solution is to add a two-second delay immediately after Serial.begin(), which is typically the first line in setup(). In most cases, this allows the reset sequence to complete before the rest of the program starts.

Some users disable or modify the auto-reset circuit, often by adding a capacitor, but I generally just let the board reset. The two-second delay also makes it easier to recover if I accidentally flood the serial port with output.

Linux Mint 22.3
Arduino IDE 2.3.8
Arduino Uno clone
Serial Monitor already open, time stamps on.
After uploading I see this.
It does print almost twice!

Looks like an IDE bug.

That must be a very old bug :wink:

I did test the setup with IDE 1.8.19 on Manjaro Linux and had the same result as pommie.

Testing under Windows 11 I get the expected result for a (clone) Nano and I get a row of blocks first when using an original Mega.

Seems so.
I think over the years I have learned to just ignore it and forgot it was even there.

Did not seem like it was worth spending time on trying to debug.

One side effect is that opening the Serial Monitor may also reset the board. In my experience, this is not always true. Generally, the behavior is not caused by the IDE sending a special reset command. It is the result of opening the serial port and toggling DTR, which may also cause the computer to re-enumerate the USB device, sometimes resulting in a different port assignment.

The capacitor modification holds the reset line in a state that prevents the auto-reset pulse, so the host does not see the disconnect/reconnect sequence that triggers re-enumeration.

I have observed this behavior since Arduino IDE 1.0, around 2012, when I was using Linux Mint 12 Lisa with the Cinnamon 1.2 desktop.

So it's an IDE bug that resets the board twice.

the link i posted said on some boards the serial interface DTR (data terminal ready) pin causes a reset. There's not specific command from the IDE to reset the board.

there may be ways over a serial USB interface for a laptop to control individual serial interface pins, but it seems odd that it would do something > half sec after connecting to the board to reset it.

image

My apologies for not replying earlier, I had a computer problem. However, it looks like things have progressed (on here) and maybe my problem isn't just me. I'm currently installing the latest version of mint and will let you know if that fixes anything. It's a slow process. Time to reboot, wish me luck.

Seems to have worked alright, just running update/upgrade and will report back later.

It appears to be fine however I now have a different problem I've downloaded the file arduino-ide_2.3.10_Linux_64bit.AppImage and run it but I don't have an item under the menu that is programming and the only way to get the program back is by running the AppImage file again. Is this an Arduino or Linux bug or me?

Downloaded from https://www.arduino.cc/en/software/

It's different because all the other threads are closed and not postable(is that a word) to.

I was replying to this post in my previous post.

It's you.
That is how appimages work. I just moved mine to the desktop and launch it from there.

You need to explain that more. I moved the file to the desktop and ran it there with the same result.

Help.

Is there a difference between running and launching? If so, how do I launch?

Don't know. I guess I could have said run.
Not a linux expert.

So you no longer have the setup running twice problem?

[quote="jim-p, post:37, topic:1451712"]
So you no longer have the setup running twice problem?
[/quote]I don't know as i can't install it.

Think I'll try vscode as that appears to be an alternative path as I appear to have reached a dead end here.

I followed these instructions
https://docs.arduino.cc/software/ide-v2/tutorials/getting-started/ide-v2-downloading-and-installing/

Had no problems.