Find the answer to your Linux question:
Results 1 to 4 of 4
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    Serial port, how to detect or revocer from parity error?


    Hello,

    I have a app using serial port to comunicate with specific hardware.

    Conf. of serial port:

    Code:
    attr.c_iflag &= ~(IGNBRK | BRKINT | ICRNL | INLCR | PARMRK | INPCK | ISTRIP | IXON | IXOFF | IXANY);
    attr.c_oflag = 0;
    attr.c_lflag &= ~(ECHO | ECHONL | ICANON | IEXTEN | ISIG);
    attr.c_cflag &= ~(CSIZE);
    attr.c_cflag |= PARENB; // Parity enable
    attr.c_cflag &= ~PARODD; // Turn off odd parity = even
    attr.c_cflag |= CS8;
    At the beginning, app works fine for weeks, but suddenly, I don't known when, app don't receive data but it can send it.

    I suppose that it is a parity error, but I don't known how to detect it or how to reset it.

    any advice?

    best regards.

  2. #2
    Linux Guru Rubberman's Avatar
    Join Date
    Apr 2009
    Location
    I can be found either 40 miles west of Chicago, in Chicago, or in a galaxy far, far away.
    Posts
    14,038
    Have you looked in the log files (found in /var/log) for serial port errors? Until you know what is happening, it is not possible to advise you appropriately. FWIW, if you are a programmer, you can trap those errors, and when they occur you can reset the port to a sane state. It may be a parity error, and then it may be something else, such as a buffer overflow. What exactly is happening is critical to know.
    Sometimes, real fast is almost as good as real time.
    Just remember, Semper Gumbi - always be flexible!

  3. #3
    Hello Rubberman,

    I have this information but I don't understand it.

    cat /proc/tty/driver/serial

    serinfo:1.0 driver revision:
    0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
    1: uart:16550A port:000002F8 irq:3 tx:162 rx:379 fe:4 pe:104 DTR

    What is the mean of FE and PE? frame error and parity error?

    In /var/logs there isn't any error information about serial port.
    Last edited by webquinty; 10-21-2015 at 02:52 PM.

  4. $spacer_open
    $spacer_close
  5. #4
    -->
    Quote Originally Posted by webquinty View Post
    Hello Rubberman,

    I have this information but I don't understand it.

    cat /proc/tty/driver/serial

    serinfo:1.0 driver revision:
    0: uart:16550A port:000003F8 irq:4 tx:0 rx:0
    1: uart:16550A port:000002F8 irq:3 tx:162 rx:379 fe:4 pe:104 DTR

    What is the mean of FE and PE? frame error and parity error?

    In /var/logs there isn't any error information about serial port.
    Yes indeed, pe is parity errors and fe is framing errors.

    Usually those are hardware related. They would be on your receive data. You need to determine whether the errors are being produced by your uart or are they being sent to you.

    Minicom is a good program to use for testing out serial ports. I don't remember whether the uart can be put into loopback mode but if it can that would be the first thing that I would do. Then send a bunch of data and see if the errors show up. Then put your modem into loopback and do the same test.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •