有没有办法完全禁用Windows中串行端口的DTR线?
我正在从事Arduino Uno项目,该项目需要串行端口交汇处。在我的Arduino板上,USB-UART芯片的DTR PIN用于重新启动MCU(通过电容器连接到重置引脚),这就是我不希望它做的。 Windows上的串行端口驱动程序在打开端口时(重置板)时DTR行状态DTR线状态,并且在Win32 API中有3个选项:fdtrcontrol
:
from
fdtrcontrol
DTR(数据末端就绪)流量控制。这个成员可以是 以下值。
value 含义 dtr_control_disable
0x00打开设备并将其禁用时禁用DTR线。 dtr_control_enable
0x01在打开设备并将其放在设备上时启用DTR线。 dtr_control_handshake
0x02启用DTR握手。如果启用了握手,则该应用程序是使用EscapeCommfunction函数调整线路的错误。
我已经尝试了所有这些,并使用dtr_control_disable
部分帮助,导致每次打开端口时都不会重新启动Adruino。
但是仍然存在问题 - 当端口插入电缆后,端口首次打开时,Arduino确实重新启动。目前,我正在寻找一种不打开端口配置的方法,因此不会使Arduino重新启动。
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
0x00Disables the DTR line when the device is opened and leaves it disabled. DTR_CONTROL_ENABLE
0x01Enables the DTR line when the device is opened and leaves it on. DTR_CONTROL_HANDSHAKE
0x02Enables 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.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我解决了硬件中的问题,将Arduino上的引脚13连接到重置并将其设置高(我发现的最低电阻器是220欧姆,而Arduino仍在将其连接为引体向上)
。
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.