CAN-GC3 - issue concerning address

RocNet(RaspberryPi), mergCBUS and LocoNet based hardware developed by Peter Giling. (GCA)
Documentation: http://wiki.rocrail.net/doku.php?id=english#hardware
Order information: http://wiki.rocrail.net/doku.php?id=gca:gca-index-en/

CAN-GC3 - issue concerning address

Postby Jberthing » 10.02.2013, 10:37

Hi,

I have just completed the CAN-GC1e, CAN-GC3 and the ORD-3.

According to the wiki site for the GC3, it should have a fixed address (CANID) at 114. But mine gets 242, when I do a query.

What could I have done wrong?

Regards,
Jesper
You do not have the required permissions to view the files attached to this post.
Jberthing
 

More information

Postby Jberthing » 11.02.2013, 11:17

Hi,

I have finalized the CAN-GC2 board as well and added it to the CAN network.

This board also get a different address than the one I set in the GUI. If I set CANID to 0, it gets address 128 when I do a query (see Address.png, below). But in the CAN-GC2 tab it has the address CANID = 0.

It seems that the other CANID get an offset of 128 (GC1e has the correct CANID of 11). E.g. CG1e: 242 - 128 = 114. CG2: 128 - 128 = 0.

The boards have the following firmware versions:
GC1e: 2.d
GC2: 1.h

I have tried connecting to the boards with a MAC and a Windows 7 - 64bit PC. Direct link and using a switch, same result.

Any suggestions are welcome.

Thanks in advance.

Regards,
Jesper
You do not have the required permissions to view the files attached to this post.
Jberthing
 

Postby phg » 12.02.2013, 16:13

Hello Jesper.

For the CAN-GC1e, that is exactly what I get.
I Personally never even looked at this GC3 ID.

GC2 is easy to set.
After query, double click GC2.
Press button on GC2, L2 is flashing.
Select tab NODE and in the bottom change node number, and press set.
That's all.
Best regards, herzliche Grüße, chaleureuses salutations, saludo cordial, migliori saluti, hjärtliga hälsningar, hartelijke groet,

Peter Giling (Rocrail - LNet(GCAxxx) - Fiddle Yard control GCA145 - CBUS (CAN-GCx)- RocNet (Raspberry Pi GCA-PIxx)
phg
 

Solved (maybe)

Postby Jberthing » 12.02.2013, 19:50

Hello Peter,

Thanks for the feedback. It is "good" to hear that others are also seeing the same.

I downloaded the source code for the CAN-GC3 and found a possible source of the bug in two files.

cancmd.c - line 432 to 442
Code: Select all
    // Setup ID
    NN_temp = DEFAULT_NN;
    Tx1[con] = 0;
    Tx1[sidh] = (0b10110000 | (FIXED_CAN_ID & 0x78) )>>3;
    Tx1[sidl] = (FIXED_CAN_ID & 0x07) << 5;

    // Setup TXB0 with high priority OPC_HLT
    TXB0SIDH = (0b01110000 | (FIXED_CAN_ID & 0x78)) >>3;
    TXB0SIDL = (FIXED_CAN_ID & 0x07) << 5;
    TXB0DLC = 1;
    TXB0D0 = OPC_HLT;


The problem is the following line
Code: Select all
Tx1[sidh] = (0b10110000 | (FIXED_CAN_ID & 0x78) )>>3;

it should have been
Code: Select all
Tx1[sidh] = (0b01110000 | (FIXED_CAN_ID & 0x78) )>>3;


can_send.c - line 41 to 50
Code: Select all
/*
 * Send a CAN frame where data bytes have already been loaded
 */
void can_tx(unsigned char dlc_val) {
   Tx1[dlc] = dlc_val;            // data length
   Tx1[sidh] &= 0b00001111;      // clear old priority
   Tx1[sidh] |= 0b10110000;      // low priority
   Latcount = 10;
   sendTX1();         
}

Where I have commented out the following two line, as they do not make sense for me :)
Code: Select all
   Tx1[sidh] &= 0b00001111;      // clear old priority
   Tx1[sidh] |= 0b10110000;      // low priority


The above modifications corrects the wrong listing of the CAN-GC3 address when performing a Query from Rocrail. See the attached image below.

Based on the above I will create a bug in Launchpad.

Regards,
Jesper
You do not have the required permissions to view the files attached to this post.
Jberthing
 

Postby aling » 13.02.2013, 12:33

Hi Jesper,

there is nothing wrong with the address 242-128 = 114.
Only the first seven bits form the address, the rest of 4 bits of the 11bit can-address are for the priority on the can-bus. Please read the MERG CBUS Document.


gruss
Achim
aling
 

Postby rjversluis » 13.02.2013, 13:37

Hi,

I will filter out the priority from the query list.
Best Regards, Rob.
:!: PS: Do not forget to attach the usual files.
:!: PS: Nicht vergessen die übliche Dateien an zu hängen.
[ macOS - Linux] - [ N: CBus - CAN-GCA ] - [ 0: RocNetNode - GCA-Pi ]
rjversluis
Site Admin
 

Postby Jberthing » 13.02.2013, 20:11

Hi Achim,

I will take a look into the addressing in the MERG CBUS Document.

Regards,
Jesper
Jberthing
 

Postby Jberthing » 13.02.2013, 20:59

Hi Achim,

Thanks, the reference to the MERG CBUS 4.0 Specification answered the question concerning the code in cancmd.c and can_send.c:

Code: Select all
Tx1[sidh] = 0b10110000 | (FIXED_CAN_ID & 0x78) >>3;


0b10110000, sets the priority bits concerning <MjPri> and <MinPri>.

@rjversluis, I think filtering the priority out is a good idea.

Regards,
Jesper

Ref:
http://wiki.rocrail.net/doku.php?id=cbus:protocol - MERC CBUS 4.0 Specification.
Jberthing
 


Return to GCA (Hardware by Peter Giling)

cron