![]() |
|---|
| CAN Bus Breakout MCP2518FD |
Breakout board for the Microchip MCP2518FD CAN FD controller with an ATA6561 CAN transceiver, driven over SPI. Supports CAN 2.0B and CAN FD, and brings CANH/CANL out on a screw terminal with a jumper-selectable 120 Ω termination resistor. The board is powered from 5 V; an on-board regulator supplies 3.3 V to the controller, so the SPI lines are 3.3 V logic. The controller is clocked from a 40 MHz crystal.
External ESPHome component for the Soldered CAN Bus Breakout. It is a port of the
Soldered MCP2518FD ESP-IDF component
(itself a port of the Arduino library)
and follows the upstream ESPHome MCP2515 component: the MCP2518FD is
a CAN bus platform, so the standard canbus.send action and on_frame
trigger work with it unchanged.
The component runs the controller in classic CAN 2.0 mode only. ESPHome's CAN bus API carries at most 8 data bytes per frame, so CAN FD frames (up to 64 bytes) are not supported.
- components/mcp2518fd/ - the ESPHome external component (Python config + C++ implementation)
soldered_mcp2518fd.c/.h,mcp2518fd_dfs.h- register level driver vendored from the ESP-IDF component; only the SPI, delay, logging and init glue differ from the original
- examples/ - example YAML configs showing how to use the component
basic.yaml- send a frame every second and log received frames on a 500 kbps busloopback.yaml- self-test that needs no CAN bus, useful for checking the SPI wiring
Reference this repo directly from your own ESPHome YAML (no need to clone it locally):
external_components:
- source: github://SolderedElectronics/Soldered-MCP2518FD-ESPHome-Component
components: [mcp2518fd]
spi:
clk_pin: GPIO18
mosi_pin: GPIO23
miso_pin: GPIO19
canbus:
- platform: mcp2518fd
id: can_bus
cs_pin: GPIO5
can_id: 0x100
bit_rate: 500KBPS
on_frame:
- can_id: 0x200
then:
- logger.log:
format: "Got %u bytes from 0x200"
args: ["x.size()"]
interval:
- interval: 1s
then:
- canbus.send:
canbus_id: can_bus
data: [0x01, 0x02, 0x03]See examples/basic.yaml for a full working example.
| Breakout | ESP32 |
|---|---|
| VCC | VCC |
| GND | GND |
| SCK | clk_pin |
| SDI | mosi_pin |
| SDO | miso_pin |
| nCS | cs_pin |
Received frames are found by polling the controller's RX FIFO over SPI on every main loop iteration, the same way the
upstream MCP2515 component works, so the INT pin does not need to be wired. All frames are accepted by the hardware;
on_frame filters them by can_id/can_id_mask in software.
The RX FIFO holds 16 frames. If the bus delivers frames faster than the main loop reads them, the oldest unread frames
are kept, new ones are dropped, and the component logs RX FIFO overflowed (at most once per second).
- cs_pin (Required, Pin): pin wired to the breakout's chip select (NCS).
- can_id (Required, int): default CAN ID used by
canbus.sendwhen it does not set its own. - bit_rate (Optional, enum): CAN bus bit rate. Defaults to
125KBPS. One of5KBPS,10KBPS,20KBPS,25KBPS,31K25BPS,33KBPS,40KBPS,50KBPS,80KBPS,83K3BPS,95KBPS,100KBPS,125KBPS,200KBPS,250KBPS,500KBPS,800KBPS,1000KBPS. (1KBPS,12K5BPSand16KBPSfrom the generic CAN bus list are not supported.) - clock (Optional, enum): oscillator frequency on the board. Defaults to
40MHZ, which is what the Soldered breakout is populated with. One of10MHZ,20MHZ,40MHZ. A wrong value scales every bit rate (e.g.20MHZon this board runs the bus at twice the configured rate). - mode (Optional, enum): operation mode. Defaults to
NORMAL.NORMAL- classic CAN 2.0 mode, sends and receives on the bus.LOOPBACK- internal loopback: frames are received by the controller itself and never reach the bus.LISTENONLY- receives without ever transmitting or acknowledging frames. CAN FD frames seen in this mode are dropped.
- use_extended_id (Optional, boolean): use 29-bit extended IDs for
can_id. Defaults tofalse. - spi_id (Optional, ID): the SPI bus to use, if you have more than one.
- data_rate (Optional): SPI clock. Defaults to
4MHz. The MCP2518FD runs in SPI mode 0 and accepts up to 0.85 × the oscillator frequency / 2 (17 MHz with the 40 MHz crystal); keep it low with long jumper wires. - on_frame (Optional, Automation): see the CAN bus documentation.
- All other options from CAN bus.
The register level code comes from the Microchip MCP2518FD SDK and the bit timing calculation from acan2517FD, via the Soldered ESP-IDF component and Arduino library.
You can find hardware design for this board in the CAN Transceiver MCP2518 board hardware repository.
Access library documentation here.
At Soldered, we design and manufacture a wide selection of electronic products to help you turn your ideas into acts and bring you one step closer to your final project. Our products are intented for makers and crafted in-house by our experienced team in Osijek, Croatia. We believe that sharing is a crucial element for improvement and innovation, and we work hard to stay connected with all our makers regardless of their skill or experience level. Therefore, all our products are open-source. Finally, we always have your back. If you face any problem concerning either your shopping experience or your electronics project, our team will help you deal with it, offering efficient customer service and cost-free technical support anytime. Some of those might be useful for you:
Soldered invests vast amounts of time into hardware & software for these products, which are all open-source. Please support future development by buying one of our products.
Check license details in the LICENSE file. Long story short, use these open-source files for any purpose you want to, as long as you apply the same open-source licence to it and disclose the original source. No warranty - all designs in this repository are distributed in the hope that they will be useful, but without any warranty. They are provided "AS IS", therefore without warranty of any kind, either expressed or implied. The entire quality and performance of what you do with the contents of this repository are your responsibility. In no event, Soldered (TAVU) will be liable for your damages, losses, including any general, special, incidental or consequential damage arising out of the use or inability to use the contents of this repository.
And thank you from your fellow makers at Soldered Electronics.

