How do I access the UART pins on 40-pin GP bus?

mchau
mchau New Member Posts: 1

I follow the instruction on the wiki to install ubuntu and updated the kernel on Up Squared

    $  uname -a
    Linux *****  4.15.0-37-generic #40~upboard03-Ubuntu SMP Wed Dec 12 16:21:24 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

I use a jumper cable to connect pin 8 and pin 10 and follow the instruction on the UP2 pinout wiki and see that my UART node is ttyS5.

    $ ls /sys/bus/pci/devices/0000\:00\:18.?/dw-apb-uart.*/tty/ | grep tty
    /sys/bus/pci/devices/0000:00:18.0/dw-apb-uart.8/tty/:
    ttyS4
    /sys/bus/pci/devices/0000:00:18.1/dw-apb-uart.9/tty/:
    ttyS5

then I do a simple read-write. It will just hang at the cat command.

    $ echo "hello world" > /dev/ttyS5
    $ cat -v < /dev/ttyS5 

Am I missing some steps to get the UART pins working?

Here are some additional information on the things I tried:

    $ stty -F /dev/ttyS5 -a
    speed 9600 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; discard = ^O; min = 1; time = 0;
    -parenb -parodd -cmspar 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 -flusho -extproc

running linux-serial-test as suggest by another UART post:

    $ ./linux-serial-test -s -e -p /dev/ttyS5 -b 9600
    Linux serial test app
    Error setting RS-232 mode: Inappropriate ioctl for device
    No data received for 2.0s. No data transmitted for 2.0s.
    No data received for 3.0s. No data transmitted for 3.0s.
    No data received for 4.0s. No data transmitted for 4.0s.
    /dev/ttyS5: count for this session: rx=4096, tx=8191, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=4096, tx=4096, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
    No data received for 2.0s. No data transmitted for 2.1s.
    No data received for 3.0s. No data transmitted for 3.1s.
    No data received for 4.0s. No data transmitted for 4.1s.
    No data received for 2.0s. No data transmitted for 2.0s.
    /dev/ttyS5: count for this session: rx=8192, tx=12287, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=8192, tx=9215, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0

Comments

  • ccalde
    ccalde New Member Posts: 348 ✭✭✭

    Hi @mchau ,

    You must run the linux-serial-test at 115200 :)

    Please try again with the next steps:
    To test the UART, connect a jumper between pins:
    UART1_TX - UART1_RX
    UART1_RTS - UART1_CTS
    (see https://up-community.org/wiki/Pinout_UP2)

    Stress test: sudo ./linux-serial-test -s -e -p /dev/ttyS5 -b 115200
    You will see something like:
    /dev/ttyS5: count for this session: rx=53248, tx=61439, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=53248, tx=57344, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
    /dev/ttyS5: count for this session: rx=114688, tx=122879, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=114688, tx=118784, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
    /dev/ttyS5: count for this session: rx=176128, tx=184319, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=176128, tx=180224, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0

    Test flow control: sudo ./linux-serial-test -s -e -p /dev/ttyS5 -c -l 250
    You will see somthing like:
    No data received for 2.0s. No data transmitted for 2.0s.
    No data received for 3.0s. No data transmitted for 3.0s.
    No data received for 4.1s. No data transmitted for 4.1s.
    No data received for 5.1s. No data transmitted for 5.1s.
    No data received for 6.2s. No data transmitted for 6.2s.
    /dev/ttyS5: count for this session: rx=0, tx=4095, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=196608, tx=197631, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0
    No data received for 7.2s. No data transmitted for 7.2s.
    No data received for 8.3s. No data transmitted for 8.3s.
    No data received for 9.3s. No data transmitted for 9.3s.
    No data received for 11.3s. No data transmitted for 11.3s.
    No data received for 12.3s. No data transmitted for 12.3s.
    /dev/ttyS5: count for this session: rx=0, tx=4095, rx err=0
    /dev/ttyS5: TIOCGICOUNT: ret=0, rx=196608, tx=197631, frame = 0, overrun = 0, parity = 0, brk = 0, buf_overrun = 0

    More info: https://github.com/cbrake/linux-serial-test

Privacy Policy