node-serialport icon indicating copy to clipboard operation
node-serialport copied to clipboard

Is there a way to disabled DTR before openning a port

Open AlexandreRouma opened this issue 7 years ago • 14 comments

Hi, I'm trying to connect to an arduino without causing it to reset. The arduino resets when DTR is set to enable. The problem is that whenever you open a port, the lib enables DTR and messes everything up :/

Hope you can help, thanks!

AlexandreRouma avatar Jul 23 '18 00:07 AlexandreRouma

I might be able to to be proven wrong but I think this is an os thing.

On Sun, Jul 22, 2018, 8:15 PM AlexandreRouma [email protected] wrote:

Hi, I'm trying to connect to an arduino without causing it to reset. The arduino resets when DTR is set to enable. The problem is that whenever you open a port, the lib enables DTR and messes everything up :/

Hope you can help, thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/node-serialport/node-serialport/issues/1605, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlbsvCrX8abpiQ_YejtKLQAQnUrssmks5uJRWzgaJpZM4VaNWr .

reconbot avatar Jul 23 '18 01:07 reconbot

I also recall you can disable the drt>reset link physically by cutting a wire on the board.

On Sun, Jul 22, 2018, 9:13 PM Francis Gulotta [email protected] wrote:

I might be able to to be proven wrong but I think this is an os thing.

On Sun, Jul 22, 2018, 8:15 PM AlexandreRouma [email protected] wrote:

Hi, I'm trying to connect to an arduino without causing it to reset. The arduino resets when DTR is set to enable. The problem is that whenever you open a port, the lib enables DTR and messes everything up :/

Hope you can help, thanks!

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/node-serialport/node-serialport/issues/1605, or mute the thread https://github.com/notifications/unsubscribe-auth/AABlbsvCrX8abpiQ_YejtKLQAQnUrssmks5uJRWzgaJpZM4VaNWr .

reconbot avatar Jul 23 '18 01:07 reconbot

I could cut the trace but then it gets annoying to program the arduino :/ And no, it also happens linux. It's written in the description for the port.set() function that DTR is on by default: https://node-serialport.github.io/node-serialport/SerialPort.html#set

Thanks for responding :)

AlexandreRouma avatar Jul 23 '18 01:07 AlexandreRouma

@AlexandreRouma I also have a device that resets when DTR is enabled. The following worked for me:

this.serial.on("open", function () {
    console.log("Serial port opened to device");
    self.serial.set({dtr: false});
});

kjhe11e avatar Aug 16 '18 00:08 kjhe11e

I tried that but sadly, it still sends a short pulse which resets the MCU :/

AlexandreRouma avatar Aug 16 '18 20:08 AlexandreRouma

Hi,

at least on windows platform undocumented "hupcl: false" option works for me with Arduino.

    this.port = new SerialPort(this.serialportName, {
            baudRate: 250000,
            hupcl: false,
            dataBits: 8,
            stopBits: 1,
            parity: "none"
        });

Tuhis avatar Aug 17 '18 01:08 Tuhis

Thanks! Gonna try that. I hope they can bring it to linux cause it's suppose to run on an RPi, but that should be enough for testing!

AlexandreRouma avatar Aug 19 '18 11:08 AlexandreRouma

@kjhe11e tried this on osx, didn't work, causes no data to emit

Seems to be driver dependant on osx and linux

ref http://playground.arduino.cc/Main/DisablingAutoResetOnSerialConnection

tablatronix avatar Aug 19 '18 15:08 tablatronix

This issue has been automatically marked as stale because it has not had recent activity. It will be closed in a week no further activity occurs. Feel free continue the discussion or ask for a never-stale label to keep it open. If this is a support issue, consider sharing it on stack overflow to get more eyes on your problem.

stale[bot] avatar Oct 18 '18 16:10 stale[bot]

Why are labelled issues marked stale, kind of lame

tablatronix avatar Oct 18 '18 23:10 tablatronix

There are a high number of abandoned support issues from people who never finished debugging, which is also kind of lame.

reconbot avatar Oct 19 '18 16:10 reconbot

Hi, on my raspberry pi, I managed to disable DTR, I used the command stty -F /dev/ttyUSB0 -hupcl before running my Node.js script. It work great once, but when I run my Node.js script a second time, the DTR seem to be disabled like before.

lefuturiste avatar Mar 16 '20 14:03 lefuturiste

@lefuturiste what is your goal? Do you want DTR enabled on the second run of the script?

kjhe11e avatar Mar 16 '20 18:03 kjhe11e

@kjhe11e I want DTR to be enabled at every run of the script.

lefuturiste avatar Mar 17 '20 09:03 lefuturiste