Hardware Pinout Reference
M5Stack ↔ MCP2515 CAN Bus Module — SPI wiring for Jeep Grand Cherokee OBD-II
M5StickC S3 requires different pin assignments
The ESP32-S3 chip does not have GPIO 36 or GPIO 37, and GPIO 0 is a strapping pin — all three were used on the Plus 2 firmware. Use the pin mappings below and swap #include <M5StickCPlus2.h> for #include <M5Unified.h> before flashing.
M5StickC S3
ESP32-S3FN8 · 3.3 V GPIO
MCU
ESP32-S3FN8
Flash
8 MB
GPIO Voltage
3.3 V
SPI Bus
SPI2 / SPI3
WiFi
802.11 b/g/n
USB
Type-C (native USB)
MCP2515 CAN Bus Module
SPI CAN Controller · TJA1050 Transceiver
Interface
SPI
CAN Spec
2.0A / 2.0B
Max Speed
1 Mbps
Crystal
8 MHz
Supply
3.3 V / 5 V
Transceiver
TJA1050
Arduino IDE Setup for M5StickC S3
Install M5Stack board package
In Arduino IDE go to File → Preferences and add this URL to "Additional boards manager URLs":
https://m5stack.oss-cn-shenzhen.aliyuncs.com/resource/arduino/package_m5stack_index.json
Select the correct board
Go to Tools → Board → Boards Manager, search for "M5Stack", install the package, then select:
Tools → Board → M5Stack → M5StickC-S3
Replace the M5Stack library include
The M5StickCPlus2 library does not support the S3. Use M5Unified instead:
// Remove: #include <M5StickCPlus2.h> // Add: #include <M5Unified.h>
Install mcp_can library
In Arduino IDE go to Sketch → Include Library → Manage Libraries, search for:
mcp_can (by coryjfowler)
Physical Pin Identification Guide
The M5StickC S3 has no G-number labels on the hardware. Use the diagrams below to identify each pin by its physical position on the connector.
Bottom HAT Connector — 8-pin header (underside of device)
bottom edge (USB-C side faces up)
← Pin 1 (GND) Pin 8 (3V3) →
Grove Port — 4-pin JST connector (right side of device)
How to orient the connector: Hold the M5StickC S3 with the screen facing you and the USB-C port at the top. The 8-pin HAT header is on the bottom edge. Pin 1 (GND, black) is on the left, Pin 8 (3V3, red) is on the right. The small triangle or notch on the PCB silkscreen marks Pin 1.
SPI Signal Wiring
| M5Stick Pin | Function | Wire | MCP2515 Pin | Function |
|---|---|---|---|---|
| G13 | SPI MOSI | SI | MOSI In | |
| G4 | SPI MISO | SO | MISO Out | |
| G14 | SPI CLK | SCK | Clock | |
| G12 | SPI CS | CS | Chip Select | |
| G38 | INT (optional) | INT | Interrupt |
Power & Ground
| M5Stick Pin | Function | Wire | MCP2515 Pin | Function |
|---|---|---|---|---|
| 3V3 | 3.3 V Out | VCC | Power In | |
| GND | Ground | GND | Ground |
CAN Bus → OBD-II Connector
MCP2515 Module Output
OBD-II J1962 Connector (relevant pins)
Wiring Overview Diagram
M5StickC S3 (ESP32-S3) MCP2515 Module
┌─────────────────────┐ ┌──────────────────┐
│ G13 (MOSI) ────────┼──── yellow ──────┼── SI │
│ G4 (MISO) ────────┼──── blue ──────┼── SO │
│ G14 (CLK) ────────┼──── orange ──────┼── SCK │
│ G12 (CS) ────────┼──── green ──────┼── CS │
│ G38 (INT) ────────┼──── purple ──────┼── INT (optional) │
│ 3V3 ────────┼──── red ──────┼── VCC │
│ GND ────────┼──── black ──────┼── GND │
└─────────────────────┘ │ │
│ CANH ───────────┼── OBD-II Pin 6
│ CANL ───────────┼── OBD-II Pin 14
└──────────────────┘GPIO 36 and GPIO 37 do NOT exist on the ESP32-S3. Do not use the Plus 2 pin assignments — they will cause a boot failure or no-op.
GPIO 0 is a strapping pin on the ESP32-S3 and controls boot mode. Never use GPIO 0 as MOSI on the S3.
Verify your MCP2515 breakout board operates at 3.3 V. Some modules are 5 V only and will damage the S3 GPIO pins.
Arduino IDE board selection: open Boards Manager, install "M5Stack" package, then select Tools → Board → M5Stack → M5StickC-S3.
Replace #include <M5StickCPlus2.h> with #include <M5Unified.h>. M5Unified works across all M5Stack devices including the S3 and requires no other code changes for basic init.
SPI.begin(SCK, MISO, MOSI, CS) syntax is identical on ESP32-S3 — only the pin numbers change.
Jeep Grand Cherokee HS-CAN runs at 500 kbps. Set MCP2515 bitrate to CAN_500KBPS in firmware.
Use twisted-pair wire for CANH/CANL runs longer than ~10 cm to reduce noise.
The MCP2515 module typically includes a built-in 120 Ω termination resistor. The Jeep bus already has terminators — you may need to remove the module resistor if you see bus errors.
Recommended library: mcp_can by coryjfowler (GitHub: coryjfowler/MCP_CAN_lib) — compatible with ESP32-S3 without modification.
Arduino / M5Stack Firmware SnippetM5StickC S3
#include <M5Unified.h> // replaces M5StickCPlus2.h for S3
#include <mcp_can.h>
#include <SPI.h>
#define CAN_CS_PIN 12 // G12
#define CAN_INT_PIN 38 // G38 (optional)
MCP_CAN CAN(CAN_CS_PIN);
void setup() {
M5.begin();
// SCK=G14, MISO=G4, MOSI=G13, CS=G12
SPI.begin(14, 4, 13, 12);
if (CAN.begin(MCP_ANY, CAN_500KBPS, MCP_8MHZ) == CAN_OK) {
Serial.println("MCP2515 init OK");
}
CAN.setMode(MCP_NORMAL);
}
void loop() {
if (CAN.checkReceive() == CAN_MSGAVAIL) {
long unsigned int rxId;
unsigned char len;
unsigned char rxBuf[8];
CAN.readMsgBuf(&rxId, &len, rxBuf);
// Process OBD-II frame here
}
}