RS232 Port Module
Cdios 6190

Command / Reply / Event messages V2.0
New or up-date devices are visible marked V2.x 

 

Cdios controller commands             Cdios download page

All CDIOS messages are presented as 8 bytes long. When variable length messages are selected, the part of the message that is not send over the CAN bus is represented in italic/lightgray text.


Command code 0Bh: Set Config RS232 interface

This command configures the RS232 speed, format, handshake type, transmit/receive buffer size and will clear the RS232 transmit and receive buffers.

 

Command

Module ID

Selector

4

5

6

7

8

0Bh

0 - 15

0

Speed

Format Handshake

Buffersize

0

 

Parameter

Value

Default

Description

Speed


1
2
3
4
5
6
7
8

6

Set RS232 speed (bits per second):
300
600
1200
2400
4800
9600
19200
38400

Format
1
2
3
4
5
6
7
8
9
3 Set RS232 format (databits / stopbits / parity)
7 data / 2 stop / no parity
8 data / 1 stop / no parity
8 data / 2 stop / no parity
7 data / 1 stop / odd parity
7 data / 2 stop / odd parity
8 data / 1 stop / odd parity
7 data / 1 stop / even parity
7 data / 2 stop / even parity
8 data / 1 stop / even parity
Handshake 1
2
1 Hardware handshake, using RTS output and CTS input
Software handshake, using XON / XOFF characters
Buffersize 100 - 250 175 The 6190 can store 350 characters in total.
The Buffersize parameter distributes this amount between the receive and transmit buffer:
Receive buffer size  = Buffersize characters
Transmit buffer size = 350 - Buffersize characters

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

0Bh

0 - 15

0

0

0

0

0

0

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

8Bh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Selector parameter out of range

1 1 = Speed parameter out of range
2 1 = Format parameter out of range
3

1 = Handshake parameter out of range

4 1 = Buffersize parameter out of range
 


Command code 0Bh: Read Config RS232 interface

This command reads the RS232 speed, format, handshake configuration

 

Command

Module ID

Selector

4

5

6

7

8

0Bh

0 - 15

80h

0 0 0

0

0

 Normal reply:

Reply

Module ID

Selector

4

5

6

7

8

0Bh

0 - 15

80h

Speed

Format Handshake

0

0

 

Parameter

 Description

All
Same format as in the 'Set Config RS232 interface' command

Possible error message:  

Error

Module ID

3

4

5

6

7

8

8Bh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Selector parameter out of range

 

Command code 0Ch: Read RS232 buffer

This command reads 0 - 5 received characters from the RS232 receive buffer.

 

Command

Module ID

3

4

5

6

7

8

0Ch

0 - 15

0

0

0

0

0

0


Reply

Module ID

3

4

5

6

7

8

0Ch

0 - 15

Length

Received characters

 

Parameter

Value

 Description

Length 0 There are no characters in the receive buffer
1 - 5 1 up to 5 received characters are placed in data byte 4-8 of the CDIOS reply.

When variable length messages are enabled, the reply message length will be 'Length + 3', otherwise it will be 8.


Command code 0Dh: Write RS232 buffer

This command writes 0 - 5 characters into the RS232 transmit buffer.

 

Command

Module ID

3

4

5

6

7

8

0Dh

0 - 15

Length

Characters to transmit

Parameter

Value

 Description

Length
0 - 5 0 up to 5 characters from data byte 4-8 of the CDIOS command are placed into the RS232 tranmit buffer

When variable length messages are enabled, the command message should be 'Length + 3', otherwise it should be 8.

Confirmation reply message (suppressed when 'Confirm' is 0):

 

Reply

Module ID

3

4

5

6

7

8

0Dh

0 - 15

0

0

0

0

0

0

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

8Dh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Length > 5

1 1 = RS232 transmit buffer is full, none of the characters will be placed into the buffer, the command has to be resend later.
 


Command code 0Eh: Read RS232 status

This command reads status information from the device.

 

Command

Module ID

3

4

5

6

7

8

0Eh

0 - 15

0

0

0

0

0

0


Normal reply is:

Reply

Module ID

3

4

5

6

7

8

0Eh

0 - 15

0

Received Characters

Transmitter Free

Status 0

0

 

Parameter

Value

 Description

Received Characters

0 ... BufferSize

Amount of received characters currently in the receive buffer

Transmitter Free

