5

We have a Debian-based embedded device. It runs an application that communicates with other embedded equipment via serial (RS-232, /dev/ttyS*). Usually, this works just fine. But of course, sometimes things go wrong and while our app can still send bytes without errors, nothing comes back from the other side.

Now I would like to be able to distinguish between

  • [A] The serial connection is live/up/established (I know I am probably using inappropriate terminology) in the sense that the other device is receiving our data. But for whatever reason the application on the other device doesn't talk back to us (e.g. because it had crashed).

  • [B] The serial connection is not live/up/established, e.g. because the cable was unplugged or the other device lost power.

Is there a way to do that? (like with an Ethernet connection, where it's really simple to tell whether or not it has link)


Some details:

  • NS16550A chip with serial8250 driver
  • Debian 7 32bit
  • Application is Python 2.7

2 Answers 2

4

No, there is no way to do this. Serial connections are completely stateless, both from an electrical and a software point of view.

1
  • 1
    Yes and No... you can have handshaking with RS-232, even though it's stateless in the sense I think you mean. Feb 23, 2016 at 2:50
3

Just to give a completely contradictory answer... if your software supports it and your connection has more than the bare minimum # of pins, RS-232 connections can have handshaking and flow control. Your app could check for a connection before sending, but it sounds like it doesn't.

2
  • Many devices that don't use hardware flow control still assert DTR so this seems worth a try.
    – PeterJ
    Feb 23, 2016 at 4:00
  • Thank you! I'll read into it and will give it a shot. Oh, while we are talking ... Is it possible that the other side has (unbeknownst to me) RTS/CTS and/or DTR/DSR enabled, while my side has not? Or would comms fail in that scenario? Feb 23, 2016 at 12:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .