MOXA CPxxx Fastcomm-PCIe MicroGate HDLC

SIMulation Workbench supports the MOXA CP134, MOXA 118, Fastcomm 422/X-PCIe and MicroGate Gtx HDLC serial boards.

The CP134 board provides 4 serial channels, the CP118 board provides 8 channels, and the Fastcomm boards provide either 4 or 8 channels. When the MOXA boards are added to the I/O devices (see I/O Devices...), the number of channels must be edited to be correct.

All the MOXA and Fastcomm boards that are present in the system must be added in the I/O Devices form, even if they are not going to be used by SimWB. This is because the O/S device names to access a particular channel on a board are sequential across all MOXA and Fastcomm boards. I.e. the second channel of the second MOXA board is accessed via /dev/ttyM05 if the first MOXA board is a 4 channel MOXA CP134. So SimWB must know about the existence of the first board in the system even when it is not used. The first channel on the Fastcomm board is accessed via /dev/ttyS4.

The O/S driver for the MOXA boards is provided by the Linux kernel and the module is called mxser. Make sure it is configured in the kernel and loaded before using it.

For Fastcomm boards, the standard O/S kernel driver needs to be patched and a new kernel built. The support package provided by Concurrent will run a script on installation that will patch the kernel automatically.

Note:  Please refer to the PDF release notes associated with the driver package provided by Concurrent for additional information on installation and extended configuration options.
For Fastcomm synchronous board, i.e. devname = fscc, the board setup IS NOT performed by SimWB via the external stty command. The channels must instead be setup externally after the driver is loaded via the commands; setclock, setfscc, setfeatures in /usr/local/CCUR/drivers/fsccp/utils/bin. The schedPreProcess user-defined script can be used for that purpose.
Example:
./setclock x 6000000
./setfscc x hdlcset
./setfeatures x 0 0 0 0
Where x is the channel number
See the associated documentation in /usr/local/CCUR/drivers/fsccp/documentation for more details.

Reference Information MOXA

I/O Card Model Number

CS-MX-CP1x.

I/O Driver Model Number

WCS-MX-CP.

I/O Module License:

ICS-SWB-1219.

Reference Information Fastcomm

I/O Card Model Number

FASTCOMM 422/4-PCIe.

FASTCOMM 422/8-PCIe.

I/O Driver Model Number

via RIQ.

I/O Module License:

ICS-SWB-1219.

Reference Information SIO

I/O Card Model Number

CS-GS-SIO4BX2x.

I/O Driver Model Number

WCS-GS-SIO4BX2.

I/O Module License:

ICS-SWB-1219.

Settings and I/O Point Mapping

See I/O Mappings... for general concepts on making board and channel settings and creating mappings to I/O points.  

Board Settings

Device Name

Select whether the device is PCI (ttyMI) or PCIe (ttyMUE). This applies to MOXA only and is not present for FASTCOMM.

First Port Number

Select the lowest numbered port on this device. This applies to MOXA only and is not present for FASTCOMM. So if /dev/ttyMI16 is the desired device, select device name ttyMI for the Device Name and 16 for the First Port Number.

Output Thread Behavior

To provide finer control of the behavior of the output, the I/O task provides 3 possible choices:

Channel Settings

Channel Table

Select channel and I/O direction. Regardless of direction, channel settings below the channel table may be made on the selected channel.

stro_points.pngTo map a string I/O point to a channel, select the appropriate direction (Channel 02 Output is selected in the example above). Any compatible string I/O points will appear in the right-hand panel of the form (see String Points... for details and creating string I/O points). Click on the checkbox(s) next to the point(s) you want to map or unmap.

Input Type

Type of string data that will be received by the channel. Input and output can be different types.

Output Type

Type of the string data that will be transmitted by the channel. Output and input can be different types.

Baud Rate

Select the baud rate between 300 and 921,600 baud via a drop-down list.

Custom Baud Rate

This is for Fastcomm 422/4-PCIe and 422/8-PCIe only. Check box enables and disables custom baud rate. Sample rates of 4, 8, and 16 can be selected via a drop-down list. Custom baud rates can be specified via baud rate dialog box. Note that when custom baud rate is selected, the values chosen supersede the values displayed in the baud rate drop-down list.

Parity

Select the parity to use for error detection. The choices are:

Character Size

Select the number of bits used to represent a character. The choices are:

Terminator

Select the terminator character(s) for ASCII input or output types. The choices are:

Binary Length

Specify a fixed length for the binary buffer input.

Tx Period (ms)

Specify the period of transmission on output channels in milliseconds. The value 0 indicates to transmit whenever the mapped output point changes.
To fully understand this, you must be aware of the asynchronous nature of serial I/O. A synchronous output task queues data to an async task that actually does the I/O. This task, by default, runs every millisecond (See output behavior above). This is to match the periods allowed above. However, if the model frame time does not evenly divide the specified period, the output will be very "jittery" when sent as "transmit on change". To avoid this, you may add a command option to the asynchronous task (via the I/O Tasks tab in the Configuration GUI) in question (e.g. moxaasyncio_1, fastcommasyncio_1, etc.). Click on the Options column and add a "-f". This instructs the task to cycle at the simulation frame rate rather than every millisecond. This will help with "transmit on change" data, but can add jitter to periodic output which does not divide by the frame time.

Thread CPU affinity

For the MOXA and Fastcomm I/O task, the individual output channels that are mapped are handled by a separate thread per channel. This prevents blocking of the output I/O task when one channel is running at a slower rate than the others or when one channel is "stuck" (Hardware handshake on and no CTS). When this is given for the channel, the thread will be set run on that CPU. When left as -1 (default), the thread will run on the same core as the main I/O task.

Flow Control

Specify the kind of flow control that will be used. The choices are:

Stop Bits

The number of stop bits after each byte. The choices are:

Settings MicroGate HDLC

 

Board Settings

First Port Number

Select the lowest numbered port on this device. Normally, the first port available on the board is 0. When more than 1 board is present in the system, the 2nd board first port number might be 2 or 4 depending on how many channels are present on the first board.

Output Thread Behavior

Same as for another board type.

Baud Rate Selection

Note that the baud rate is not provided via a combo box as for other serial boards. This is because the baud rates available are too many. The rule for the baud rate is that it must evenly divide the board base clock of 14.745 MHz.

Receive Address Selection

The station address for reception of messages can be specified via a mappable control called rxAddressSelect (See red circle to the right). This control can be mapped to an output RTDB item. If the control is not mapped, the reception address is not modifiable at run time, and the initial value for the channel is provided by the RX Address entry field in the panel. This is a single byte value and thus its value must be ≥ 0 and ≤ 255.
On transmission, the address must be specified in the first byte of the message payload.
A value of 255 for the reception address indicates a broadcast address. In this case the channel will receive messages with any address in the address field.

Binary Message Mappping

 

Support has been added to define multiple binary mappings for serial I/O based on a message ID. The message ID is part of the message payload. On reception of a message, the message ID is used to select the mapping to decode the message. The message ID field can be disabled. When disabled, you can map a single binary message to the channel.

Workflow

Mapping Fields

 

Example

An example of a MOXA configuration is provided with the standard SIMulation Workbench distribution. Load the moxa_rtdb RTDB and look at the I/O mapping under Moxa in the filter. The moxa_rtdb is configured for a MOXA CP134 4 channel board where channel 03 is looped back to channel 00 and channel 02 is looped back on itself.

Mapping Table

 

Channel Column

Channel number. There are separate rows for the input and output channels.

Mapped Point(s) Column

I/O point(s) a channel in a particular direction is mapped to.

To map a point to a channel and direction, select a channel’s direction on the left side of the I/O Mappings form, then click on a check box for an I/O point on the right side of the form. See I/O Mappings... for details.