UART hardware flow control

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

UART hardware flow control

3,435 Views
parshuramthomba
Contributor II

Hi,

I need help regarding tty hardware flow control. I am using i.MX6D UART3 for BT module, and it is configured to have RTS/CTS. Problem is when ever tty buffer get full, throttle function seems to doing nothing. Wherese it is supposed to clear CTS and CTSC bits of USR2. It seems to be happening because CTS is already 0. If it is so how come data is being received at this UART. Any help/suggestion would me much appreciated.

Linux kernel version - 3.0.35.

Thanks

Labels (2)
0 Kudos
4 Replies

1,791 Views
parshuramthomba
Contributor II

After some debugging i found that , data reception is enabled by setting CTSC. ( According to datasheet CTSC = 0 -> CTS line is controlled by CTS bit of UCR2, and CTS bit= 1 means CTS line is asserted, CTSC = 1 ->

CTS output pin is controlled by the receiver ).

RTS and CTS status are tracked using "mctrl" variable, which should be updated every time CTS/CTSC or RTS is changed. However this is done in /driver/tty/serial/serial_core.c, whereas initially CTSC is set in imx.c, without updating mctrl.

Throttle function in serial_core.c call imx_set_mctrl only when there is change in mctrl status.  First time calling throttle to clear RTS find that this bit is never set (but CTSC is already set in set_termios without updating mctrl)

Which cause throttle functionality not to work as expected.

Following change in imx_set_termios() make it work as expected.

         if (termios->c_cflag & CRTSCTS) {

                 if( sport->have_rtscts ) {

                         sport->port.mctrl |= TIOCM_RTS;

                         ucr2 &= ~UCR2_IRTS;

                         ucr2 |= UCR2_CTSC;

                 } else {

                         termios->c_cflag &= ~CRTSCTS;

                 }

         }

Can anyone please validate this observation ?

0 Kudos

1,791 Views
YixingKong
Senior Contributor IV

Parshuram

We are sorry for getting back to you so late. Are you still stuck with the issue? If you have somehow resolved the issue, can we close the discussion? If you still need help, please feel free to reply with an update to this discussion.

Thanks,

Yixing

0 Kudos

1,791 Views
parshuramthomba
Contributor II

Hello Yixing,

Thank you for reply.

I was able to get UART throttling working, but just need to validate if it is really not working in current code?

0 Kudos

1,791 Views
Wlodek_D_
Senior Contributor II

Hello,

Thank you for your post, however please consider moving it to the right community place (e.g.i.MX Community ) to get it visible for active members.

For details please see general advice Where to post a Discussion?

Thank you for using Freescale Community. 

0 Kudos