0 ... (350 - BufferSize)

Amount of remaining free space in the transmit buffer
  Bit  
Status 0 1 = Parity Error detected in a received character
1 1 = Framing Error, new startbit detected before end (last) stopbit
2 1 = Noise Error, receiver detected noise on its input line
3 1 = Receive buffer overrun.
The receive buffer is full and still more characters are received (and lost): the transmitting device did not stop transmitting after the RTS output was made inactive or the XOFF command was send (these signals are activated when the remaining free space in the receive buffer is < 25 characters)
4 RTS Status, handshake output, depending on handshake protocol:
 
  Meaning Hardware handshake Software handshake
0 Receive buffer almost full (less then 25 characters left) RTS output inactive (<-5 V) Send XOFF to stop data flow
1 Receive buffer Ok RTS output active (>+5V) Send XON to restart data flow
5

CTS Status, handshake input, depending on handshake protocol:

  Meaning Hardware handshake Software handshake
0 Receiving device cannot handle data flow CTS input inactive (<-5V) XOFF received from receiving device
1 Receiving device Ok CTS input active (>+5V) XON received from receiving device
 

The Parity/Framing/Noise error and Receive buffer overrun status will be cleared when characters are read from the receive buffer by command 0Ch or a character received event. This clearing will NOT generate a status Event. Note

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

8Eh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Selector parameter out of range

 



Command code 0Fh: Set event on status change

This commands defines the RS232 status to check for change.

 

Command

Module ID

Selector

4

5

6

7

8

0Fh

0 - 15

0

Mask

0

0

0

0


Parameter

Bit

Default

 Description

Mask

0

All zero

1 = enable Parity Error event

1

 

1 = enable Framing Error event

2

 

1 = enable Noise Error event

3   1 = enable Buffer Overrun event
4   1 = enable RTS status change event
5   1 = enable CTS status change event
6   reserved
7   1 = enable Received Character event (see events for details)
 
Confirmation reply message (suppressed when 'Confirm' is 0):

Reply

Module ID

3

4

5

6

7

8

0Fh

0 - 15

0

0

0

0

0

0

Possible error message:

 

Error

Module ID

3

4

5

6

7

8

8Fh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Selector parameter out of range

1 1 = Mask parameter out of range
 


Command code 0Fh: Read event on status change

This commands reads the RS232 status to check for change.

 

Command

Module ID

Selector

4

5

6

7

8

0Fh

0 - 15

80h

0

0

0

0

0


Normal reply:

Command

Module ID

Selector

4

5

6

7

8

0Fh

0 - 15

80h

Mask

0

0

0

0


Parameter

 Description

Maskl
Same format as in the 'Get event on status change' command

Possible error message: 

Error

Module ID

3

4

5

6

7

8

8Fh

0 - 15

0

0

Error Status

0

0

0


Parameter

Bit

 Description

Error status

0

1 = Selector parameter out of range

 
Command code 05h: Store configuration

This command stores the current or the default I/O module configuration into internal EEPROM memory.
The configuration is restored from this memory after power on or a reset command.

Command

Module ID

3

4

5

6

7

8

05h

0 - 15

Selector

43h

44h

53h

0

0

Parameter

Value

 Description

Selector

0

Store current configuration

1

Change configuration into default and then store it.

The internal EEPROM erasing / programming takes 120 up to 250 milli-seconds, then the reply message is send.
During programming I/O communication with this module is inhibited.

Sending a command will result in a general error message with errorcode = 8.

The confirmation reply message for this command is NEVER SUPPRESSED.

Reply

Module ID

3

4

5

6

7

8

05h

0 - 15

0

0

0

0

0

0


 Possible error message:

 

Error

Module ID

3

4

5

6

7

8

85h

0 - 15

0

0

Error Status

0

0

0

Parameter

Bit

 Description

Error status

0

1 =  Selector parameter out of range

1 1 = 'password' bytes 4-6 in command are not equal to 43h,44h,53h
2 1 = Configuration EEPROM programming error
 


Events

This device has 2 type of events; a status change event and a character(s) received event.

Character received event.

When the received character event is enabled and there is at least one character in the receive buffer, a read RS232 buffer event message is sent.

To minimize the CAN bus load, the 6190 tries to wait for 5 received characters (the maximum it can send in a CDIOS event message). However, if there are less then 5 characters in the receive buffer and there is no more character received within a time-out period of 2 character times, the CDIOS event message will be send anyway.

 

