No announcement yet.

Serial comms - what is error 57?

  • Filter
  • Time
  • Show
Clear All
new posts

  • Serial comms - what is error 57?

    I have an app that reads data from a serial port (9600 or 19200 baud). After running for 1-3 days I get error 57 when reading the port.

    The docs explain error 57 as a hardware related device I/O error. I'd appreciate it if someone could elaborate a bit on what it is and what would be likely to cause it.


  • #2
    As you note, it's most likely a hardware fault, but anything that halts the communications process is likely to cause it.

    For example, line noise could break the connection, the connection becoming desynchronized, the comms driver crashing due to an "unrelated" software problem, the remote end closing the session, a timout occuring, or any number of things going wrong can break the connection or the driver's ability to control the dataflow.

    This is especially true for modem connections because the link is more 'fragile' because there are more places things can go wrong.

    To try to track the cause down, there are a number of steps you can try:

    1. Is the problem consistentand repeatable?

    2. How much data was received/sent before the problem occurred

    3. Have you tried using a "break-out" box to monitor the serial port lines when the error occurs? Maybe a datalogger could help - another PC could be used for this task?

    4. Lets see what the above yeilds before going further.

    PowerBASIC Support
    mailto:[email protected][email protected]</A>
    mailto:[email protected]


    • #3

      Next time I'll just wait for you to answer my question before I post it... What I'm trying to say is that once again the responsiveness is impressive!

      This is a loopback connection: A device simulator is sending data on COM1 and my app is reading it back from COM2 using a null modem cable. I assume you'll agree that the connection itself doesn't get much more stable than that. As I said it's running anywhere between 1 and 3 days before this happens, so watching a break-out box really isn't an option.

      Anyway, you confirmed my suspicions that it doesn't have to be a hardware error when you stated that an "unrelated" software error could trigger it. Knowing that gives me a few hints on what to check. Please allow me to suggest that info like that be included in the error description - makes a world of difference to know that when I'm trying to track down one of these things...

      Thanks for yet another fast & informative reply!