CommandFusion Wiki

Documentation Resources

User Tools

Site Tools


Sidebar

hardware:cflink:com-module-cflink-documentation

COM Module/Card CFLink Documentation

The following documentation is for COM (serial port) modules and cards.

Port Configurations

The COM4 supports up to 4 COM port combinations, with RS232, RS422 and RS485 support, including flow control options.

The default port configuration is 4 x RS232, 9600 Baud Rate, 8 Data Bits, No Parity, 1 Stop Bit, No Flow Control.

The following tables demonstrate the possible port combinations of a single COM4 module:

Legend:
RS232 without handshaking/flow control RS232 with RTS/CTS RS485 half-duplex RS485/422 full-duplex
1 232 232 2
3 232 232 4
4 x RS232
 
1 232 232 2
3 232H  
2 x RS232
1 x RS232 RTS/CTS
1 232H  
3 232H  
2 x RS232 RTS/CTS
 
1 485  
3 232 232 4
1 x RS485 half-duplex
2 x RS232
1 485  
3 232H  
1 x RS485 half-duplex
1 x RS232 RTS/CTS
1 485  
3 485  
2 x RS485 half-duplex
 
1 485  
3 485/422  
1 x RS485 half-duplex
1 x RS485/422 full-duplex
1 485/422  
3 485/422  
2 x RS485/422 full-duplex
 
1 485/422  
3 232H  
1 x RS485/422 full-duplex
1 x RS232 RTS/CTS
1 485/422  
3 232 232 4
1 x RS485/422 full-duplex
2 x RS232
Note that when using any RS232 mode in combination with RS485 or RS422 (any duplex type), the RS232 must be on ports 3 and/or 4.
RS232 can never be in ports 1 or 2 when using alongside RS485 or RS422.

THE FOLLOWING MODES ARE INVALID!
1 232 232 2
3 485  
2 x RS232
1 x RS485 half-duplex
1 232H  
3 485  
1 x RS232 RTS/CTS
1 x RS485 half-duplex
1 232 232 2
3 485/422  
2 x RS232
1 x RS485/422 full-duplex
1 232H  
3 485/422  
1 x RS232 RTS/CTS
1 x RS485/422 full-duplex

Queries

SPC - Query Configuration

The SPC (Serial Port Configuration) query is used to return the status of the port configurations for the module/card.

Data

> [F2]<ID>[F3]QCOMSPC[F4]<M#>[F5][F5]

  • <M#> = The module number return the configuration for. 2 chars, uppercase 'M' followed by the module/card number.
    • eg. M1 = Module/card 1, M4 = Module4.

Reply

< [F2]<ID>[F3]RCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[F5][F5]

Each port on the COM module/card will be included in the reply.
See the definitions for all returned data in the SPC command.

Example

// Query configuration for Module 2 in a MOD4 on CFLink ID [11]
> [F2][11][F3]QCOMSPC[F4]M2[F5][F5]
// Reply
< [F2][11][F3]RCOMSPC[F4]M2|P01:232:9600:8:N:1:0|P02:232:115200:8:N:1:0|P03:OFF:9600:8:N:1|P04:OFF:9600:8:N:1[F5][F5]
// Ports 03 and 04 are both off.
// Ports 01 and 02 are set to RS232 mode

Configuration Messages

SPC - Configure Serial Port

The SPC (Serial Port Configure) command is used to setup the configuration of each port within the module.
You can configure multiple ports at once, across multiple modules, using the Port and Module separators.

Data

// Target device: COM4 Module
> [F2]<ID>[F3]CCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[F5][F5]

  • <M#> = The module number to configure port settings for. 2 chars, uppercase 'M' followed by the module/card number.
    • eg. M1 = Module/card 1, M4 = Module 4.
  • <P##> = Port number to configure. 3 chars, uppercase 'P' followed by the two digit port number.
    • eg. P01 = Port 1, P02 = Port 2.
  • <MODE> = The following modes are available:
    • 0 = Port Off
    • 232 = RS232 (handshaking determined via the <FLOWCONTROL> setting)
    • 485H = Half-duplex RS485
    • 4XXF = Full-duplex RS485 or RS422
  • <BAUD> = The following baud rates are available:
    • 100
    • 300
    • 600
    • 1200
    • 2400
    • 4800
    • 9600
    • 14400
    • 19200
    • 38400
    • 57600
    • 115200
    • 128000
    • 256000
  • <DATABITS> = Always 8 Data Bits
  • <PARITY> = The following parity types are available:
    • N = No Parity
    • O = Odd (uppercase letter 'O')
    • E = Even
  • <STOPBITS> = The following stop bits are available:
    • 1 = 1 stop bit
    • 2 = 2 stop bits
  • <FLOWCONTROL> = The following flow control (handshaking) options are available:
    • 0 = No flow control
    • 1 = Enable RTS/CTS

Reply