Event

Module ID

3

4

5

6

7

8

4Ch

0 - 15

Length

Received characters

 

Parameter

Value

 Description

Length
1 - 5 1 up to 5 received characters are placed in data byte 4-8 of the CDIOS event message.

When variable length messages are enabled, the event message length will be 'Length + 3', otherwise it will be 8.

Status change event.

If an event enabled status bit changes state, a read status event message is sent:

 

Reply

Module ID

3

4

5

6

7

8

4Eh

0 - 15

0

Received Characters

Transmitter Free

Status 0

0

 

Parameter

Value

 Description

Received Characters

0 ... BufferSize

Amount of received characters currently in the receive buffer

Transmitter Free

0 ... (350 - BufferSize)

Amount of remaining free space in the transmit buffer
  Bit  
Status 0 1 = Parity Error detected in a received character
1 1 = Framing Error, new startbit detected before end (last) stopbit
2 1 = Noise Error, receiver detected noise on its input line
3 1 = Receive buffer overrun.
The receive buffer is full and still more characters are received (and lost): the transmitting device did not stop transmitting after the RTS output was made inactive or the XOFF command was send (these signals are activated when the remaining free space in the receive buffer is < 25 characters)
4 RTS Status, handshake output, depending on handshake protocol:
 
  Meaning Hardware handshake Software handshake
0 Receive buffer almost full (less then 25 characters left) RTS output inactive (<-5 V) Send XOFF to stop data flow
1 Receive buffer Ok RTS output active (>+5V) Send XON to restart data flow
5

CTS Status, handshake input, depending on handshake protocol:

  Meaning Hardware handshake Software handshake
0 Receiving device cannot handle data flow CTS input inactive (<-5V) XOFF received from receiving device
1 Receiving device Ok CTS input active (>+5V) XON received from receiving device
 

The Parity/Framing/Noise error and Receive buffer overrun status will be cleared when characters are read from the receive buffer by command 0Ch or a character received event. This clearing will NOT generate a status Event.

Note Internal logic will prevent missing any set error statusbit (status bits 0-3).
These statusbits will only be cleared after reading the receive buffer when the status was actually read by command 0Eh or a status change event.

RS232 speed and CAN bus speed considerations

The maximum throughput of the RS232 / CAN system depends on RS232 baudrate, CAN bus speed and CDIOS controller latency.
The following tables assume that the RS232 is receiving data continuesly and that 5 received characters are transmitted in every CAN message.

RS232 Speed Time to receive5 characters CAN Speed Time to send message with 5 characters
38400 Baud 1.3 mS 1000 kBaud 120 µS
19200 Baud 2.6 mS 500 kBaud 240 µS
9600 Baud 5.2 mS 250 kBaud 480 µS
4800 Baud 10.4 mS 125 kBaud 960 µS
2400 Baud 20.8 mS  50 kBaud 2.4 mS
1200 Baud 41.7 mS  20 kBaud 6.0 mS
600 Baud 83.3 mS 10 kBaud 12.0 mS
300 Baud 166.7 mS    

Less CAN messages are needed when the 6190 is allowed to send its 'character received' event.

The CDIOS controlles checks the 6190 once a millisecond (when 8 or less I/O modules are connected to the CDIOS controller). It takes 200 µS for the CDIOS controller to get the data out of the 6190,  when multiple 6190 are receiving data, this time will overlap the CAN bus transmission, so the whole system will be faster.

The following table shows how many 6190 RS232 I/O modules one CDIOS controller can keep up with if all these modules are receiving data at full speed, events are enabled and no other CAN communication is taken place....

CAN Speed 1000k 500k 250k 125k 50k 20k 10k

RS232 Speed

38400 Baud 6 5 2 1 0 0 0
19200 Baud 12 9 5 2 1 0 0
9600 Baud 16 16 9 5 2 0 0
4800 Baud 16 16 16 10 4 1 0
2400 Baud 16 16 16 16 8 3 1
1200 Baud 16 16 16 16 16 6 3
600 Baud 16 16 16 16 16 13 6
300 Baud 16 16 16 16 16 16 13

Of course it is possible to connect more 6190 RS232 interface I/O modules then stated in this table, because the handshake system will stop the data flow when the system is too busy......

 


Home