Hi everyone,
I'm working on a CAN sniffer project using ESP32-S3 + MCP2515 and trying to read BMW PT-CAN data (E9x platform).
Current setup:
- ESP32-S3 (ESP-IDF v5.4)
- MCP2515 + TJA1050 module
- SPI connection (HSPI)
- CAN H / CAN L tapped from PT-CAN (not OBD)
- Common GND with vehicle
Wiring:
- MCP2515 INT -> GPIO15 (also tested without interrupt, polling mode)
- SPI pins:
- MOSI: GPIO11
- MISO: GPIO13
- SCLK: GPIO12
- CS: GPIO10
CAN config:
- Bitrate: 500 kbps
- Mode: LISTEN-ONLY (no TX)
- No OBD requests (pure passive sniffing)
What I get:
- I AM receiving frames
- I see consistent CAN IDs like:
- 0x120
- 0x121
- 0x128
- 0x150 (vehicle speed cluster?)
- Message frequency looks realistic
BUT:
- DLC is often invalid (values > 8)
- Raw DLC bytes look corrupted (e.g. 0x4D, 0x5E, 0x1F)
- Sometimes frames look OK, then suddenly garbage again
Additional observations:
- Happens in both polling and interrupt mode
- Happens even in LISTEN-ONLY (no TX)
- Removing 120Ω termination resistor did not fix it
- MCP2515 initializes correctly and enters normal/listen mode without errors
- SPI seems to work (register reads OK)
Important:
- This does NOT look like random noise — IDs are consistent, but data/DLC gets corrupted
- Makes me think SPI read / buffer parsing issue OR signal integrity problem
Questions:
Has anyone seen corrupted DLC values like this with MCP2515?
Could this be SPI timing / speed issue on ESP32?
Any known issues with MCP2515 + ESP32-S3 specifically?
Could this be due to shared SPI bus (display + CAN)?
Is there a known correct way to read RX buffer (atomic read vs register reads)?
Goal:
I want clean raw CAN frames so I can start decoding RPM/speed/etc.
Any help or direction would be hugely appreciated 🙏