Closed chris-ricketts closed 2 years ago
What are you disconnecting from what when "the terminal disconnects"? Are you disconnecting the USB cable or something else that's plugged into your microcontroller?
Apologies for being ambiguous.
By a terminal, I mean a program on the host that has opened the serial port. For example, I am testing with screen /dev/ttyACM0 115200
.
By disconnecting, I mean the program closing the serial port. E.g. ending that screen
session but not unplugging the USB device.
The NRF52840 is going to be in a dongle form so it will always be plugged in with the SerialPort setup.
Closing as this as it is dependent on the program opening the serial port on the host. Testing with PuTTY the DTR flag is reset as expected when the session is closed.
On Linux that might also be dependent on your terminal settings. You can probably get Linux to do the same with stty
or such.
Hi, I'm using
usbd-serial
on the NordicSemi NRF52840 and it's working pretty well.To detect when there is a terminal connected on the host I use the
SerialPort::dtr
function so the buffer is not filled with stale data. This works well but the flag is not reset when the terminal disconnects. I make sure to poll the device between checking the flag. Is this behavior expected?If so, do you know of another way to detect the terminal disconnecting?