UART with hardware flow control


#1

Hi all,

I’m trying to verify UART function with hardware flow control (RTS/CTS).
However, it does not work for me. Here is my steps.

  1. Set stty configurations

$ stty -F /dev/ttyMSM1 115200 -ixon -ixoff crtscts -echo
$ stty -F /dev/ttyMSM1 -a
speed 115200 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

  1. Connect cable with PC and open Putty with following settings.
    Speed: 115200
    Data bits: 8
    Stop bits: 1
    Partity: None
    Flow control: RTS/CTS

  2. Input something to UART


$ echo "test" > /dev/ttyMSM1

However, I always can get the “test” string from PC side, even I set “Flow control” to None in Putty.
Is there anything wrong in my test?

Thanks,
Daniel


#2

Sorry to ask you this:
Is your cable wired correctly to handle CTS/RTS?


#3

@ jean-marc,

Thank you for reply. I double check the cable and confirm the CTS/RTS is correct for my cable.
Is there anything else I can check?

Thanks,
Daniel


#4

I am using Android but: Is /dev/ttyMSM1 = UART1?
If it is the case then I do not think UART1 is having hardware I/O for the flow control CTS/RTS.
See the schematics APQ8016 - GPIO 0-73 page on the DragonBoard schematics.

UART0 has it.

I might be wrong maybe someone can correct me.


#5

@jean-marc You are right. It does not support hardware flow control on DragonBoard410c. I’m using a customized board which enable CTS/RTS for UART1.
But, I also verify UART0 on DragonBoard410c following my steps and get the same result.

In addition, I also suspect maybe it’s caused by my USB-to-UART adapter. However, it still fails after I connect two boards directly.

Does anyone verify hardware flow control successfully?

Thanks,
Daniel


#6

Mh! but I do not understand. If UART1 does not have a CTS/RTS how can it be used?
But if I understand correctly you are using a USB in between.

In any cases you need a handshake and do not success with CTS/RTS, you could try to handle XON/XOFF.
Have fun.
jm


#7

In our customized board, we reconfigure the gpio6/7 as BLSP2_UART_CTS/RFR function. So, we can use UART1 with CTS/RTS. In DragonBoard410c, they are defined to BLSP2_I2C_SDA/SCL.

I ever tried XON/XOFF and it actually works! I can use Contol+s (stop) and Control+q (start) for flow control.


#8

Oh! I get it! Great stuff! Now I understand. Thank you Daniel :slight_smile: