Installation: RS232

Ochno O-RS232-200-1 can be used for connection to external control systems.

 

image-20240410-075113.png

 

Serial settings:

  • Speed: 9600

  • Data/Stop/Parity: 8/1/None

  • Flow: XON/XOFF

TX = Data sent from O-PC-3. Connect to RX on the other endpoint.

RX = Data sent to O-PC-3. Connect to TX on the other endpoint.

To test TX from O-PC-3, click console button (on the back of O-PC-3) and event should be sent.

To trigger a switch to port 1, send text (ASCII):

CMD_ACTIVATE_PORT 1

 

 

PROTOCOL SPECIFICATION

 

OPC3 > RS232

  • Notification when active port changes

  • Notification when MTR-mode changes

  • Notification when there is an ERROR reported on a port

  • Notification when a laptop is connected or disconnected on a port

  • Notification when the system enter admin-mode on Port 4

RS232 > OPC3

  • Switch to selected port. None or 1-4

  • Change MTR Mode

RS232 Settings

 

RS232 TX: (from the Dongles POV)

COMMAND

PARAMETERS

COMMENT

COMMAND

PARAMETERS

COMMENT

EVT_PORT_ACTIVE_CHANGE

0 = No Port active

1-4 = New active port

Just send new bit pattern on active port. Same as HID data.

EVT_PORT_ERROR <port>

1-4 = Port no that reported an error

 

EVT_PORT_CONNECT <port> <bitpattern>

1-4 = Port that had a USB-C connected

<bitpattern> = Value from HID

HID protocol provides bit-pattern on all changes. Need to deduce specific port changes from this.

EVT_PORT_DISCONNECT <port> <bitpattern>

1-4 = Port that had a USB-C disconnected

<bitpattern> = Value from HID

HID protocol provides bit pattern on all changes. Need to deduce specific port changes from this.

EVT_ADMIN_STATE_CHANGE

0 = Left admin mode

1 = Entered admin mode

 

EVT_MTR_STATE_CHANGE

0 = MTR Mode Off

2 = MTR Mode On (Android-based)

3 = MTR Mode On (PC-Based)

 

RS232 TX: (from the Dongles POV)

COMMAND

PARAMETERS

COMMENT

COMMAND

PARAMETERS

COMMENT

CMD_ACTIVATE_PORT <port>

0 = No Port active

1-4 = New active port

 

CMD_SET_MTR_ON

 

Change device to MTR mode

CMD_SET_MTR_OFF

 

Change device to BYOD mode

Notification commands

Command format

Every status command is a series of ASCII characters and consist of a command name string, which is uppercase characters, followed by a space (hex 0x20) - separated the parameter of the command. A command may take multiple parameters. All command is terminated by a pair of termination characters: Carriage return (CR, hex 0x0D) and Line feed (LF, hex 0x0A) as almost Window applications support.

Expressed generally, the format is:

