Interfacing with MERG CBUS


CBUS is an open standard, to control layouts and accessories, as a layout control bus (LCB).  Physically it is based on CAN, which is an interface developed by Bosch, initially for use in vehicles.  There is a CAN port on the StaRFIshrail hub, which is used for communicating in CBUS format.
In the following description, it is assumed that you are familiar with MERG CBUS, and wish to operate your railway in CBUS mode.
The MERG CBUS has two operating modes, SLiM (Small Layout implementation Model), and FLiM (Full Layout implementation Model).  A StaRFIshrail hub can be set to either model.  The Ethernet port will connect to the MERG FCU program, and will act as a CANETHER module, so you can program the node number, and receive and send data from the FCU program.

SLiM mode

In this mode, the StaRFIshrail hub can act as if it were an extended RFID8 module.  The original RFID8 module had 8 possible RFID points, and used Node Numbers (NN) 65-81 (and CAN_IDs 65-81), with the Device Number (DN) from 20001 to 20128, thus allowing, in theory, up to 128 RFID points.
The StaRFIshrail hub uses the same NNs, 65-81, but uses different DNs.  In SLiM mode, the address switch is used to set the NN in the following formula
NN=Address Switch + 65.  This gives a NN of 65 for Address Switch position 0, 66 for Address switch position 1, up to 80 for Address switch position F.  There is a fixed formula for converting NNs to DNs for SLim Mode.  This is DN=(NN-65)*32 + Port Number + 16000  The Port Number on a StaRFIshrail hub goes from 1 to 32. This may seem an odd formula, but it means that NN=65 has DNs 16001 to 16032, NN=66 has DNs 16033-16064 etc.  There is a different (easier) formula for FLiM mode, where the NN numbers can be higher.
The Option Switch should be set to 0 or 1 or 2.
Option Switch = 0 - This sends DDES (tag ID entering RF field), ACON (for tag entering RF field) and ACOF (for tag exiting RF field)
Option Switch = 1 - This sends ACON (for tag entering field) and ACOF (for tag exiting RF field)
Option Switch = 2 - This sends DDES (tag ID entering RF field) - equivalent to CANRFID8 output (but at different DNs)
When connecting multiple hubs together, use SLiM mode, use a private bus only between the hubs (terminating at each end), and a single Ethernet connection to your computer control system, which can be on any of the hubs.

FLiM mode

In this mode, the StaRFIshrail hub can act as if it were an extended CANRFID8 module. To use this mode, you will need to connect the Ethernet as if it were a CANETHER module, and use the FCU program.  Once connected, you get into FLiM set-up in the usual way - press and hold the switch near the F and S LEDs until both lights go out, and the board should auto-enumerate it's CAN_ID, and ask for a Node Number.  The formula between the NN and the DN is DN= NN*32 + Port Number.  It is suggested you go high on the Node Number - a Node Number of 500 will give you DNs of 16001-16032, the same as Address 0 in SLiM mode.  The Address Switch is not taken into account in FLiM mode, but it you have more than one Hub on the CBus, then you will need to set them into FLiM mode separately - however, you can use the Ethernet on just one board. As per SLiM mode, see above, the Option Switch can be set to 0 or 1 or 2 - this can be done at any time, and does not affect being in FLiM mode.  As with all MERG modules, the mode will hold during a power down.

Using CBUS

If you have just a few hubs on your system, and are using it in without going to JMRI or RocRail, then just treat the StaRFIshrail hub as if it were any normal CBUS module.
If you have many hubs in your system, and are connecting to JMRI or RocRail or another computer based control system, then you should use the CBUS in SLiM mode, having a different address for each hub.  In addition, you should run a CBUS bus just for the hubs, as this will mean that the CBUS will not be over-run with data.  JMRI can handle several CBUS connections simultaneously, so in practice you can use the StaRFIshrail hub as a CANETHER board, so, if for instance, you had 8 hubs in a system, and wanted to feed into JMRI, 7 hubs could be connected together on a "private" CBUS bus, and the 8th hub could be connected to your main CBUS bus, and then you just have 2 Ethernet connections into JMRI, and will not overload anything.
Note that each hub has a 120 ohm termination on the board, enabled by plugging in the link between the two left hand pins on the socket strip, labelled TERM.  These should be treated in the normal way with using CBUS.  If you don't need to terminate the bus, you can keep the link by connecting it between the centre pin and either either of the adjacent pins, ready for use if required.