Serial interface resets Arduino

Can anybody explain how to disable this default behavior?

void setup()
{
}

void loop()
{
}
  1. Compile that & upload to Arduino.
  2. Open the serial console window.
  3. Close the serial console window.

At this point my Arduino's default LED (pin 13) flashes continuously, and my loop() is hung.
4. Open the serial console window again.
5. Arduino automatically resets???

If you never open the serial console, this reset will not happen, and loop() will run continuously.

Which Arduino do you have? Many have a jumper you can cut to disable the serial reset, but you must perform a manual reset to program it.

I'm getting this on UNO and MEGA 2560. I see no jumpers on either.

You can test it using this:

void setup
{ Serial.begin(9600);
  Serial.println( "Initialized" );
}

loop()
{
}
  1. Compile & upload.
  2. Open Serial console
  3. Wait for "Initialized" to appear.
  4. Close serial console.
  5. Open console again and you will see "Initialized" appear again, which would not happen unless the Arduino is resetting.

Both can disable the serial reset. On the Uno, the jumper is next to the crytal labelled reset-en.The Mega's is by the two caps, also labelled reset-en. There is a very small trace between the pads. Use an exacto knife or the like to cut that trace.

You can temporarily disable auto reset by putting a 10uf capacitor between the reset pin and ground.

Ok. Found it on the UNO. Looks like my Mega doesn't have one.
Thanks SurferTim.

I think the temp solution will be better for me right now.
Thanks groundfungus.

AxeMurderer:
5. Arduino automatically resets???

If you never open the serial console, this reset will not happen, and loop() will run continuously.

Yes. All of the above is normal operation. I don't know why you would want to disable this default behaviour, and cutting jumpers cannot possibly be a good idea - indeed I would suspect it is a very bad one. I'm not sure I understand your problem, but if you want to turn a "console" on an off while your programme runs continuously, the first thing to do is get a "console". The serial "monitor" isn't one, and never claims to be, but there are plenty around, all for free. I use RealTerm in a laptop connected via bluetooth. No changes to code are required - or the PCB.

All my serial console programs reset the Arduino. PuTTY and Minicom both do. I agree that cutting the trace is not the perfect solution, but if the device is to be permanently installed and no reset is wanted, cutting the trace is the best option for me. I don't mind pressing the reset button when updating software. I wouldn't want to do that with my code test boards. I do like the 10uf cap as a temporary solution.

(groan..) I have to admit that I pressed Post with some trepidation. I was going to say "I prefer RealTerm but I can't remember why". Maybe this was it, but maybe I don't have a problem because, when I use RealTerm, it is via bluetooth.

I think, by the nature of the post, what OP talking about what IS a code test board, and I hope he/she takes reply #7 on board.

Also, I suspect OP is talking about what is seen as a problem now, but won't be seen as one later.

The problem is that if I want to monitor it to see if it is working, and then find it is, and so I don't need to monitor it anymore (until maybe later on), when I close the monitor window it locks up my loop() until the monitor is opened again, at which point it resets everything. Once I open the monitor, unless I leave it open at all times from that point onward, I'm screwed.

AxeMurderer:
The problem is that if I want to monitor it to see if it is working, and then find it is, and so I don't need to monitor it anymore (until maybe later on), when I close the monitor window it locks up my loop() until the monitor is opened again, at which point it resets everything. Once I open the monitor, unless I leave it open at all times from that point onward, I'm screwed.

The program in Reply #2 may illustrate an issue but I can't believe that it is the program you really want to work with.

Post your real program and explain what it does and what you are trying to achieve with the serial monitor.

If you use a USB-TTL cable (aka an FTDI cable) to connect to the PC and just connect Rx, Tx and GND to the Arduino it will not cause a reset.

...R