Use of Node Variables (NV) in CBUS (compatible) devices.

Post Reply
henri62
Posts: 7
Joined: 07.09.2017, 23:23

Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 17.06.2018, 11:49

Who is responsible for defining the NV's in CBUS devices?

Currently CV's for loco's are in turn mostly defined by NMRA with possible vendor extensions.
But for NVs of CBUS boards no documentation can be found anywhere.
Maybe it is wise to document it here?

This is important to know because you cannot make any board without adjusting the control software (in the case rocrail) to support the board unless there is an agreement on how they are used.
Or at least a basic set of it.

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 17.06.2018, 13:12

MERG ist owner of the CBUS documentation; Ask it in the MERG forum.
The basic event addressing is documented in FLiM. CANGC2 needs more then this and therefore the NVs are used as you can see in the Firmware.
Standard is whats documented, the rest is up to you.

henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 17.06.2018, 14:38

But MERG does not know about the GC2.

So when I'm going to make a new device for CBUS how can it be supported in rocrail?
What is lacking is the way how to configure the device itself.
Create my own programming tool to configure it?

Currently rocrail supports programming of GCxx modules but that's it.

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 17.06.2018, 14:43

henri62 wrote:Currently rocrail supports programming of GCxx modules but that's it.
thats not correct. http://wiki.rocrail.net/doku.php?id=can-gc6-en#setup Is your Rocrail install not up to date?
The standard way of programming are Node Variables and Node Events, which Rocrail supports:
http://wiki.rocrail.net/doku.php?id=cbu ... #variables
You can program the CANGC2 also with those variables and events. The GC2 tab only makes it a bit easier to configure it but the programming is only with variables and events.
NVs are device dependent, and are NOT normed.

henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 17.06.2018, 15:16

rjversluis wrote:
henri62 wrote:Currently rocrail supports programming of GCxx modules but that's it.
thats not correct. http://wiki.rocrail.net/doku.php?id=can-gc6-en#setup Is your Rocrail install not up to date?
(Yes it is up to date.) Actually we tell the same: Rocrail supports the GCxx module programming (all known devices are there) this is a convenience not to have to puzzle out the details.
The standard way of programming are Node Variables and Node Events, which Rocrail supports:
http://wiki.rocrail.net/doku.php?id=cbu ... #variables
You can program the CANGC2 also with those variables and events. The GC2 tab only makes it a bit easier to configure it but the programming is only with variables and events.
NVs are device dependent, and are NOT normed.
So now were getting to it: this part is not (very well) documented. Now that you are pointing it out with a link I see that apparently this tab shall be used to program the node variables. When searching the wiki (which by the way is horrible, but you can't do anything about it) you will not find this page.

But the documentation is so scarce that it is actually useless for most people except you, Peter and maybe 1 handful others (so only the real developers of the code).
At least you need to know very well what the node variables are, which as I pointed out, are nowhere to find.

So I have 2 options to create my gateway:
1) Implement it exactly as the GC2 and emulate multiple boards for each 16 I/O's I have. Then I can use the GC2 programing tab.
But one board will now be seen as multiple nodes when I connect for example 2 or more 16 bits I/O devices (up to 12 boards are planned).
(Still I need some extra NV to configure the attached boards, but outside of the known range).

2) Implement my own scheme and hack the configuration into the board via the node variables?

But will this work?

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 17.06.2018, 15:38

