Add custom overlay for MCP2517FD for Raspberry pi 4 for CAN bus FD

So, I am trying to interface with the can bus hat from seeed studio using the raspberry pi 4.

Link to Overlay

This new board uses the newer mcp2517fd chip instead of the notorious mcp2515 chip which is built into raspbian. I need to now add this overlay to


I see the


overlay. Of course resin-boot is read only so I have to do something before it starts up, but have no idea what that would be.

1 Like

Hi Drey!

I’m glad to see you’re still fighting! We’re working in the background to try and work out your Beaglebone Green issue with CANbus, but moving over to a more capable device might be a good step anyway.

So to this issue, you can use our special configurable variables to set DT Overlays:

This page gives some guidance for the overlay you’re trying to use:

Hope this helps. Keep going, we’ll get you sorted!


Hello! I also need overlay support for MCP2517FD for raspberry pi 3B+.
Can you provide instructions on how to add the custom overlay?
Thank you in advance

Hi there! Did you manage to load the overlay?

Hi @npetridis,

To include your custom overlay in a BalenaOS image you can open a PR in the balena-raspberrypi repository. Here’s an example PR on how to add your overlay

1 Like

Thank you very much Alexandru! A little more help here.
So the PR has three file changes:

  • layers/meta-balena-raspberrypi/conf/layer.conf
    Seems ok I’m just not sure if I should name my dtbo file 2xmcp2517fd or mcp2517fd. Should this be defined by how it is named in the raspberry kernel system?
  • layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-raspberrypi_%.bbappend
    Is straight forward
  • layers/meta-balena-raspberrypi/recipes-kernel/linux/linux-raspberrypi/0009-seeed studio-can-bus-v2-Add-dtbo-for-this-can-bus.patch
    About my patch file, should it have prefix 0001, 0009 or something else?

Concerning the content of the patch file, the diff is extracted from where? A quick search lead me here but I can’t find arch/arm/boot/dts/overlays/Makefile path
I use raspberry pi 3 model B maybe not the correct branch?
Also I have located 2xMCP2517FD.dtbo and 2xMCP2517FD-overlay.dts files here, should I add these files somehow of are they already located in raspberry os (not balena os).
Sorry for the noob questions first time trying to figure these out! Hopefully I will soon be able to contribute more independently!

heyo @npetridis,

the patched makefile is here - github always struggles with lots of files in a directory but going via url works…

1 Like

Hi all,

It seems this discussion is the closest to my similar problem.
First did you get something running with mcp2517fd ?

In my case, I want to use a Seed 2x CAN FD channel HAT based on mcp2518fd.

I have found that mcp251xfd-overlay.dts and new seeed-can-fd-hat-v2-overlay.dts exist in v5.4.y raspberrypi/linux repo.

My basics questions is how to get these file and compiled dtbo in the balenaOS ?

  • Do I need to recompile myself the balenaOS ?
  • Can I compile dts to dtbo with device-tree-compiler on my machine (is dtbo the same on all arch arm or arm64 ?)
  • Can I just try to add dtbo in /boot/overlays folder of balenaOS sdcard + adding “dtoverlay” setting in balenaCloud ?
  • How to get these dtbo in futur balenaOS release ?


To continue on my topic.

I clone and recompile the raspberrypi 5.4.y kernel for arm64 arch, just following this guide : Kernel building - Raspberry Pi Documentation.
Then I just copy the mcp25xfd.dtbo to resin-boot/boot/overlays partition, and add the correct dtoverlay parameters on balenaCloud device configuration :
Then my Seed HAT (a dual mcp2518fd without rtc) is correctly recognize.

So what’s next step ?
How to get this dts overlay included in next balenaOS release ?
I’m sure mcp2517 and mcp2518 including CAN FD will be used by many people.


Is it acceptable to you to load overlays dynamically, instead of making them part of the OS?
Check out this blog - Sensors and Data Logging with Embedded Linux - The Ultimate Guide Part 1 - which talks about how you could go about doing that.

Hi. Were you able to load those overlays dynamically?

Any updates on this thread? Has any one been able to use the MCP2518FD successfully?

Hey @westcoastdaz

Did you try the stuff in the blog post that was linked? Did you run into issues while following that?


Thanks for the reply. I haven’t had a chance to try yet as I’m waiting on hardware to be shipped. When you say blog post you mean Sensors and Data Logging with Embedded Linux

Hi @westcoastdaz,

You are correct - that is the blog post.

Is there a specific MCP2518FD device that you have in mind / on order? For instance, gregory above refers to the dts for a Seeed HAT.

Hi @westcoastdaz,

MCP2518FP support has been added for the Pi3 (32-bit) and balenaFin devices types in balenaOS 2.77.0+rev1, now available in production. The same will be true of the Pi4 device type in 2-4 weeks. If you need to experiment with a Pi4 now, note that the Pi4 now has the necessary kernel module mcp251xfd.ko, so in theory you can manually copy the mcp251xfd-overlay dtb and set RESIN_HOST_CONFIG_dtoverlay, but we have not tested this. Thank you for asking about MCP2518FP support - future CAN bus users will thank you.

1 Like


Thank you for the update and for helping get the Balena team to work on this! I will keep you posted with the testing.

Hi @westcoastdaz,

FYI, MCP2518FP support is now live for PI4. More specifically, balenaOS 2.80.3+rev1 for the “Raspberry Pi 4 (using 64bit OS)” device type now includes the mcp251xfd.dtbo overlay as well as the mcp251xfd.ko kernel module.

@rosswesleyporter Thank you very much. Given the fact that the MCP2515 is NRND, do you think the MCP2518 support will make it into other RPI Balena OS builds, such as RPI Zero W?


Good question. I’ll check on those plans including the Zero W.