Find the answer to your Linux question:
Results 1 to 4 of 4
I have been working on serial port of one embedded linux device. We are managing one controller using serial port. Here is my Serial port settings Code: Baudrate:9600 tio.c_cflag = ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1
    Just Joined! s13884's Avatar
    Join Date
    Apr 2007
    Posts
    28

    Serial Port Read failed but tx/rx increased in /proc/tty/driver/serial


    I have been working on serial port of one embedded linux device. We are managing one controller using serial port.

    Here is my Serial port settings
    Code:
    Baudrate:9600
        tio.c_cflag = BAUDRATE | CS8 | CLOCAL | CREAD | CRTSCTS;
        tio.c_iflag = IGNPAR;
        tio.c_oflag = 0;
        tio.c_lflag = 0;
    
        tio.c_cc[VTIME]    = 0;   
        tio.c_cc[VMIN]     = 1;

    Here is the data I am writing on Serial port
    Code:
    FEFF280100812000210000110000000000000000000000000000000000000000000000000000000000FCEF
    If the controller received above data correctly than it should return "feff0520000227ef".

    It returns 8 bytes when we write the 43 bytes.

    Here is the output of tx/rx

    Code:
    root@5_15_60_0:~# cat /proc/tty/driver/serial
    serinfo:1.0 driver revision:
    0: uart:16550A mmio:0x18020000 irq:11 tx:257 rx:29 brk:6 RTS|CTS|DTR|DSR|CD
    
    root@5_15_60_0:~# cat /proc/tty/driver/serial
    serinfo:1.0 driver revision:
    0: uart:16550A mmio:0x18020000 irq:11 tx:300 rx:37 brk:6 RTS|CTS|DTR|DSR|CD
    
    root@5_15_60_0:~# cat /proc/tty/driver/serial
    serinfo:1.0 driver revision:
    0: uart:16550A mmio:0x18020000 irq:11 tx:343 rx:45 brk:6 RTS|CTS|DTR|DSR|CD
    
    root@5_15_60_0:~# cat /proc/tty/driver/serial
    serinfo:1.0 driver revision:
    0: uart:16550A mmio:0x18020000 irq:11 tx:386 rx:53 brk:6 RTS|CTS|DTR|DSR|CD
    It says 0 bytes in input buffer when run IOCTL command FIONREAD but I can see the value of tx and rx values are increasing as expected. Also unable to read the bytes.

    I have removed following line from /etc/inittab file
    Code:
    ttyS0::askfirst:/bin/ash --login
    Also removed the console=ttyS0 from bootargs.


    So anyone please guide me to resolve the same? Can anyone point out the something to resolve this issue?
    Last edited by atreyu; 04-23-2014 at 02:24 AM. Reason: added CODE tags to aid in readability

  2. #2
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    hi,

    have you tried playing around with the stty command? It will get/set print just about any serial setting you can think of, and sometimes the "sane" command brings a port back from the dead for me.

  3. #3
    Just Joined! s13884's Avatar
    Join Date
    Apr 2007
    Posts
    28
    Hi,
    Actually, it didn't have the stty command installed on it. I have compiled and installed on it. I did check the configurtion and its correct for non-canonical mode.

    I have disabled the kernel console from boot arguments and it works.
    e.g. "console=null" instead of console=ttyS0,115200 and able to read the received bytes. It was redirecting on console so read failed.

    So just disable console set it to null it should works.

  4. $spacer_open
    $spacer_close
  5. #4
    Trusted Penguin
    Join Date
    May 2011
    Posts
    4,353
    Quote Originally Posted by s13884 View Post
    So just disable console set it to null it should works.
    i figured when you said

    Quote Originally Posted by s13884
    Also removed the console=ttyS0 from bootargs.
    that it should have freed up the serial port. i've never had to do console=null myself, but hey, if it works, that's what matters.

    glad you got it sorted.

Posting Permissions

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