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

    Serial Port hanging issues in Ubuntu 10.04 with kernel linux-


    I am new to this forum. We were using Ubuntu 10.04 with the linux- and we have customized the kernel for our requirement. We are using serial port rs 232 for communicating the peripherals. It’s basically 4 wires with the only RTS flow control. Couple of days later serial communication failed and Transmitting byte is successful and we are checking whether all the transmitted bytes are send from serial port buffer using below logic and found TIOCSERGETLSR bit never set and every ioct call get success. Even if we try to flush the serial port using tcflush but no success. This issues happening in few systems so for. Once this issue happens we have to reboot the system and same problem happens again with in few day. After these issues happened serial port was not responding. This code was working with Redhat 9 more than 7 years without issues and we have recently updated the system from the Redhat 9 to Ubuntu 10.04.
            do        {
                    ioctl(hanio->fd, TIOCSERGETLSR, &status);
            }while(!(status & TIOCSER_TEMT));
    Find the attachment contains serial port status after hanging. Please advise how to solve this issues!!
    Attached Images Attached Images
    Last edited by atreyu; 01-24-2013 at 01:09 PM. Reason: added CODE tags

  2. #2
    Hello and welcome!

    I am not sure what is going on there, but the first thing that comes to mind is the stty command. You can use it to thoroughly interrogate the serial port settings, as well as set the device to a "sane" or "raw" state.

    # get all settings
    stty -aF /dev/ttyS0
    # set to sane
    stty -F /dev/ttyS0 sane
    # set speed
    stty -F /dev/ttyS0 9600
    There are many parameters you can play with using stty.

  3. #3

    Thanks for the response. Below is our serial port configuration and we try to change many parameters but no success. If we reboot the system then serial port communication get recovers for couple of days and again its getting hanged. In serial port receive side we are checking TIOCSERGETLSR flag set to 1 or not. This flag will be set by the kernel once all the data from the serial port IO buffer sent to the end point. Once this issues happened this flag never set to 1 it always coming 0 and Ioctl call executed successfully ioctl(hanio->fd, TIOCSERGETLSR, &status); .

    stty -aF /dev/ttyS0:-

    speed 19200 baud; rows 0; columns 0; line = 0;
    intr = ^C; quit = ^\; erase = ^?; kill = ^U; eof = ^D; eol = <undef>; eol2 = <undef>; swtch = <undef>; start = ^Q; stop = ^S; susp = ^Z;
    rprnt = ^R; werase = ^W; lnext = ^V; flush = ^O; min = 0; time = 0;
    -parenb -parodd cs8 -hupcl cstopb cread clocal -crtscts
    -ignbrk brkint ignpar -parmrk -inpck -istrip -inlcr -igncr -icrnl -ixon -ixoff -iuclc -ixany -imaxbel -iutf8
    -opost -olcuc -ocrnl -onlcr -onocr -onlret -ofill -ofdel nl0 cr0 tab0 bs0 vt0 ff0
    -isig -icanon iexten -echo echoe echok -echonl -noflsh -xcase -tostop -echoprt echoctl echoke

    So we would like to know whether this issues is happening because of the kernel handling or hardware having some issues. Any help will be greatly appreciated!!

  4. $spacer_open

Posting Permissions

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