User Tools

Site Tools


arduino:rcan-en

Differences

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

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
arduino:rcan-en [2020/07/01 07:52] – [CBus] rjversluisarduino:rcan-en [2024/03/13 09:21] (current) rjversluis
Line 1: Line 1:
 ====== RCAN: GC2a ====== ====== RCAN: GC2a ======
 +
 +
  \\  \\
 {{:arduino:gc2a-module.jpg?0x240}}{{:cbus:can-extframe.jpeg?0x240}}\\ {{:arduino:gc2a-module.jpg?0x240}}{{:cbus:can-extframe.jpeg?0x240}}\\
  \\  \\
 =====Introduction===== =====Introduction=====
 +{{ :arduino:rcan.jpg?0x200}}
 The current __**[[:cbus:overview-en|CAN-GC*]]**__ hardware serie is based on MC PICs.\\ The current __**[[:cbus:overview-en|CAN-GC*]]**__ hardware serie is based on MC PICs.\\
 RCAN is firmware for CAN based solutions on the Arduino platform.\\ RCAN is firmware for CAN based solutions on the Arduino platform.\\
-The firmware target is the Arduino Nano __**[[https://www.microchip.com/wwwproducts/en/atmega328pb|ATmega328P(B)]]**__.\\+The firmware target is the Arduino Nano and __**[[https://store.arduino.cc/products/arduino-nano-every|Nano Every]]**__.\\
  
  \\  \\
  
 =====Dependencies===== =====Dependencies=====
-{{ :arduino:rcan.jpg?0x200}} +{{:arduino:rcan:mcp_can.jpg?400}}\\ 
-The only not standard Arduino library used is +Add the **mcp_can** library in the Arduino IDE to be able to communicate with the MCP2515 chip.\\
-  https://github.com/coryjfowler/MCP_CAN_lib +
-to be able to communicate with the MCP2515 chip.\\+
 ====Modifications==== ====Modifications====
-Two modifications in the library source code are to disable DEBUG to save memory, and increase the timeout value in the ''Documents/Arduino/libraries/MCP_CAN_lib-master/mcp_can_dfs.h'': (line 40 and 45)\\+One modification in the library source code is to disable DEBUG to save memory in the\\ 
 +   ''Documents/Arduino/libraries/mcp_canr/mcp_can_dfs.h'': (line 41)\\
 <code cpp> <code cpp>
 // if print debug information // if print debug information
 +#ifndef DEBUG_MODE
 //#define DEBUG_MODE 1 //#define DEBUG_MODE 1
- +#endif
-/* +
-   Begin mt +
- */ +
-#define TIMEOUTVALUE    100+
 </code> </code>
-The original TIMEOUTVALUE of 50 is too low and brings errors on sending frames in a CAN bus. (Depends on how much traffic is on the CAN bus.)\\ 
 __It is very important to disable DEBUG_MODE otherwise there is not enough memory available. The Arduino IDE will complain about this, and RCAN will reboot continuously.__\\  __It is very important to disable DEBUG_MODE otherwise there is not enough memory available. The Arduino IDE will complain about this, and RCAN will reboot continuously.__\\ 
  \\  \\
  
 =====GPIO Board===== =====GPIO Board=====
-The difference between the standard PIC based and Arduino boards is the FLAT addressing scheme, and only support long events. (Long/Short events are detected in Rocrail automatically.) \\ +The difference between the standard PIC based and Arduino boards is the FLAT addressing scheme, and only support long events.  
-{{ :arduino:pin_arduino_nano.jpg?200}}+(Long/Short events are detected in Rocrail automatically.) \\ 
 +{{ :arduino:pin_arduino_nano.jpg?200}}{{ :arduino:nano-every-pinout.jpg?240}}
 The GPIO is compatible with the __**[[:can-gca2-en|CANGC2]]**__. (Except of the addressing scheme.)\\ The GPIO is compatible with the __**[[:can-gca2-en|CANGC2]]**__. (Except of the addressing scheme.)\\
 | Nano's with the ATmega328**P** __cannot use port A6 and A7__ as digital I/O, and are only available as input with analogRead. | | Nano's with the ATmega328**P** __cannot use port A6 and A7__ as digital I/O, and are only available as input with analogRead. |
  \\  \\
-====Input only pins on ATmega328P==== +====Input only pins on Nano ATmega328P==== 
-^ Nano Pin ^ GC2a ^ ArduCAN-IO +|< >| 
-|  A6  |  10   | +^ Nano Pin ^ GC2a ^ 
-|  A7  |  9  |   |+|  A6  |  10  | 
 +|  A7  |  9  | 
 + 
 + 
 +**Note 1:** //Use a __**[[https://store.arduino.cc/products/arduino-nano-every|Nano Every]]**__ to be able to use GC2a port 9 and 10 as output too.//\\ 
 +**Note 2:** //For best performance a **16MHz crystal** should be used.//\\
  
 ====Variables==== ====Variables====
Line 67: Line 71:
 |  1  |  1  | Output pulse | Pulse length according the global node configuration. | |  1  |  1  | Output pulse | Pulse length according the global node configuration. |
 |  2  |  1  | Invert | Invert the digital port value. | |  2  |  1  | Invert | Invert the digital port value. |
-|  3  |  1  | IR port | Not used. | 
 |  4  |  1  | Sync | Synchronise output also with the SYNCID | |  4  |  1  | Sync | Synchronise output also with the SYNCID |
  
Line 74: Line 77:
 //The CBUS protocol is copyrighted by Mike Bolton & Gil Fuchs.//\\ //The CBUS protocol is copyrighted by Mike Bolton & Gil Fuchs.//\\
 ^ CBUS->RCAN ^ Rocrail ^ Range ^ Remark ^ ^ CBUS->RCAN ^ Rocrail ^ Range ^ Remark ^
-| Event node number -> CANID | Bus | 0...127 (default 127) | CBUS uses the 4 MSBits for priority. (The standard CAN Frame ID is 11 bit.) |+| Event node number -> CANID | Node-ID | 0...127 (default 127) | CBUS uses the 4 MSBits for priority. (The standard CAN Frame ID is 11 bit.) |
 | Event address -> Port | Address | 1...16 (fixed) | This is the __**[[:can-gca2-en#setup|Port Number]]**__. | | Event address -> Port | Address | 1...16 (fixed) | This is the __**[[:can-gca2-en#setup|Port Number]]**__. |
 Module node number and module CANID are the same and just one value in the firmware.\\ Module node number and module CANID are the same and just one value in the firmware.\\
Line 109: Line 112:
 | 8m | Set MCP2515 clock speed to 8MHz. (default)  | 8m | Set MCP2515 clock speed to 8MHz. (default) 
 | 16m | Set MCP2515 clock speed to 16MHz.  | 16m | Set MCP2515 clock speed to 16MHz. 
-l0 Set pin layout to fit the CANGC2a. (default) -> Push the reset button to make changes active. |  +gpio 16 port I/O  |  
-l1 Set pin layout to fit the ArduCAN-I/O -> Push the reset button to make changes active. +servo 4 port servo and 12 port I/O  | 
 | =<id> | Set the CANID. Replace <id> with a number between 1 and 255. |  | =<id> | Set the CANID. Replace <id> with a number between 1 and 255. | 
 +| $pppppppppppppppp | Configure multiple ports: The <p> maybe: 0 for output, 1 for input, 2 for input with off delay, 3 for pulse output. \\ Example: "$1111" will configure port 1 to 4 as input. |
 | #<port><config> | Configure a port. Replace <port> with a character between 0...9 and a...f. \\ The <config> maybe: 0 for output, 1 for input, 2 for input with off delay, 3 for pulse output. \\ Example: "#a1" will configure port 10 as input.| | #<port><config> | Configure a port. Replace <port> with a character between 0...9 and a...f. \\ The <config> maybe: 0 for output, 1 for input, 2 for input with off delay, 3 for pulse output. \\ Example: "#a1" will configure port 10 as input.|
 | :SxxxxNxx...xx; \\ :XxxxxxxxxNxx...xx; | ASCII frame which will be send on the CAN bus and evaluated by the board. (GridConnect scheme as used by MERG CBUS.) \\ See chapter 10 of the MERG "Developer’s Guide for CBUS". | | :SxxxxNxx...xx; \\ :XxxxxxxxxNxx...xx; | ASCII frame which will be send on the CAN bus and evaluated by the board. (GridConnect scheme as used by MERG CBUS.) \\ See chapter 10 of the MERG "Developer’s Guide for CBUS". |
Line 177: Line 181:
   * Linefeed   * Linefeed
 With this option, the GC2a can also be used standalone; The minimal CBUS setup.\\ With this option, the GC2a can also be used standalone; The minimal CBUS setup.\\
-> Note: Because the [[https://en.wikipedia.org/wiki/CAN_bus#ACK_slot|ACK slot bit]] will not be set by other CAN modules, a send error will be reported, but can be ignored in standalone mode.+> Note 1: Because the [[https://en.wikipedia.org/wiki/CAN_bus#ACK_slot|ACK slot bit]] will not be set by other CAN modules, a send error will be reported, but can be ignored in standalone mode
 +> Note 2: For best performance a 16MHz crystal should be used
  \\  \\
  
Line 190: Line 195:
  
  \\  \\
 +
 =====Source Code===== =====Source Code=====
 +  * {{:arduino:rcan:arduino-rcan.zip}}
   * https://gitlab.com/rocrail/Arduino/tree/master/RCAN   * https://gitlab.com/rocrail/Arduino/tree/master/RCAN
-  * https://github.com/coryjfowler/MCP_CAN_lib (Original with a too small timeout value and DEBUG active.) 
  
 ====Documentation==== ====Documentation====
arduino/rcan-en.1593582744.txt.gz · Last modified: 2020/07/01 07:52 by rjversluis