disable auto-reset by serial connection

Hi,

I have researched this issue a bit on Linux and Windows. I have been able to get a client program (written in C++) to connect and disconnect to my Arduino Diecimila without causing a reset.

The solution lies in proper setup of the serial connection, and requires no extra hardware or hardware modification. You hust have to disable HUPCL on linux and DTR on Windows

On Linux you typically call tcsetattr
Before you call it you set

termios mode;
::memset(&mode,0,sizeof( mode));
tcgetattr(m_fd,& mode);
... other settings here
mode.c_cflag &= ~HUPCL; // disable hang-up-on-close to avoid reset
tcsetattr(m_fd,TCSANOW,&mode)

On Windows

DCB dcb;
GetCommState(m_hCom, &dcb);
... other settings here
dcb.fDtrControl = DTR_CONTROL_DISABLE; // disable DTR to avoid reset
SetCommState(m_hCom, &dcb);
Then do NOT call EscapeCommFunction(...) or anything like that to set DTR later

With these settings I have it working for both Windows and Linux, I can connect as many times as I wish without causing a reset of the board.

1 Like