Back to Specification
Physical Level

VSCP over RS-232

Level I

:!: Preliminary

A byte stuffing binary interface is used to talk to the module through the serial interface.

The protocol is created for VSCP Level I events but can be used for other purposes also, as the 16 byte data content indicates. In this case the class and type bytes can be used freely by the implementor.

frame formats

[DLE]
[STX]
Operation
0 = No operation
1 = Level I event to/from node.
2 = Level II event to/from node.
3 = Poll for event.
4 = No events to send.
5 = CAN Frame.
10 = Reserved.
249 = Sent ACK.
250 = Sent NACK.
251 = ACK.
252 = NACK.
253 = error.
254 = Command Reply.
255 = Command.
Flags + bit nine of class
bit 0-4 - Number of databytes
bit 5 - Bit nine of Class.
bit 6-7 - Reserved and should be set to 0.
Channel
Sequence number
Class (Lower 8 bits).
Type
Data byte(s) 0 - 15
Frame checksum (counted from address (low 8-bits of it).
XOR checksum is used.
[DLE]
[ETX]

There can be 0 to 16 databytes.

The checksum is calculated from, and including, flags up to the last databyte.

The channel byte can be used to logically separate different channels on the same physical line. Typically this can also be a serial line with many nodes which are polled for data.

The sequence number byte marks a number for a sequence of a special frame. For instance four frame are send after each other and they will get different counter numbers. The NACK/ACKS that are responded from the node use the same counter values to separate the frames from others. Can, for example, be used to implement a sliding window protocol (http://en.wikipedia.org/wiki/Sliding_window).

As noted there can be two types of ACK's/NACK's one (251/252) is a general ACK/NACK that is the response when a frame is received and put in a buffer. This is generally all that is needed. The other version (249/250) can optionally be sent when the frame is actually sent on the interface.

Command frames have the following format

[DLE]
[STX]
255 = Command.
Flags
Bit 7-5 reserved.
bit 0-4 - Number of databytes.
Channel
Sequence number
Command MSB
Command LSB
Optional command Data byte(s) 0-15
Frame checksum
[DLE]
[ETX]

There can be 0 to 16 argument bytes.

When a command is sent their should always be a response. This response could be an ACK/NACK/Response/Error frame so all types should be expected.

Error frames have the following format

[DLE]
[STX]
253 = error.
Flags
Bit 7-5 reserved.
bit 0-4 - Number of databytes.
Channel
Sequence number
Error code MSB
Error code LSB
Optional error data byte(s) 0-15
Frame checksum
[DLE]
[ETX]

There can be 0 to 16 argument bytes.

Command Reply frames have the following format

[DLE]
[STX]
254 = response.
Flags
Bit 7-5 reserved.
bit 0-4 - Number of databytes.
Channel
Sequence number
Command Reply code MSB
Command Reply code LSB
Optional error data byte(s) 0-15
Frame checksum
[DLE]
[ETX]

There can be 0 to 16 argument bytes.

ACK frame have the following format

[DLE]
[STX]
251 = ACK.
Channel
Sequence number
Frame checksum
[DLE]
[ETX]

NACK frame have the following format

[DLE]
[STX]
252 = NACK.
Channel
Sequence number
Frame checksum
[DLE]
[ETX]

Special characters

The DLE character is sent as [DLE][DLE]

[DLE] = 0x10
[STX] = 0x02
[ETX] = 0x03

Sending CAN frames with the protocol

For generic CAN frames the operation byte is set to 5 The first four databytes form the CAN ID.
The four last databytes can be a timestamp (big endian).
Bit 31 (offset 0) of the id is Extended frame.
Bit 30 is remote frame.
Bit 29 is error frame.

Command codes

Command codes and data format is decided by the implementor.

Response codes

Response codes and data format is decided by the implementor.

Error codes

Error codes and data format is decided by the implementor.

vscp_specification_-_vscp_level_i_over_serial_links.txt · Last modified: 2010/08/19 01:55 (external edit)
Public Domain
www.chimeric.de Valid CSS Driven by DokuWiki do yourself a favour and use a real browser - get firefox!! Recent changes RSS feed Valid XHTML 1.0