< [F2]<ID>[F3]RCOMSPC[F4]<M#>|<P##>:<MODE>:<BAUD>:<DATABITS>:<PARITY>:<STOPBITS>:<FLOWCONTROL>[F5][F5]

The reply will contain information for each port of the module/card, even if only one port was changed. See the definitions for all returned data above.

Example

// Set Port 01 to RS485 115200 Baud, 8 data bits, no parity, 1 stop bit, no flow control
// For Module 1 in a MOD4 on CFLink ID [11]
> [F2][11][F3]CCOMSPC[F4]M1|P01:4XXF:115200:8:N:1:0[F5][F5]
// Reply
< [F2][11][F3]RCOMSPC[F4]M1|P01:4XXF:115200:8:N:1:0|P02:OFF:9600:8:N:1|P03:OFF:9600:8:N:1|P04:OFF:9600:8:N:1[F5][F5]

// Port 01 is already set to RS485 mode, now we want to set port 02 to 232 mode.
// For Module 2 in a MOD4 on CFLink ID [11]
// This will break the RS485 mode, as it requires both A and B ports combined.
> [F2][11][F3]CCOMSPC[F4]M2|P02:232:115200:8:N:1:0[F5][F5]
// Reply
< [F2][11][F3]RCOMSPC[F4]M2|P01:232:9600:8:N:1:0|P02:232:115200:8:N:1:0|P03:OFF:9600:8:N:1|P04:OFF:9600:8:N:1[F5][F5]

// Error setting port mode, invalid port combination (only port 01 or 03 can be set in RS485/422 mode)
> [F2][11][F3]CCOMSPC[F4]M1|P04:4XXF:115200:8:N:1:0[F5][F5]
// Reply, when previous command was sent from a LANBridge on CFLink ID [02]
< [F2][11][F3]RCOMERR[F4]Invalid COM Mode:02:CCOMSPC:M1|P04:4XXF:115200:8:N:1:0[F5][F5]

Transmission Messages

SPW - Send Serial Data

The SPW (Serial Port Write) command is used to send serial data out a specific port within the module/card.

// Target device: COM4 Module
> [F2]<ID>[F3]TCOMSPW[F4]<M#>|<P##>:<DATA>[F5][F5]

  • <M#> = The module number to send the data via. 2 chars, uppercase 'M' followed by the module/card number.
    • eg. M1 = Module/card 1, M4 = Module 4.
  • <P##> = Port number to send the data out via. 3 chars, uppercase 'P' followed by the two digit port number.
    • eg. P01 = Port 1, P02 = Port 2.
  • <DATA> = This is the actual data you want to send out the serial port. Data cannot contain [F5][F5] as it will strip all data from that point as per the CFLink protocol End Of Message specifier. When you want to send hex data, it must be already converted to hex within the <DATA> before sending the CFLink message to the serial port.

Note: Only one port can be written to per transmission command.

Reply

// Replying device: COM4 Module
< [F2]<ID>[F3]RCOMSPW[F4]<M#>|<P##>[F5][F5]

If the SPW command is successful, the reply will contain the module/card and port number parameters used for the SPW. The data will not be echoed, in an effort to reduce bus traffic.

Example - Sending Serial Data

// Send a command out of port 02 of a COM4 module in slot 1 of a MOD4 on CFLink ID [04]
> [F2][04][F3]TCOMSPW[F4]M1|P02:PWRON[0D][F5][F5]
< [F2][04][F3]RCOMSPW[F4]M1|P02[F5][F5]

Errors

  • 003 = Invalid Port Number
  • 004 = Invalid Module/card Number

Notifications

SPR - Read Serial Data

The SPR (Serial Port Read) reply contains any data received via a specific port within the module/card.
This reply is automatically transmitted whenever data is received.

// Replying device: COM4 Module
< [F2]<ID>[F3]RCOMSPR[F4]<M#>|<P#>:<DATA_RECEIVED>[F5][F5]

  • <M#> = The module number that received the data. 2 chars, uppercase 'M' followed by the module/card number.
    • eg. M1 = Module/card 1, M4 = Module 4.
  • <P##> = Port number that received the data. 3 chars, uppercase 'P' followed by the two digit port number.
    • eg. P01 = Port 1, P02 = Port 2.
  • <DATA_RECEIVED> = This is the actual data that was received via the serial port.

Example - Receiving Serial Data

// Receive data via port 1 of a COM4 module in slot 1 of a MOD4 on CFLink ID [04]
< [F2][04][F3]RCOMSPR[F4]M1|P01:MV50[0D][F5][F5]

// Receive data via port 3 of a COM4 module in slot 2 of a MOD4 on CFLink ID [04]
< [F2][04][F3]RCOMSPR[F4]M2|P03:Hello World![F5][F5]

Glossary

  • Flow Control - Flow Control is the method that a serial port uses to control the flow of traffic. COM4 only supports RTS/CTS (software) flow control. XON/XOFF is not supported
hardware/cflink/com-module-cflink-documentation.txt · Last modified: 2015/07/16 04:38 by jarrod