Go Down

Topic: Duemilanove Restarts Automatically?! (Read 2833 times) previous topic - next topic

Aby

Hi,

I have got my Duemilanove recenlty. I wrote a simple program to print the data to the Serial Port. The problem is that my program restarts whenever the Serial Moniotr or any such tool is opened(Hyper terminal or any custom application that uses the same COM port).

Steps to reproduce the issue:

Get a Duemilanove which is connected to the PC through USB Cable.

1. Run the given program(below)

2. Open the serial monitor -> you will see the LED goes HIGH and then LOW and then printing values 1, 2, 3 etc

3. Close serial monitor and reopen it

Expected result:
a) Serial Monitor should display the values from somewhere 7 , 8 ,9 and then go on.
b) The LED on pin 13 should not blink.

Actual result:
a)Serial Monitor displays the values AGAIN FROM 1,2,3...
b) LED on13 blinks again.

My questions:
a) is it intented behavior?
b) can I make it NOT to restart my application whenever Serial Monitor(or any app that opens the same COM port) is invoked/ ?



Here is the program that tried with:

int ledpin = 13;
int counter = 0;
void setup()
{
Serial.begin(9600);
digitalWrite(ledpin,HIGH);
delay(100);
digitalWrite(ledpin,LOW);
delay(100);
}
void loop()
{
counter++;
Serial.println(counter);
if(counter >=255)
counter =0;
delay(1000);
}


Nachtwind

this is an intended behavior. It's called Auto-Reset, makes life much easier when uploading.
I dont know how to 'hack' the duemilanove in order to get rid of that, but basically you would have to discunnect the DTR line from the Reset Pin (1) of the Atmel, but uploading would be a matter of patience with that.

You could as well, if this is now a life threatening situation, go for a Seeeduino that has a switch to turn Auto Reset on or off...
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

Aby

ah.. did you mean to say that my program will restart  **whenever ** a serial Monitor or similar program is opened.

retrolefty

Quote
ah.. did you mean to say that my program will restart  **whenever ** a serial Monitor or similar program is opened.


Yes, the opening of a serial monitor or terminal program will activate the DTR control signal, which the Arduino design has wired to the reset pin via a series capacitor. There are a couple of ways to modifiy the board to prevent this action but unless easily undone it can make uploading new sketches difficult as activating the Arduino reset is how the Arduino IDE forces the Arduino to activate the bootloader program on the AVR chip.
And yes, the Seeduino clone design has a switch to activate or deactivate this feature, as well as a switch to force power selection from the USB or external voltage source, also handy at times.

Lefty.

pluggy

#4
Sep 22, 2009, 06:52 pm Last Edit: Sep 22, 2009, 07:01 pm by stephen_t Reason: 1


To disable this feature, take a craft knife and cut the little track between the two solder pads. If you do , you'll need to press reset manually when you upload a sketch.  The solder pads are there so you can re-enable it if you get fed up of losing the auto reset.   :)

If you can disable DTR in your serial terminal, it saves you having to butcher your arduino.  

You could at a push solder some tiny wires to a toggle switch or something to be able to switch it on and off, but it would be easier to buy a seeeduino.
http://pluggy.is-a-geek.com/index.html

retrolefty

#5
Sep 22, 2009, 08:22 pm Last Edit: Sep 22, 2009, 08:24 pm by retrolefty Reason: 1
Quote
You could at a push solder some tiny wires to a toggle switch or something to be able to switch it on and off


Just cut the little trace between the pads then solder a 2 pin male header strip into the pad holes. Then you can slip on a shorting clip when you want the auto reset enabled or remove the clip when you don't want it.

http://www.sparkfun.com/commerce/product_info.php?products_id=9044

http://www.sparkfun.com/commerce/product_info.php?products_id=116

Or get a Seeeduino, they are great.  8-)

Lefty

pluggy

#6
Sep 22, 2009, 10:31 pm Last Edit: Sep 22, 2009, 10:33 pm by stephen_t Reason: 1
Just to thwart your plan RL, there aren't any holes........  :)

Back to the seeeduino.
http://pluggy.is-a-geek.com/index.html

retrolefty

Quote
Just to thwart your plan RL, there aren't any holes........  



Holes?, holes?, we don't need no stinkin holes. Just tack solder the two header pins to the pads.

Or get a Seeeduino, there great.

Lefty

Aby

ah..hard to believe!.. bye the way, is there anything that I can do in the software side to bypass this issue?

And yes..I am running data logger in the board ...so I can no way loose the data!.

Nachtwind

#9
Sep 23, 2009, 09:28 am Last Edit: Sep 23, 2009, 09:31 am by Nachtwind Reason: 1
If possible you could try to 'turn off' DTR in your serial communications.. that'd doable...

the harder way, i havent even thought of before could be using a SoftSerial Library, attaching a com port to it and reading that one..

In the end the best way for you would be either to cut the pads (seems to be easy enough) and bridge them for uploading (as this is easier than the timing game) or get yourself a Seeeduino from nkcelectronics.com (which i would prefer!)


*edit*
Here they were talking about various ways of turning off autoreset as well:
http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1213719666/28
Believe me, Mike, I calculated the odds of this succeeding against the odds I was doing something incredibly stupid[ch8230] and I went ahead

pluggy

Quote
Holes?, holes?, we don't need no stinkin holes. Just tack solder the two header pins to the pads.

Or get a Seeeduino, there great.

Lefty


Well, it could be done, with the right shaped midget soldering iron, very steady hands and seriously better eyesight than mine.



Coo, my Duemilanove looks tatty under extreme closeup.

On the software front, I have a butchered version of this mans Linux communications software :

http://todbot.com/blog/2006/12/06/arduino-serial-c-code-to-talk-to-arduino/

which works without resetting the Duemilanove, it also sets up the comms port so that subsequent reads from bash ( cat /dev/ttyUSB0|tail ) doesn't reset it either. Not much use if you don't use Linux though.

Pity stuff from Seeed studios takes an age to get here..........
http://pluggy.is-a-geek.com/index.html

Aby

Thanks Guys! . It was very helpful. :)

Aby

At last I found a solution from the software side. FYI, I use .Net platform to talk to Serial port. So here is the code which does not restart Arduino .
Serialport sp = new new SerialPort("COM1", 9600, Parity.None);//Paramters does not matter.

_sPort.DtrEnable = false; // ** Here is the Key!

_sPort.Open();

Hope it will be helpful for some one .


Go Up