arduino:rcan-en
Differences
This shows you the differences between two versions of the page.
Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
arduino:rcan-en [2021/12/25 09:29] – rjversluis | arduino:rcan-en [2024/03/13 09:21] (current) – rjversluis | ||
---|---|---|---|
Line 1: | Line 1: | ||
====== RCAN: GC2a ====== | ====== RCAN: GC2a ====== | ||
+ | |||
+ | |||
\\ | \\ | ||
{{: | {{: | ||
\\ | \\ | ||
=====Introduction===== | =====Introduction===== | ||
+ | {{ : | ||
The current __**[[: | The current __**[[: | ||
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:// |
\\ | \\ | ||
=====Dependencies===== | =====Dependencies===== | ||
- | {{ : | + | {{: |
- | 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.\\ |
- | | + | |
- | to be able to communicate with the MCP2515 chip.\\ | + | |
====Modifications==== | ====Modifications==== | ||
- | Two modifications | + | One modification |
+ | '' | ||
<code cpp> | <code cpp> | ||
// if print debug information | // if print debug information | ||
+ | #ifndef DEBUG_MODE | ||
//#define DEBUG_MODE 1 | //#define DEBUG_MODE 1 | ||
- | + | #endif | |
- | /* | + | |
- | | + | |
- | */ | + | |
- | #define TIMEOUTVALUE | + | |
</ | </ | ||
- | 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.) \\ | ||
{{ : | {{ : | ||
The GPIO is compatible with the __**[[: | The GPIO is compatible with the __**[[: | ||
| 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 | ||
+ | **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: " | | $pppppppppppppppp | Configure multiple ports: The <p> maybe: 0 for output, 1 for input, 2 for input with off delay, 3 for pulse output. \\ Example: " | ||
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:// | + | > Note 1: Because the [[https:// |
+ | > Note 2: For best performance a 16MHz crystal should be used. | ||
\\ | \\ | ||
Line 190: | Line 195: | ||
\\ | \\ | ||
+ | |||
=====Source Code===== | =====Source Code===== | ||
+ | * {{: | ||
* https:// | * https:// | ||
- | * https:// | ||
====Documentation==== | ====Documentation==== |
arduino/rcan-en.1640420956.txt.gz · Last modified: 2021/12/25 09:29 by rjversluis