I'm not really sure if this a wiring question, a Linux question, or a software question. But I figured General Programming was probably the best place for it.
My OS is still in a pretty basic state. I've been progressing (slowly) using a quick set of routines to dump information out to a "serial port". The main device I use for testing is a Raspberry Pi, which doesn't have a full serial port - just a mini-UART. Basically, no parities or flow control. So I've just had an 8N1 connection, Rx->Tx, Tx->Rx wiring. All good.
I've recently been writing a more complete serial port driver which (on the Pi) commandeers some GPIO pins and adds support for RTS/CTS and XON/XOFF flow control. Works well; happy with that.
However, in the near future I want to support carrier detection and this is where its getting complicated. If hardware flow control is enabled (RTS/CTS) then I want the OS to know if another computer connects to that serial port, and when it disconnects. Essentially, the OS program that is going to use the serial port (when the debugging is removed) needs to reset when the connection to the remote terminal ends.
Since RTS/CTS is used for flow, I thought DTR from the remote computer might go to a DCD pin on the Pi. But on Linux, PuTTY doesn't seem to change the state of DTR when it connects (if RTS/CTS flow control is in use). Note: I'm not sure whether DTR->DCD can even work like that. This seems to be a case of a null-modem connection, but the whole carrier detect thing seems to have been solely designed for modems telling a host computer when a line is available.
I suppose my questions are:
- Can DTR be used to support DCD? Do other terminal packages on Linux/Windows/Mac etc. respond as I need them to? i.e. Using RTS/CTS for flow, and changing the state of DTR when they connect?
- If not, is there a standard way of detecting the presence of another machine in a null-modem situation?
BTW I have a 3.3v USB serial adapter that I'm currently using. If you want to see the pins that it has available - http://i00.i.aliimg.com/wsphoto/v3/1127 ... 2-0-To.jpg
Many thanks.
M