Skip to content

Commit 761f6cc

Browse files
committed
Add default pins for Arduino MKR CAN shield
when using Arduino SAMD that is not the Arduino Zero
1 parent b2a4791 commit 761f6cc

File tree

2 files changed

+8
-0
lines changed

2 files changed

+8
-0
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ An Arduino library for sending and receiving data using CAN bus.
77
## Compatible Hardware
88

99
* [Microchip MCP2515](http://www.microchip.com/wwwproducts/en/en010406) based boards/shields
10+
* [Arduino MKR CAN shield](https://store.arduino.cc/arduino-mkr-can-shield)
1011
* [Espressif ESP32](http://espressif.com/en/products/hardware/esp32/overview)'s built-in [SJA1000](https://www.nxp.com/products/analog/interfaces/in-vehicle-network/can-transceiver-and-controllers/stand-alone-can-controller:SJA1000T) compatible CAN controller with an external 3.3V CAN transceiver
1112

1213
### Microchip MCP2515 wiring

src/MCP2515.h

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,16 @@
1010

1111
#include "CANController.h"
1212

13+
#if defined(ARDUINO_ARCH_SAMD) && defined(USB_VID) && (USB_VID == 0x2341) && !defined(ARDUINO_SAMD_ZERO)
14+
// Arduino MKR board: MKR CAN shield CS is pin 3, INT is pin 7
15+
#define MCP2515_DEFAULT_CLOCK_FREQUENCY 16e6
16+
#define MCP2515_DEFAULT_CS_PIN 3
17+
#define MCP2515_DEFAULT_INT_PIN 7
18+
#else
1319
#define MCP2515_DEFAULT_CLOCK_FREQUENCY 16e6
1420
#define MCP2515_DEFAULT_CS_PIN 10
1521
#define MCP2515_DEFAULT_INT_PIN 2
22+
#endif
1623

1724
class MCP2515Class : public CANControllerClass {
1825

0 commit comments

Comments
 (0)