Home > Back-end >  Is there a way to completely disable DTR line of serial port in Windows?
Is there a way to completely disable DTR line of serial port in Windows?

Time:06-28

I'm working on Arduino Uno project which requires serial port comminication. On my Arduino board DTR pin of USB-UART chip is used to reboot MCU (It's connected to reset pin through capacitor) and that's what I dont't want it to do. Serial port driver on Windows changes DTR line state when the port is opened (resetting the board) and there is 3 options of fDtrControl in Win32 API:

From Microsoft Docs:

fDtrControl

The DTR (data-terminal-ready) flow control. This member can be one of the following values.

Value Meaning
DTR_CONTROL_DISABLE
0x00
Disables the DTR line when the device is opened and leaves it disabled.
DTR_CONTROL_ENABLE
0x01
Enables the DTR line when the device is opened and leaves it on.
DTR_CONTROL_HANDSHAKE
0x02
Enables DTR handshaking. If handshaking is enabled, it is an error for the application to adjust the line by using the EscapeCommFunction function.

I've tried all of them and using DTR_CONTROL_DISABLE partially helped, resulting in Adruino not rebooting every time the port is opened.

But there's still a problem - when the port gets opened first time after plugging in the cable, Arduino does reboot. Currently I'm looking for a way to change port configuration without opening it, therefore not making Arduino to reboot.

CodePudding user response:

I solved my problem in hardware, connecting pin 13 on Arduino to RESET and setting it HIGH (The lowest resistor I found was 220 ohms and Arduino was still rebooting with it attached as a pullup)

Thanks to @timemage.

  • Related