Author Topic: Arduino Serial Monitor - Reset  (Read 6957 times)

0 Members and 1 Guest are viewing this topic.

Offline picandmixTopic starter

  • Frequent Contributor
  • **
  • Posts: 395
  • Country: gb
Arduino Serial Monitor - Reset
« on: May 06, 2017, 10:10:00 am »
Hi,

When using the Arduinos Serial Monitor with the Arduino IDE and a Uno to just send Out basic text , if the serial monitor is closed down then opened again, it causes the program in the chip to restart from the beginning, which I gather is normal.

Using the same program code but instead connecting the serial /usb output to an independent terminal like Putty or Teraterm  on the PC, it does the same thing ?

How / why do these  terminal programs cause the Uno to reset  when they are only receiving data ?

Is there any parameter I can change in Putty /TeraTerm to stop this happening  eg I just want to occasionally view the Unos output , not monitor it all the time.
 

Offline FreddyVictor

  • Regular Contributor
  • *
  • Posts: 164
  • Country: gb
Re: Arduino Serial Monitor - Reset
« Reply #1 on: May 06, 2017, 12:14:27 pm »
Hi,

When using the Arduinos Serial Monitor with the Arduino IDE and a Uno to just send Out basic text , if the serial monitor is closed down then opened again, it causes the program in the chip to restart from the beginning, which I gather is normal.

Using the same program code but instead connecting the serial /usb output to an independent terminal like Putty or Teraterm  on the PC, it does the same thing ?

How / why do these  terminal programs cause the Uno to reset  when they are only receiving data ?

Is there any parameter I can change in Putty /TeraTerm to stop this happening  eg I just want to occasionally view the Unos output , not monitor it all the time.
The typical serial connection has some other wires apart from the TX & Rx data, one being the DTR (opposite end to GND on a serial breakout board).
This wire gets signalled on a serial connection and on Arduino is connected to the uC RESET.

On UNO, things are not exactly as above since there is a 2nd ATMega used for the serial, but the principle is the same.

Looking at Sparkfun Uno R3 board, there is a 'RESET EN' jumper which is shorted by a trace and allows the reset to happen.
You can - using a knife - cut through the track between the jumper breaking it, then solder/un-solder it when required or not.
Note though that when flashing from the IDE, the board must be reset somehow, so having the jumper disconnected will require the user to reboot it by pressing the reset button on the board at the appropriate time - so really not ideal!
Could do with a proper pinheader jumper fitted ....

I have yet to see any setting that stops the sending of the DTR signal from the host side, but there may be one
I'm guessing it's probably something to do with the driver rather than the serial terminal being used

You can ofcourse get another serial breakout board and then connect its Rx (plus a Gnd) to the boards Tx (D1) header so you can then see the serial output.
Opening/connecting/closing this won't cause any resets
 
The following users thanked this post: picandmix

Offline Seekonk

  • Super Contributor
  • ***
  • Posts: 1938
  • Country: us
Re: Arduino Serial Monitor - Reset
« Reply #2 on: May 06, 2017, 12:31:35 pm »
That is annoying. I found somewhere that you can keep it from resetting from a USB connect if you put a 10uf or higher on the reset pin. Keep it removable because you will not be able to upload new programs with it in place.
 
The following users thanked this post: picandmix

Online Ian.M

  • Super Contributor
  • ***
  • Posts: 12855
Re: Arduino Serial Monitor - Reset
« Reply #3 on: May 06, 2017, 12:41:11 pm »
The reset signal is capacitively coupled to the ATmega328P (with a pullup resistor) so any low going transition on the handshake line resets the MCU, but if the line is low it isn't held in reset.

There's a bodge that will work - If you plug a >1uF capacitor into the header between Reset and Gnd (negative side to Gnd if electrolytic), it forms a capacitive potential divider with the 100nF reset coupling cap limiting its swing to 0.5V,  preventing the reset pin from going low.   You need to remove the extra cap to program if you don't want to mess with the reset button fumble, and it will reset if you plug it in while powered because the cap's uncharged, but it wont reset when the port's opened/closed or the handshake line's toggled as long as the cap is there.  Keep the cap as small as possible that will do the job as its hard on the manual reset button.

However, smart people cut the reset jumper previously mentioned and wire in an ultra-miniature SPST slide switch or similar. If you use a SMD one you can solder its mounting feet to the side of the USB B connector housing, with a sliver of Kapton tape under its electrical leads so they are isolated from the housing so you can fly-wire the switch back to the pads of the jumper you cut.. 
 
The following users thanked this post: picandmix

Offline tablatronix

  • Regular Contributor
  • *
  • Posts: 199
  • Country: us
Re: Arduino Serial Monitor - Reset
« Reply #4 on: May 06, 2017, 12:45:36 pm »
disable flow control in your terminal, turn off dtr and rts, also I thought that arduino ide bug terminal reset was fixed , maybe it only works for some boards or your boards.txt is different, not sure which reset method the uno uses, but I thought auto reset was fixed.

What ide version you using ?
 
The following users thanked this post: picandmix

Online Buriedcode

  • Super Contributor
  • ***
  • Posts: 1611
  • Country: gb
Re: Arduino Serial Monitor - Reset
« Reply #5 on: May 06, 2017, 01:21:06 pm »
As suggested there are hardware solutions:
https://tushev.org/articles/arduino/22/preventing-arduino-from-auto-reset-when-com-port-opens-closes
http://forum.arduino.cc/index.php?topic=48577.0

But also you can prevent the board resetting by disabling the DTR line/flow control in your terminal software.

I have found that for most 'Arduino' applications (ie: knocking up a quick prototype to test something) the fact it resets when the terminal is opened is an advantage: it can display data sent at the very start (like in the setup routine).  But you're right, for applications where one uses the terminal for occasional monitoring it is irritating.  I would lean towards a hardware solution, even permanent mod on the Arduino board as they  (and their clones) are so cheap.
 
The following users thanked this post: picandmix

Offline TK

  • Super Contributor
  • ***
  • Posts: 1722
  • Country: us
  • I am a Systems Analyst who plays with Electronics
Re: Arduino Serial Monitor - Reset
« Reply #6 on: October 30, 2017, 12:28:43 pm »
If you need the serial monitor output in a permanent basis, you can use a separate USB to TTL cable/adapter and hook it directly to the RX/TX lines and use the incorporated USB port only to program the ATmega328P MCU.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf