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 [2021/12/25 09:29] 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 and Nano Every.\\+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.  
 +(Long/Short events are detected in Rocrail automatically.) \\
 {{ :arduino:pin_arduino_nano.jpg?200}}{{ :arduino:nano-every-pinout.jpg?240}} {{ :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 ^ ^ Nano Pin ^ GC2a ^
 |  A6  |  10  | |  A6  |  10  |
 |  A7  |  9  | |  A7  |  9  |
-**Note:** //Use a Nano Every to be able to use GC2a port 9 and 10 as output too.//\\+ 
 + 
 +**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 110: 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. 
 +| gpio | 16 port I/O  | 
 +| 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. | | $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. |
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.1640420956.txt.gz · Last modified: 2021/12/25 09:29 by rjversluis