COMMAND <space> [ <parameter 1> [ <space> <parameter 2>] <CRLF>

For example:

  • Command notifies port 1 is active: EVT_PORT_ACTIVE_CHANGE 1<CRLF>

Parameter strings

Command parameters are expressed as string of ASCII digits. The string is interpreted as a decimal (base 10) value. For example:

  • Command notifies ports connected: EVT_PORT_CONNECT 4 12<CRLF>, where the first parameter 4 indicates that port 4 is just connected (plugged), and the second parameter 12 (binary 0b00001100) is bitpattern value indicates port 3 and 4 are connected.

Command list

Change active port

Command: EVT_PORT_ACTIVE_CHANGE <port_no>

Parameters:

port_no: 0 = No Port active. 1-4 = New active port

For example:

No port is active (all OPC3 LEDs is turn off): notify port active change by EVT_PORT_ACTIVE_CHANGE 0

Port 4 is active (all OPC3 LEDs is turn on): notify port active change by EVT_PORT_ACTIVE_CHANGE 4

Change MTR-mode

Command: EVT_MTR_STATE_CHANGE <mode_no>

Parameters:

mode_no: 0 = MTR Mode Off. 1 = MTR Mode On (Android-based). 2 = MTR Mode On (PC-Based)

For example:

  • Configure MTR on OMC by Integrated MTR, notify mode change by EVT_MTR_STATE_CHANGE 1

  • Configure MTR on OMC by PC-base MTR, notify mode change by EVT_MTR_STATE_CHANGE 2

  • Configure MTR on OMC by Diabled, notify mode change by EVT_MTR_STATE_CHANGE 0

Error port

Command: EVT_PORT_ERROR <port_no>

Parameters:

port_no: 1-4 = ERROR reported on port

Connected port

Command: EVT_PORT_CONNECT <port_no> <bitpattern>

Parameters:

port_no: 1-4 = Port that had a USB-C connected

bitpattern: the value representing all ports that are connected. Bit 0 represents port 1; bit 1 represents port 2, bit 2 represents port 3, bit 3 represents port 4.

  • Single port connected: bitpattern will be

1 for port 1, 2 for port 2, 4 for port 3 and 8 for port 4.

  • Multiple ports connected: bitpattern contains multiple bit sets. For example, port 1, 2, 3 already connected, then connect on port 4, new decimal value is

15, and send notify command: EVT_PORT_CONNECT 4 15.

Disconnected port

Command: EVT_PORT_DISCONNECT <port_no> <bitpattern>

Parameters:

port_no: 1-4 = Port that had a USB-C disconnected

bitpattern: the value representing all ports that are connected. Bit 0 represents port 1; bit 1 represents port 2, bit 2 represents port 3, bit 3 represents port 4.

  • Single port connected: bitpattern will be

1 for port 1, 2 for port 2, 4 for port 3 and 8 for port 4.

  • Multiple ports connected: bitpattern contains multiple bit sets. For example, all port 1, 2, 3, 4 already connected (current value is decimal

15), then disconnect on port 1, so new decimal value is 14, and send notify command: EVT_PORT_DISCONNECT 1 14

Change Admin state

Only port 4 has Admin state.

Command: EVT_ADMIN_STATE_CHANGE <mode_no>

Parameters:

mode_no: 0 = Left admin mode. 1 = Entered admin mode

For example: connect USB-C port 4 to computer, then hot the button on the back for 5 seconds, port 4 will enter the Admin mode. Notify Admin state change by EVT_ADMIN_STATE_CHANGE 1.

Control commands

Command format

Every control command is a series of ASCII characters and consist of a command name string, which is uppercase characters, followed by a space (hex 0x20) or horizontal tab (hex 0x09) - separated the parameter of the command. A command may take a single parameter or not. Currently only one command CMD_ACTIVATE_PORT takes a port number parameter. All command must be terminated by a special termination character.

Expressed generally, the format is:

COMMAND [<space|tab> <parameter>] <termination characters>

For examples:

  • To activate on port 1, send ASCII command: CMD_ACTIVATE_PORT 1

  • To enter MTR mode ON, send ASCII command: CMD_SET_MTR_ON

ASCII control commands are case-sensitive. If the command contains any lowercase character, an error will be occurred, for example we send command CMD_set_MTR_ON, error is ERROR: unrecognized command 'CMD_set_MTR_ON'.

Multiple spaces or horizontal tabs between command name and parameter are accepted. For example: CMD_ACTIVATE_PORT 4.

Parameter strings

Command parameters are expressed as string of ASCII digits. The string is interpreted as a decimal (base 10) value. The Command list section will describe detail about parameter of each command.

Termination character

Accept below different termination characters:

  • Carriage Return (CR, hex 0x0D). For Putty or Tera Term instance, we can press Ctrl + J.

  • Line Feed (LF, hex 0x0A). For Putty or Tera Term instance, we can press Ctrl + M.

  • A Carriage Return character followed by a Line Feed: CRLF

  • A Line Feed character followed by a Carriage Return: LFCR

  • End-of-Transmission Block character (ETB, hex 0x17)

One of above termination characters must be the last character in ASCII command string.

Length of command strings

Currently, we limited length of control command string by maximum 64 ASCII characters. If the received command length is greater than 64, response error message: ERROR: the received command is too long and we must re-send the command. The received command will be discarded.

Command list

Activate a port

Command: CMD_ACTIVATE_PORT <port_no>

Parameters:

port_no: 0 = No Port active. 1-4 = New active port

Validate command:

  • If no parameter is given, response error message: ERROR: CMD_ACTIVATE_PORT required port no

  • If there is more than one parameter is given, response error message: ERROR: CMD_ACTIVATE_PORT not require parameter <redundant parameter>. For example, we sent command CMD_ACTIVATE_PORT 1 234, then response error ERROR: CMD_ACTIVATE_PORT not require parameter '234'

  • Parameter value must be one of ASCII digit: 0, 1, 2, 3, 4. Otherwise, response error message: ERROR: CMD_ACTIVATE_PORT not require parameter <input parameter> where input parameter is parameter value that we sent to, for examples: sent command CMD_ACTIVATE_PORT a1, then response error: ERROR: invalid port no 'a1'.

Response:

  • For a valid command, response EVT_PORT_ACTIVE_CHANGE command to notify active port change.

  • If a command is invalid, error is responded, and there is no effect in program.

Enter MTR mode

Command: CMD_SET_MTR_ON

Parameters: no parameter

Validate command:

  • If there is any parameter is given, response error message: ERROR: CMD_SET_MTR_ON not require parameter <redundant parameter>. For example, sent command CMD_SET_MTR_ON 1 234, then response error ERROR: CMD_SET_MTR_ON not require parameter '1'

Response:

  • For a valid command, response EVT_MTR_STATE_CHANGE command to notify MTR mode change.

  • If a command is invalid, error is responded, and there is no effect in program.

Leave MTR mode

Command: CMD_SET_MTR_OFF

Parameters: no parameter

Validate command:

  • If there is any parameter is given, response error message: ERROR: CMD_SET_MTR_OFF not require parameter <redundant parameter>. For example, sent command CMD_SET_MTR_OFF 1 234, then response error ERROR: CMD_SET_MTR_OFF not require parameter '1'

Response:

  • For a valid command, response EVT_MTR_STATE_CHANGE command to notify MTR mode change.

  • If a command is invalid, error is responded, and there is no effect in program.

HDMI power on TV

Command: CMD_HDMI_CEC_ON

Parameters: no parameter

Validate command:

  • If there is any parameter is given, response error message: ERROR: CMD_HDMI_CEC_ON not require parameter <redundant parameter>. For example, sent command CMD_HDMI_CEC_ON 1234, then response error ERROR: CMD_HDMI_CEC_ON not require parameter '1234'

Response:

  • For a valid command, there is no response.

  • If a command is invalid, error is responded, and there is no effect in program.

HDMI power off TV

Command: CMD_HDMI_CEC_OFF

Parameters: no parameter

Validate command:

  • If there is any parameter is given, response error message: ERROR: CMD_HDMI_CEC_OFF not require parameter <redundant parameter>. For example, sent command CMD_HDMI_CEC_OFF 1234, then response error ERROR: CMD_HDMI_CEC_OFF not require parameter '1234'

Response:

  • For a valid command, there is no response.

  • If a command is invalid, error is responded, and there is no effect in program.

Support ASCII control characters

On terminal app, normally there are two type of command line modes:

  • Line-editing: terminal applications (likes Putty, Hyper Terminal) allow to edit a whole line at a time locally, and the line will only be sent to OPC3 when pressing Return which will send the termination characters.

  • Non line-editing: every character we type into terminal applications (like Putty, Tera Term is sent immediately, OPC3 supports handling ASCII control characters, so we can edit likes Line-editing mode as below.

Start of line

ASCII control characters marks start of command line: Start of header (SOH, hex 0x01), Start of text (STX, hex 0x02).

End of line

ASCII control characters marks end of command line: Carriage Return (CR, hex 0x0A), Line Feed (LF, hex 0x0D), End of Transmission Block (ETB, hex 0x17). Those characters are termination characters also.

Backspace character

Backspace characters (BS hex 0x08; DEL hex 0x7F) enable move the cursor one space left and delete the character under it. It works similar as pressing Backspace button on the keyboard.

Cancel command line

ASCII control character End of Text (ETX, hex 0x03), End of Transmission (EOT, hex 0x04), Cancle (CAN, hex 0x18), and Substitute (SUB, hex 0x1A), allow to cancel/exit handling the sent characters. All sent character will be discarded, we can type new command.

For Putty/Tera Term instances, we can press on keyboard:

  • Ctrl + C to send ETX character.

  • Ctrl + D to send EOT character.

  • Ctrl + X to send CAN character.

  • Ctrl + Z to send SUB character.

Arrow keys

Terminal application (likes Putty) can send a control sequence ASCII character by the arrow keys. The arrow keys send ESC [C as right arrow key (cursor forward), and ESC [D as left arrow key (cursor backward). So we can move cursor to edit command as in Line-editing mode.

For up/down arrow keys are not supported, so press them in terminal will have no effect.

Other ASCII control characters and function keys

For other ASCII control characters are not listing above, they are not supported, so if OPC3 receives them, then there is no effect.

For all function keys in keyboard as F1 -> F12, Insert, Home, PgUp , PgDn are not supported, so press them will have no effect.

DEL control character is not supported by terminal app, so we cannot delete as we press Delete key in keyboard.

 

Ochno All Rights Reserved