Xuartctl

From embeddedTS Manuals
Revision as of 18:24, 20 May 2011 by Mark (talk | contribs) (Created page with "{{Infobox |title = xuartctl |image = 200px |titlestyle = |headerstyle = background:#ccf; |labelstyle = width:33% |datastyle = }}...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
xuartctl
Xuartctl-diagram.png

xuartctl is a userspace driver utility to manage the UARTs that go through the FPGA.

Overview

The the UARTS that are connected to FPGA are accessed through the SBUS. The xuartctl main server (xuartctl --server without a port specified) connects to the FPGA and makes the ports available into it over the SBUS. On the linux system, the command is run

Command line options

-i, --irq=N

Use IRQ N as XUART IRQ (32)

-r, --regstart=ADD

Use ADD address as regstart (0x600ff100)

-m, --memstart=ADD

Use ADD address as memstart (0x60000000)

-s, --speed=BAUD

Use BAUD as default baudrate (115200)

-o, --mode=MODE

Use MODE as default mode (8n1)

Available modes are: 8n1, raw, 8n2, dmx, 8e1, 8o1, 8e2, 8o2, 7n1, 7n2, 7e1, 7o1, 7e2, 7o2, 9n1

dmx will also set the baud rate to 250k

-d, --server

Daemonize and run as server. Default is to listen at TCP port numbers starting at 7350 with 1 port per XUART channel.

-I, --bind=IPADDR

Bind server to IPADDR. You can specify 127.0.0.1 to restrict the ports to a local connection only. They are by default accesible from the outside.

-p, --port=PORT

Connect to local or remote XUART port

The PORT option can be a either a number 0-7, or a HOSTNAME:TCPPORT for a remote TCP socket. When both --port and --server are used, a pseudo-tty is allocated and connected to the XUART channel and pseudo-tty processing continues in the background. When only --port is specified and no command is given, stdin and stdout are connected to the XUART channel. Otherwise COMMAND is run as a sub-program with its stdin/stdout/stderr connected to the allocated pseudo-tty.

-t, --test Run loopback and latency test

Tests the latency to the uarts.

-h, --help

Print the help menu

Examples

Configure baud rate

xuartctl --port 0 --speed 115200

Configure xuarts on startup

Edit your /etc/rc.local file and add in these lines before exit:

eval $(xuartctl --port 0 --speed 9600 2>&1); ln -s $ttyname /dev/ttyxuart0
eval $(xuartctl --port 1 --speed 115200 2>&1); ln -s $ttyname /dev/ttyxuart1
eval $(xuartctl --port 2 --speed 38400 2>&1); ln -s $ttyname /dev/ttyxuart2

Create a local xuart port server running on a remote xuartctl main server

If the xuartctl --server is running remotely on 192.168.0.50, you could run this from any remote system:

xuartctl --port=192.168.0.50:7350 --speed=9600

FAQ

How do I kill the old xuart process controlling one port?

When you run xuartctl on a port that is already running, it will replace that instance without affecting the other configured ports.

xuartctl works in the booted environment, but not in my startup scripts

Make sure the main server is started when you try to start a port server. If you add your scripts in /etc/rc.local, you should be fine. However if it doesn't start you can create the main server instance with:

xuartctl --server

When I brought up my first port it appeared as /dev/pts/1, but normally shows up as /dev/pts/0

The psuedo terminal devices will show up in order they were brought up, and other devices can claim them as xuartctl does. If you want this consistancy, it is usually best to link the files to the output of xuartctl's ttyname.