CAN <-> RS-485 Gateway

Back to VSCP Modules

Current Hardware Version: 2 (Modtronix)
Current Firmware version: No release yet.



No firmware available yet.



This project implements a VSCP ↔ RS-485 Gateway based on the Modtronix SBC 28PC-IR4 card and implementing the VSCP RS-485 protocol.

It will handle a maximum of 127 RS-485 hardcoded nodes (address 128-254) on a segment and will automatically discover nodes that get added to the segment.

CAN buadrate is fixed to the 500kbps demanded by the VSCP standard and the RS-485 baudrate is set to 9600 for the same reasons. Word format is 8N1 with 9N1 used for addresses.

Hardware setup

  • RB7 is used for RS-485 direction control.
  • 10 MHz crystal must be mounted.


Zone information

Register 0(0x00) - Zone.
Register 1(0x01) - Subzone base for I/O.

Zone/subzone is not used at the moment but will maybe be used in the future.

General Module Settings

Register 3(0x03) - Module Control Register (R/W).
  • Bit 0 - 1 = Segment active. 0 = segment inactive.
  • Bit 1 - Reserved.
  • Bit 2 - Reserved.
  • Bit 3 - Reserved.
  • Bit 4 - Activate RS-485 incoming filter.
  • Bit 5 - Activate RS-485 outgoing filter.
  • Bit 6 - Reserved.
  • Bit 7 - One shot new node discovery. Nodes are found using a search on common intervals on all unused addressed. The interval is set in registers 24/25. If the bit is cleard new nodes are searched in bitween regular message pollings. so that


Register 8(0x08) - Device present bits 128-135 (R/W).
Register 9(0x09) - Device present bits 136-143 (R/W).
Register 10(0x0A) - Device present bits 144-151 (R/W).
Register 11(0x0B) - Device present bits 152-159 (R/W).
Register 12(0x0C) - Device present bits 160-167 (R/W).
Register 13(0x0D) - Device present bits 168-175 (R/W).
Register 14(0x0E) - Device present bits 176-183 (R/W).
Register 15(0x0F) - Device present bits 184-191 (R/W).
Register 16(0x10) - Device present bits 192-199 (R/W).
Register 17(0x11) - Device present bits 200-207 (R/W).
Register 18(0x12) - Device present bits 208-215 (R/W).
Register 19(0x13) - Device present bits 216-223 (R/W).
Register 20(0x14) - Device present bits 224-231 (R/W).
Register 21(0x15) - Device present bits 232-239 (R/W).
Register 22(0x16) - Device present bits 240-247 (R/W).
Register 23(0x17) - Device present bits 248-255 (R/W). (255 always clear as it is reserved).

There are a possibility to have 127 hardcoded devices present on the RS-485 bus with nicknames in the range 128 - 254. A set bit in this array represents an active device.

Register 24(0x18) - Time between node discovery in seconds (MSB) (R/W).
Register 25(0x19) - Time between node discovery in seconds (LSB) (R/W).

If set to a value less then 10 no node discovery will be performed and nodes can only be added by writing the device present array.


Register 26(0x1A) - Class Mask LSB for incoming traffic (R/W).
Register 27(0x1B) - Class Mask MSB for incoming traffic (R/W).
Register 28(0x1C) - Type Mask for incoming traffic (R/W).

Mask for traffic coming from CAN → RS-485

Register 29(0x1D) - Class Filter LSB for incoming traffic (R/W).
Register 30(0x1E) - Class Filter MSB for incoming traffic (R/W).
Register 31(0x1F) - Type Filter for incoming traffic (R/W).

Filter for traffic coming from CAN → RS-485

Register 32(0x20) - Class Mask LSB for outgoing traffic (R/W).
Register 33(0x21) - Class Mask MSB for outgoing traffic (R/W).
Register 34(0x22) - Type Mask for outgoing traffic (R/W).

Mask for traffic coming from RS-485 → CAN

Register 35(0x23) - Class Filter LSB for outgoing traffic (R/W).
Register 36(0x24) - Class Filter MSB for outgoing traffic (R/W).
Register 37(0x25) - Type Filter for outgoing traffic (R/W).

Filter for traffic coming from RS-485 → CAN

Register 38(0x26) - Overflow counter MSB (R/W).
Register 39(0x27) - Overflow counter LSB (R/W).

CAN bus bandwidth is much higher then RS-485 bandwidth and it is very possible that the RS-485 interface can't handle all traffic if a filter/mask is not set up correctly. This counter increments by one for each packet that is dropped because of this reason. The counter is not persistent.


modules/can485gateway.txt · Last modified: 2018/02/08 17:47 (external edit)
[unknown button type]
Except where otherwise noted, content on this wiki is licensed under the following license: Public Domain
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki