This project provides a modular, unified interface for CAN bus communication on ESP32, supporting multiple hardware backends (TWAI, MCP2515 single/multi, Arduino) and a suite of ready-to-use examples. It is designed for easy switching between different CAN controllers and for rapid prototyping or testing of CAN networks with ESP32.
- Unified API for multiple CAN backends (TWAI, MCP2515 single/multi, Arduino)
- Example applications for sending/receiving CAN messages (polling/interrupt)
- Easy configuration via Kconfig (menuconfig)
- Python-based flash manager with GUI for multi-device workflows
- Built-in TWAI (SN65HVD230) — ESP32's native CAN controller
- MCP2515 single controller — via SPI, for external CAN modules
- MCP2515 multi-controller — for setups with multiple MCP2515 chips
- Arduino CAN port (experimental, not yet implemented)
send_single— Send CAN messages (single controller)receive_poll_single— Receive CAN messages (polling, single controller)receive_interrupt_single— Receive CAN messages (interrupt, single controller)send_multi— Send CAN messages (multi-controller)receive_poll_multi— Receive CAN messages (polling, multi-controller)receive_interrupt_multi— Receive CAN messages (interrupt, multi-controller)
- A 120-ohm termination resistor should be placed at one end of the bus only.
- Custom GPIO assignments are possible (see code).
- Either SPI1 or SPI2 may be used.
idf.py menuconfig # Select CAN backend and example
idf.py build
idf.py -p /dev/ttyACM0 flashThe flash_manager.py tool provides a comprehensive Textual-based GUI for managing ESP32 development workflows. It simplifies the entire build-flash-monitor cycle through an intuitive terminal interface, automatically detecting connected devices and handling ESP-IDF environment setup. Ideal for projects with multiple ESP32 boards requiring different configurations.
python3 flash_manager.pyThe Build & Flash tab streamlines firmware deployment:
- Auto-detects connected ESP32 devices (ttyACM*, ttyUSB*)
- Select CAN backend (TWAI, MCP2515 single/multi) and example application per device
- Validates configuration dependencies automatically
- Manages isolated build workspaces for each lib/example combination
- Displays real-time compilation output with color-coded logging
- Handles complete workflow: configuration → build → flash in one click
- Uses optimal parallel jobs based on available CPU and memory
The Serial Monitors tab enables real-time device monitoring:
- Open multiple serial monitors simultaneously for connected devices
- Real-time output streaming with configurable buffering
- Start/Stop individual monitors without affecting others
- Hide/Show monitor logs while keeping background logging active
- Automatic port detection and fake ports for testing
- Character-by-character or buffered output display
- Supports monitoring alongside build operations
components/— Modular CAN backends and dispatcherexamples/— Example applicationsmain/— Project entry point and Kconfig configurationpy/— Python flash manager tool with GUI and backend logicdoc/— Documentation and wiring diagrams
MIT License — see LICENSE
Author: Ivo Marvan, 2025


