From: Russell King - ARM Linux <linux@arm.linux.org.uk>
To: Sourav <sourav.poddar@ti.com>
Cc: Kevin Hilman <khilman@deeprootsystems.com>,
Tony Lindgren <tony@atomide.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-serial@vger.kernel.org, linux-omap@vger.kernel.org,
linux-arm-kernel@lists.infradead.org,
Alan Cox <alan@linux.intel.com>
Subject: Re: [RFC 00/24] OMAP serial driver flow control fixes, and preparation for DMA engine conversion
Date: Thu, 11 Oct 2012 12:08:48 +0100 [thread overview]
Message-ID: <20121011110848.GI28061@n2100.arm.linux.org.uk> (raw)
In-Reply-To: <50769D8C.8030401@ti.com>
On Thu, Oct 11, 2012 at 03:51:00PM +0530, Sourav wrote:
> True. I missed that point while doing the testing. Sorry for that.
> I further looked into it and saw some two options in my minicom
> settings(Hardware Flow Control/ Software Flow Control) Which I am
> thinking are the ones used to enable the flow control ? and they are
> both set to NO.
>
> I already enable software flow control and did the testing on beagle,
> where things are working fine
> after off mode.
> But if I enable hardware flow control, the teraterm does not allow me to
> load my fs and uImage from mmc.
> If you have any pointers on how to test hardware flow control, I will
> like to do that on my beagle board.
Okay, it sounds like I need to do a teach-in on flow control...
First, hardware flow control. Hardware flow control is operated by two
signals: RTS and CTS.
In conventional setups, CTS is an input to the transmitter, and controls
whether the transmitter may start the transmission of a new character.
If CTS is deasserted, the transmitter will stop after the completion of
the previous character. When hardware flow control is disabled, the
transmitter ignores this signal.
RTS is an output, and is generally used to control the remote transmitter.
(There are setups where RTS means something else, but the kernel doesn't
support other schemes directly.) RTS is asserted when either hardware
flow control is disabled, or there is sufficient space to receive more
characters from the remote end.
This is a symetrical setup, so that two UARTs connected together using
this scheme will have the RTS of one connected to the CTS of the other.
This way, each can signal whether characters should be transmitted.
So, in minicom, when hardware flow control is disabled, your hosts
transmitter will ignore the state of the CTS signal, and will hold its
RTS asserted.
If hardware flow control in minicom is enabled, then that tells the
kernel (and possibly hardware) to take note of the CTS signal, and pause
transmission when CTS is deasserted. It will also cause the RTS signal
to be manipulated according to available buffer space on the receive
side.
Obviously minicom will try to ensure that any characters received are
displayed as quickly as possible, so it's unlikely that the receive side
will fill up.
When you're logged into a system via a serial line, the hardware flow
control state is controlled by the CRTSCTS termios flag. That can be
seen and manipulated by stty. stty -a to see all flags. stty -crtscts
to disable, stty crtscts to enable.
Now, for software flow control. It operates in the same way as above,
but instead of a hardware signal reporting the state, characters are
embedded into the stream.
In normal situations, these characters are the standard ^Q (noramlly XON)
and ^S (XOFF) characters. You'll find that works in gnome-terminals,
xterms, and many places because it's part of the standard terminal
interface. You can type these characters into minicom with or without
software flow control disabled; it just passes them through unmodified.
When software flow control is enabled, and the tty receive buffers start
to fill up, the kernel will queue a high-priority XOFF character for the
UART to transmit to the remote end. Once the tty buffers have emptied
sufficiently, it will queue a high-priority XON character. If software
flow control is disabled, it will ignore this.
When hardware assisted software flow control is enabled, this will be
done by the hardware itself in response to the UART FIFO filling up and
emptying.
For the target, software flow control has more configuration options:
ixon: controls whether the transmitter starts/stops on reception
of xon/xoff characters
ixoff: controls the generation of xon/xoff characters
ixany: permits any received character (including xon) to restart
transmission
stop <char>: sets the xoff character to the specified character
start <char>: sets the xon character to the specified character
xon and xoff default to ^Q and ^S respectively, there's no need to
'initialize' them prior to use. So, to enable software flow control
(which is probably already enabled on the target):
stty ixon ixoff
and then you can type ^S and ^Q into minicom to stop/start the target's
transmit output.
Finally, to make the target's input buffer fill up, arrange for the
target not to read from the controlling tty at all. sleep 120 will
do that for two minutes, after which the input will be gobbled up by
the shell (which it'll try to interpret as commands.) So, probably
better to do:
sleep 120; echo Finished; cat >/dev/null
instead, and then send lots of data, and check whether the transmission
stops, whether the right xon/xoff characters are transmitted, and whether
any overrun errors are reported.
Going the other way, you can suspend minicom (^a z) and then arrange for
the target to send lots of data, and again check what happens.
There's a gotcha there though: with standard 8250-based serial ports,
we have /proc/tty/driver/serial which gives easy access to the port
statistics. With USB stuff, those statistics are not available, so it
becomes much harder to test. You have to arrange for the target to send
a known pattern, and find some way to check at the host end that it was
correctly received, including over the flow control events.
No characters should be lost when flow control is being used; after
all, that's the whole point of the facility.
next prev parent reply other threads:[~2012-10-11 11:09 UTC|newest]
Thread overview: 39+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-10-06 12:38 [RFC 00/24] OMAP serial driver flow control fixes, and preparation for DMA engine conversion Russell King - ARM Linux
2012-10-06 12:39 ` [RFC 01/24] SERIAL: omap: fix set_mctrl() breakage Russell King
2012-10-06 12:39 ` [RFC 02/24] SERIAL: omap: fix bit masks for software flow control Russell King
2012-10-06 12:40 ` [RFC 03/24] SERIAL: omap: remove setting of EFR SCD bit Russell King
2012-10-06 12:40 ` [RFC 04/24] SERIAL: omap: fix MCR TCRTLR bit handling Russell King
2012-10-06 12:40 ` [RFC 05/24] SERIAL: omap: no need to re-read EFR Russell King
2012-10-06 12:41 ` [RFC 06/24] SERIAL: omap: allow hardware assisted rts/cts modes to be disabled Russell King
2012-10-06 12:41 ` [RFC 07/24] SERIAL: omap: allow hardware assisted IXANY mode " Russell King
2012-10-06 12:41 ` [RFC 08/24] SERIAL: core: use local variable uport in uart_set_termios() Russell King
2012-10-06 12:42 ` [RFC 09/24] SERIAL: core: add hardware assisted s/w flow control support Russell King
2012-10-06 12:42 ` [RFC 10/24] SERIAL: core: add hardware assisted h/w " Russell King
2012-10-06 12:42 ` [RFC 11/24] SERIAL: core: add throttle/unthrottle callbacks for hardware assisted flow control Russell King
2012-10-06 12:43 ` [RFC 12/24] SERIAL: omap: fix " Russell King
2012-10-06 12:43 ` [RFC 13/24] SERIAL: omap: configure xon/xoff before setting modem control lines Russell King
2012-10-06 12:43 ` [RFC 14/24] SERIAL: omap: serial_omap_configure_xonxoff() contents into set_termios Russell King
2012-10-06 12:44 ` [RFC 15/24] SERIAL: omap: don't read back LCR/MCR/EFR Russell King
2012-10-06 12:44 ` [RFC 16/24] SERIAL: omap: simplify Russell King
2012-10-06 12:44 ` [RFC 17/24] SERIAL: omap: always set TCR Russell King
2012-10-06 12:45 ` [RFC 18/24] SERIAL: omap: move xon/xoff setting earlier Russell King
2012-10-06 12:45 ` [RFC 19/24] SERIAL: omap: simplify (2) Russell King
2012-10-06 12:45 ` [RFC 20/24] SERIAL: core: add xmit buffer allocation callbacks Russell King
2012-10-06 15:49 ` Alan Cox
2012-10-06 16:51 ` Russell King - ARM Linux
2012-10-06 12:46 ` [RFC 21/24] SERIAL: omap: use tx buffer allocation API Russell King
2012-10-06 12:46 ` [RFC 22/24] SERIAL: omap: typesafe conversion from uart_port to uart_omap_port Russell King
2012-10-06 12:46 ` [RFC 23/24] SERIAL: omap: move driver private definitions and structures to driver Russell King
2012-10-06 12:47 ` [RFC 24/24] SERIAL: omap: remove OMAP_UART_SYSC_RESET and OMAP_UART_FIFO_CLR Russell King
2012-10-06 14:23 ` [RFC 00/24] OMAP serial driver flow control fixes, and preparation for DMA engine conversion Russell King - ARM Linux
2012-10-06 14:39 ` Russell King - ARM Linux
2012-10-06 15:35 ` Russell King - ARM Linux
2012-10-06 15:50 ` Alan Cox
2012-10-09 13:34 ` Sourav
2012-10-10 18:29 ` Kevin Hilman
2012-10-11 9:43 ` Sourav
2012-10-11 9:54 ` Russell King - ARM Linux
2012-10-11 10:21 ` Sourav
2012-10-11 11:08 ` Russell King - ARM Linux [this message]
2012-10-11 14:05 ` Jon Hunter
2012-10-12 14:51 ` Grazvydas Ignotas
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20121011110848.GI28061@n2100.arm.linux.org.uk \
--to=linux@arm.linux.org.uk \
--cc=alan@linux.intel.com \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@deeprootsystems.com \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-serial@vger.kernel.org \
--cc=sourav.poddar@ti.com \
--cc=tony@atomide.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).