Serial Port Programming Question

I’m having a problem with an application I’m developing.

I’ve got a PIC microcontroller circuit (motor controller) that I’m communicating with my QNX c++ code. Occasionally the QNX application locks up. I’ll Cntrl-C out, try and restart it and still nothing. If I restart the serial port device driver (devc-ser8250 -b 9600), then it works fine for a while.

My guess is there’s something in my circuit that is sending a bad signal/voltage spike that is locking up the serial port (anything that’s home brewed is usually my first guess). I don’t seem to have this problem with other serial port devices. But the PIC circuit is running fine (still streaming data over the serial port), it’s just that the serial port driver stops, which sounds like a QNX issue.

I’m not sure if it’s a PIC/hardware issue or QNX issue (or both).

So I have a couple of questions:

  1. Any ideas on what sort of communication problem would cause the serial port to lock up (so I can see if there is a problem on the PIC side)?
  2. Alternately, is there a way in the c++ code to check if there is a problem with the driver and restart it?



You don’t provide any details as to the wiring etc, so this is a WAG…

Have you tried looking to see if the port is paged (i.e. stty </dev/serX) ?

It could be that your PIC device is asserting flow control and not de-asserting it.

Or the line is just disconnected and floating…

I won’t say where I have seen that before… ;-)


Thanks rgallen!

The port isn’t paged. Looks like the problem was that the port is set for hardware flow control each time the driver is run, which the PIC doesn’t support.

Disabling hardware flow control seemed to solve the problem.

Thanks again,