User Tools

Site Tools


cbus:can-gca2-firmware

Differences

This shows you the differences between two versions of the page.


cbus:can-gca2-firmware [2024/08/11 17:57] (current) – created - external edit 127.0.0.1
Line 1: Line 1:
 +====== CAN-GC2 Universal 16 bits I/O node for Cbus ======
 +[[:english|{{  rocrail-logo-35.png}}]]
 +[[:english|Content]] -> [[:english#hardware|Hardware]] -> [[:english#merg_cbus|MERG CBUS]]
 +  * [[:cbus:overview-en|CAN-GC Overview]]
 +  * [[:can-gca1-en|CAN-GC1]] | [[:can-gca1e-en|CAN-GC1e]] | **[[:can-gca2-en|CAN-GC2]]** | [[:can-gc3-en|CAN-GC3]] | [[:can-gc4-en|CAN-GC4]] | [[:can-gca5-en|CAN-GC5]] | [[:can-gc6-en|CAN-GC6]] |  [[:can-gc7-en|CAN-GC7]]
 +    * **[[:cbus:can-gca2-firmware|Firmware]]**
 +    * [[:cbus:flim-en#can-gc2|FLiM Setup]] 
 + \\
 +This page documents the HEAD revision of the firmware.\\
  
 + \\
 +
 +===== Firmware =====
 +
 +==== Copyrights ====
 +(c) [[http://www.merg.org.uk/|MERG]]\\
 +(c) [[http://www.rocrail.net|Rob Versluis, rocrail.net]]\\
 +
 +==== IDs ====
 +| NMRA Manufacturer ID |  70 |
 +| Product ID |  2 |\\
 +
 +==== HEX ====
 +  * Version: **2-2a** , resonator: **4MHz**
 +  * https://gitlab.com/rocrail/GCA/-/tree/master/cbus/cangc2.X/dist/default/production
 +
 +==== Sources ====
 +  * https://gitlab.com/rocrail/GCA/tree/master/cbus
 +
 +
 + \\
 +
 +===== Node Variables =====
 +^ # ^ Description ^
 +|  1 | node configuration |
 +|  2-17 | Port 1-16 configuration |
 +|  18 | state of port 1-8  (read only) |
 +|  19 | state of port 9-16  (read only) |
 +|  20 | CAN-ID |
 +
 + \\
 +
 +===== Node configuration byte =====
 +^ Bit ^  Function  ^
 +|  0 | save output states at power off command |
 +|  1 | use short events |
 +|  2, 3 | pulse time: 0x00=250ms, 0x04=500ms, 0x08=1000ms, 0x0C=2000ms |
 +
 +
 +
 +
 + \\
 +
 +===== Port configuration byte =====
 +^ Bit |  Function  ||
 +|  0 ^ 1=Input ^ 0=Output ^
 +|  1 | 0=direct reporting\\ 1=delayed reporting for occupancy detection. | 0=pulse\\ 1=continuous |
 +|  2 | 1=inverted ||
 +
 + \\
 +
 +===== Node Events =====
 +  * Inputs will generate OPC_ACON/OPC_ACOF events.
 +  * IR-Inputs will generate OPC_ACON3 events with loco address in extra byte 5-6 and the train category in 7.
 +  * A "Start of Day" event will trigger all inputs to report their status.
 +  * Outputs will change status on OPC_ACON/OPC_ACOF.
 +
 +^ Event# ^ Description ^ Variable ^
 +|  0-15 | port 1...16 | not used |
 +|  16 | SoD (start of day) | not used |
 +
 +
 + \\
 +
 +===== I/O Mapping =====
 +^ Poort ^ PICbit ^ Connector ^
 +|   CAN | RB2/RB3 | - |
 +|   FLiM switch | RA2 | - |
 +|   LED1 | RB6 | - |
 +|   LED2 | RB7 | - |
 +|   LED3 | RB5 | - |
 +|   1 | RA0 | J4 |
 +|   2 | RA1 | J4 |
 +|   3 | RA3 | J4 |
 +|   4 | RA4 | J4 |
 +|   5 | RA5 | J4 |
 +|   6 | RB0 | J4 |
 +|   7 | RB1 | J4 |
 +|   8 | RB4 | J4 |
 +|   9 | RC0 | J3 |
 +|  10 | RC1 | J3 |
 +|  11 | RC2 | J3 |
 +|  12 | RC3 | J3 |
 +|  13 | RC7 | J3 |
 +|  14 | RC6 | J3 |
 +|  15 | RC5 | J3 |
 +|  16 | RC4 | J3 |
 +
 + \\
 +=====Supported Opcodes=====
 +^ Request ^ Response ^ Remark ^
 +| OPC_ASRQ | OPC_ARON,OPC_AROF |
 +| OPC_ACON | - |  |
 +| OPC_ASON | - |  |
 +| OPC_ACOF | - |  |
 +| OPC_ASOF | - |  |
 +| OPC_RQNPN | OPC_PARAN |
 +| OPC_SNN | - |
 +| OPC_RQNP | OPC_PARAMS |
 +| OPC_RTOF | - |
 +| OPC_NVRD | OPC_NVANS |
 +| OPC_NVSET | - |
 +| OPC_NNLRN | - |
 +| OPC_NNULN | - |
 +| OPC_EVLRN | - |
 +| OPC_NERD | OPC_ENRSP |
 +| OPC_NNCLR | - | [[:cbus:flim-en#reset_eeprom|Reset EEPROM]] |
 +| OPC_QNN | OPC_PNN | [[:cbus:flim-en#query|Query]] |
 + \\
 +^ Unsolicited ^
 +| OPC_ASON,OPC_ASOF |  
 +
 + \\
 +
 +===== LEDs =====
 +^ LED# ^ Color ^ Information ^ Remark ^
 +| 1 | green | CBUS activity. | With an off delay of 50ms which does not show the actual traffic on the CAN bus; Its just a human friendly indicator. |
 +| 2 | yellow | Event learning mode. | Blinking at a rate of 1Hz, otherwise this LED is off. Triggered by the FLiM switch. |
 +| 3 | red | Firmware started running the main loop. | There is a hardware/firmware problem if this LED does not illuminate. \\ It is normal that this LED flickers at CBUS activity; The main loop is interrupted. |
 +{{:cbus:gc2-pcb.png}}
 + \\
 +
 +===== Development Tools =====
 +  * MPLAB X v1.00
 +  * C18 v3.40
 +  * PICKit 3
 +  * **[[:pic-adap-en|PICKit3 Adapter]]**