FarSync Drivers

Async Operation

Not all FarSync ports support async operation.  In general it is available on the FarSync Flex, the FarSync T4E and T4E+, and the FarSync T4U + Async.  The farutil command will normally indicate if the FarSync device you have supports ports in async mode.  This page gives some guidance of using the FarSync ports in async mode.

Installation

You should be using a 2.6 Kernel based distribution, FarSync async ports have not been tested on 2.4 Kernels.  Please follow the instructions in the following link installing the OEM driver, and then return here to learn more about configuring and using the async port.  When you have successfully started the driver it will be indentified as version 1.09.05

Switching to Async mode

When the FarSync Flex device is first initialised it defaults to the synchronous HDLC mode of operation.  In order to start using it as an asynchronous port, it must first be switched into async mode.  The media type may also need to be changed to v24.  This can be done with the following farutil command.

farutil <device> set linemode async media v24

the device name will typically be sync0.

Checking/Setting Async Parameters with farutil

When the port is in async mode, some additional parameters are displayed when the farutil command is invoked.

root@kevinspc:/home/kevinc/ffflash# farutil sync0

Farutil for FarSync version 1.09.05

card:           FarSync Flex WAN
ports:          1
state:          Running normally

firmware id:    0       firmware vers:  1.00.01
Async ports present
Configuration for port 0 
physical:       V.24 (RS232C) 
  active inputs:        DCD 
  active outputs:       RTS, DTR
  clock:                Internal detected
  speed:                115200
  encoding:             nrz
  NRZIClocking:         Disabled
  termination:          None
protocol:       Raw packet interface
line mode:      Async
Async Configuration:
  flow control:         Hardware
  stop bits:            1
  parity:               No Parity
  word length:          8
  XON character:        17      XOFF character: 19
Buffer configuration:
  no of rx buffers:     8       size of rx buffers:     8192
  no of tx buffers:     8       size of tx buffers:     8192
root@kevinspc:/home/kevinc/ffflash# 

The possible setting for the various parameters are as follows:

To set any of these parameters with the farutil command use the following syntax

farutil <device> set flow_control <value> | stop_bits <value> | parity <value> | word_len  <value>
e.g.
farutil sync0 set linemode async flow_control hardware stop_bits 1 parity none word_len 8

Note that for the moment, async parameter setting are not available through the configuration files ifcfg-syncX,

Using stty

To set and inspect the async port parameters the stty command can be used.  The format of the command to see all the async port parameters would be:

stty -F/dev/sync0 -a

Which will return something like the following:

speed 115200 baud; line = 0;
intr = <undef>; quit = <undef>; erase = <undef>; kill = <undef>; eof = <undef>; eol = <undef>; eol2 = <undef>; 
swtch = <undef>; start = <undef>; stop = <undef>; susp = <undef>; rprnt = <undef>; werase = <undef>; 
lnext = <undef>; flush = <undef>; min = 1; time = 5;
-parenb -parodd 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

The parameters of significance to the async port are highlighted. The output shows that the line rate is set for 115200 bps and that parity is disabled. The number of bits per byte is set as 8, and there are 2 stop bits. Hardware flow control is enabled, but XON/XOFF is disabled.

The stty command can be used to set any of these parameters. Use the "man stty" command for details on the command syntax.

Using the Async port with minicom

To use the port with a Linux terminal application such as minicom the port must first be set in async mode.  You may also need to set the media type to v24.  Once this has been done the minicom application can be started.

farutil sync0 set linemode async media v24
minicom -o /dev/sync0

You can then use the minicom menus system to set the required serial port parameters.  When you have changed the settings don't forget to save them too.  Once they have been changed they will become the active settings for the port.  There is no need to restart the minicom application to acquire the new configuration.  An example is shown below:

Welcome to minicom 2.3                                                    
                                                                          
OPTI+-----------------------------------------------------------------------+
Comp| A -    Serial Device      : /dev/sync0                                |
Port| B - Lockfile Location     : /var/lock                                 |
    | C -   Callin Program      :                                           |
    | D -  Callout Program      :                                           |
    | E -    Bps/Par/Bits       : 38400 7E1                                 |
    | F - Hardware Flow Control : Yes                                       |
    | G - Software Flow Control : No                                        |
    |                                                                       |
    |    Change which setting?                                              |
    +-----------------------------------------------------------------------+
            | Screen and keyboard       |                                 
            | Save setup as _dev_sync0  |                                 
            | Save setup as..           |                                 
            | Exit                      |                                 
            +---------------------------+                                 
                                                                          
                                                                          
                                                                          
                                                                          
 CTRL-A Z for help | 38400 7E1 | NOR | Minicom 2.3    | VT102 |      Offline   

Once the correct parameters have been applied, then the terminal can be used as normal.

When minicom is used on a farsync port for the first time, minicom will fail to find the configuration file for it.  Therefore the first thing that must be done is to set the Serial Device to /dev/sync0 and the save the setup.  Exit minicom and start it again and this time the configuration file will be found and can then be used as normal.

Async ioctls supported

For this first release of FarSync Flex async product, only a limited number of "standard" serial port ioctls() are supported.  These are as follows:

	TCGETS:  Get serial port parameters
	
	TCSETS:
	TCSETSW: Set the following serial port parameters.
                 baud 
                 char_size
                 stop_bits
                 parity
	         rtscts
	         xonxoff

	TCSETSF:     Not yet supported
	TIOCGSERIAL: Not yet supported
	TIOCSSERIAL: Not yet supported

	TIOCMGET: Get control signals

	TIOCMBIS: Not yet supported
	TIOCMBIC: Not yet supported

	TIOCMSET: Set control signals

	TCFLSH: Not yet supported

In general you should be able to configure the serial port parameters as described above with the terminal application (if it supports configuration) or with the stty command.

Using the Async Port with ppp Daemon

If you require to use the async ppp daemon, then the farsync and fsflex driver will need to be rebuilt as WAN drivers.  You need to uninstall the OEM driver and then install the WAN driver.

Then rebuild the driver and install them

    ./uninstall
    install wan

Then start the drivers.

    /etc/init.d/farsync start

There are some ppp daemon helper files installed in the /etc/ppp directory.  These should be amended as follows.

The options.tty_hdlcX files need to be amended to remove the "sync" statement, and it may be useful no to detach the pppd process from the terminal and to turn on debug so that you can debug the pppd connection attempts.  The file may then look like:

    #sync
    #persist
    debug
    nodetach
    10.0.0.1:

You may need to add further pppd options to this file.  Also the ppp-on script that is used to spawn pppd session should be amended to set the port to async mode and to set the required line characteristics, for example:

# Configure the line parameters
#
/sbin/farutil $1 set media v24 linemode async
fi

#
# Now start the daemon
#
/usr/sbin/pppd /dev/tty_$1 38400 crtscts

Copyright © 2001-2010 FarSite Communications Ltd.