It makes no sense to use the GC2 setup for something completely different.
Just use the Variable and Event Tab of the Rocrail CBUS Flim dialog.
Some NVs are normed, like Node ID; Just check the MERG CBUS Documentation/Wiki.
Most manufacturers of Hardware supply there own Windows Utility for configuring it.
(which by the way is horrible, but you can't do anything about it)
Thanks, I'm responsible for the English part of the Rocrail Wiki.

henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 17.06.2018, 16:37

The search is from DokuWiki and the results are bad to read, it DokuWiki to blaim I think, for example, look at this result http://wiki.rocrail.net/doku.php?do=sea ... ext=Search
rjversluis wrote:Some NVs are normed, like Node ID; Just check the MERG CBUS Documentation/Wiki.
Most manufacturers of Hardware supply there own Windows Utility for configuring it.
It could have been solved with application plugins OR some means of creating a description scheme how and what are variables are made of (For example like CanOpen EDS files). In the latter case a generic tool can be made to configure anything you want.
rjversluis wrote:Some NVs are normed, like Node ID; Just check the MERG CBUS Documentation/Wiki.
As far as I know, nothing documented. Do you have a reference?


henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 18.06.2018, 18:23

Those are the Node Parameters (I already found them a while ago). Not the Node variables that I'm looking for.

The node variables should be documented for each device/board, in the case below it should be in the page of the GC2 node.
As far as I could reverse engineer there are 20 variables used:

#1 Looks like some flag bits to force saving the configuration?
#2 .. #17 The configuration of the 16 I/O pins, where #2 is port 1 etc.
#18 Port status 1-8
#19 Port status 9-16
#20 The CAN ID.

I/O port config value bits:
Bit 0 = 0 :Output pin, 1 = Input pin.
1 = 0: Normal, 1=Off delay for inputs (pulse stretching of 2 sec), when configured as output it is a pulse output of 0.5 sec. (despite of the dialog that suggests you can change it?)
2 = 0: Normal, 1=Invert port pin.
3 = 0: Normal, 1=Infrared pin.

Of course for all other GC# boards similar definitions should have been documented.

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 19.06.2018, 07:09

You can read this in the GC2 Firmware:

Code: Select all

        case OPC_NVSET:
            if (thisNN(cmsg)) {
                byte nvnr = cmsg->b[d3];
                if (nvnr == 1) {
                    NV1 = cmsg->b[d4];
                    eeWrite(EE_NV, NV1);
                } else if (nvnr < 18) {
                    Ports[nvnr - 2].cfg = cmsg->b[d4];
                    eeWrite(EE_PORTCFG + (nvnr - 2), Ports[nvnr - 2].cfg);
                    configPort(nvnr - 2);
                } else if (nvnr == 20) {
                    CANID = cmsg->b[d4];
                    eeWrite(EE_CANID, CANID);
                }

            }
            break;
NV 1 -> GC2 general options
NV 2..17 -> Port configuration
NV 20 -> CAN ID

henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 19.06.2018, 17:36

I got those from the GC2 sources (commands.c), the only thing not yet clear to me is the NV1. I will figure that out later.

Another thing not yet clear to me: Why is there a column (Programming->CBUS->GC2) with "Node Nr." it makes no sense to me because you select the board (via a double click in the index tab, show in the window title) and it should have a global NN. (They always show 0)

Also the event numbers themselves, where are these stored? Not in the board, because the NV's do not change when I fill in something. So how are these matched?
I would assume these are fixed for a node (0-15 or 1-16 or whatever) the node number is unique so the event. So I would expect just to assign a name to it (here called usage?) and use these events later in the program to act on.

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 20.06.2018, 09:45

The Event Node Number?
https://wiki.rocrail.net/doku.php?id=ca ... ort_events
CBUS supports long and short events.
Long events needs the node number too.

henri62
Posts: 7
Joined: 07.09.2017, 23:23

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by henri62 » 20.06.2018, 15:44

rjversluis wrote:Long events needs the node number too.
But shouldn't that be the node number of the board itself by definition? When it can be changed, you have a potential risk of conflicts?

rjversluis
Site Admin
Posts: 42359
Joined: 10.04.2006, 08:48
Location: Speyer, Germany
Contact:

Re: Use of Node Variables (NV) in CBUS (compatible) devices.

Post by rjversluis » 20.06.2018, 17:14

henri62 wrote:
rjversluis wrote:Long events needs the node number too.
But shouldn't that be the node number of the board itself by definition? When it can be changed, you have a potential risk of conflicts?
Use the MERG Forum for all protocol related questions; I did not invent the CBUS.

Post Reply

Return to “Wiki”