0

Pro Mini Prevent Restart on Serial Read
Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.

Pro Mini Prevent Restart on Serial Read

by user019251 on Thu Aug 22, 2019 2:53 pm

I am working on a project that uses an Arduino Pro Mini to collect data. Readings are totaled and need to be maintained meaning the Arduino should not restart. A computer needs to be connected to read from the serial output periodically. The Arduino is powered by the RAW pin and the FTDI connector has the VCC connector moved. This works great except the Arduino restarts any time the computer tries to read the serial output which causes the Arduino to restart, losing all of the recorded values. How can I prevent the Arduino from restarting but maintain the ability to upload new sketches? The computer will stay connected but may or may not be powered on. It is OK for the board to restart when a sketch is uploaded.

Thanks for any ideas!

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Re: Pro Mini Prevent Restart on Serial Read

by adafruit_support_bill on Thu Aug 22, 2019 5:12 pm

The classic Arduino reset logic is based on the DTR signal from the serial connection. If the computer toggles this at connection time, it pulls the reset pin on the processor low to restart the Arduino. I believe that the Pro Mini uses the same scheme.

Some operating systems allow you to configure this behavior in the COM ports. There are also some hardware solutions. The options are described here:

https://playground.arduino.cc/Main/Disa ... onnection/

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Pro Mini Prevent Restart on Serial Read

by user019251 on Fri Aug 23, 2019 12:07 pm

In Linux is there a way to do this with stty? Will the hupcl option work?

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Re: Pro Mini Prevent Restart on Serial Read

by adafruit_support_bill on Fri Aug 23, 2019 12:30 pm

https://www.tutorialspoint.com/unix_commands/stty.htm

* [-]cdtrdsr
enable DTR/DSR handshaking (disables RTS/CTS), no stty readable form available, has to be supported by device

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Pro Mini Prevent Restart on Serial Read

by user019251 on Fri Aug 23, 2019 6:20 pm

Thanks for the help! I did not see cdtrdsr as an option on stty but the hupcl option appears to be working: https://raspberrypi.stackexchange.com/q ... usb0/79313

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Re: Pro Mini Prevent Restart on Serial Read

by adafruit_support_bill on Sat Aug 24, 2019 7:09 am

Good to hear you found a solution. Thanks for the update.

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Pro Mini Prevent Restart on Serial Read

by user019251 on Sat Aug 24, 2019 6:00 pm

Looks like my solution is not fully working. After restarting the computer, the next time I try reading from the serial port it resets the Arduino. Any other ideas?

Thanks!

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Re: Pro Mini Prevent Restart on Serial Read

by adafruit_support_bill on Sun Aug 25, 2019 8:18 am

You can try one of the hardware solutions mentioned in the Arduino Playground link posted above. An extra pullup resistor from RST to VCC would be a temporary fix. Removing C2 or cutting the trace from the DTR pin would be a more permanent soluiton:

https://cdn-shop.adafruit.com/product-f ... ni-v14.pdf

adafruit_support_bill
 
Posts: 74337
Joined: Sat Feb 07, 2009 10:11 am

Re: Pro Mini Prevent Restart on Serial Read

by user019251 on Mon Aug 26, 2019 10:54 am

Do you know which version of stty you are using that has the option mentioned previously? Would like to try any software options possible first as hardware is not an option as the Arduino will need to be updated and reset remotely periodically.

Also, I noticed after some troubleshooting that the restart seems to be happening on the connection initiated by stty, not on the restart of the computer or the closing of a previous session. I am currently using the following to initiate connection through stty:

Code: Select all | TOGGLE FULL SIZE
stty -F /dev/ttyUSB0 115200 raw -clocal -echo -hupcl -crtscts

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Re: Pro Mini Prevent Restart on Serial Read

by user019251 on Mon Aug 26, 2019 11:45 am

Found this which somewhat explains why cdtrdsr option is not available: http://gnu-coreutils.7620.n7.nabble.com ... 25453.html

Is there another piece of software other than stty that could work for this?

user019251
 
Posts: 10
Joined: Thu Jul 18, 2019 12:13 pm

Please be positive and constructive with your questions and comments.