maggusxy
Posts: 2
Joined: Sun Dec 23, 2018 2:01 pm

MCP2517 CANFD an CM3

Sun Dec 23, 2018 2:07 pm

Hi guys,

I'm working on a quite custom design with Raspberry CM3.
However I need a MCP2517FD which is connected via SPI. Now i started first tests with the EvaluationBoard and followed this guide here:
https://github.com/GBert/misc/tree/master/RPi-MCP2517

In generel this seems to work .... but... when using this git repository I'm actually replacing the kernel and device tree with the files from that git repository. And after some tests I found out, when using this special kernel from that Git you can use MCP2517FD then, but you don't have any support for USB or cameras anymore.

However I need also a working USB port and both camera ports.
I tried now to replace just the device-tree blob which is used before (to support USB and dual-camera) but together with that kernel from that git - but in this case the whole kernel doesn't start up at all.

So is there absolutely no other chance to get that MCP2517FD running without using an unknown kernel?

Thanks a lot
Markus

maggusxy
Posts: 2
Joined: Sun Dec 23, 2018 2:01 pm

Re: MCP2517 CANFD an CM3

Tue Dec 25, 2018 10:27 pm

Hi,

here a solution how I managed:

I setup a virtual ubuntu machine on my computer, then downloaded the official linux and tools repo like described here:

https://www.raspberrypi.org/documentati ... uilding.md

After this I found the source-code of the MCP2517FD driver - everything is described here how to change the Kconfig, the makefile and what's the content of the mcp2517fd.c
https://www.spinics.net/lists/devicetree/msg202889.html

After I did the "make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- bcm2709_defconfig" command, I opened the .config file with the gedit and set the mcp2517fd to "m".

Then I started compiling kernel, dtbs and modules.
After this I did a modules_install to a folder located in my home-directory.

After this just copy the modules folder to rpi into /lib/modules/4.... etc...
You can double check that in drivers/net/can/spi there is a filed named mcp2517fd.ko
After this copy the kernel to the device.

The approbriate device-tree overlay file I used the one provided by github
https://github.com/GBert/misc/tree/mast ... CP2517/bin

Then the mcp2517fd should work as dtoverlay

vojjta
Posts: 3
Joined: Thu Apr 11, 2019 9:26 am

Re: MCP2517 CANFD an CM3

Thu Apr 11, 2019 9:37 am

Hello,

to this topic i found kernel patches for mcp2517fd

Driver
https://github.com/sitec-systems/meta-s ... 17fd.patch

kconfig and makefile
https://github.com/sitec-systems/meta-s ... rnel.patch

Devicetree (bottom of the page)
https://patchwork.ozlabs.org/patch/841150/

Is possible put it all into main Rasbian kernel? Same as is mcp2515...?

Thank you

bertr2d2
Posts: 97
Joined: Wed Aug 08, 2012 10:12 pm

Re: MCP2517 CANFD an CM3

Mon Apr 15, 2019 5:24 am

Hi,

official patches are found on M.Sperls git. For precompiled images have a look at https://github.com/msperl/linux-rpi/releases .

Please give feedback. The developer needs it for integration into the Kernel.

Regrads

Gerd.
Easy to build CAN-Bus interface:
http://lnxpps.de/rpie

vojjta
Posts: 3
Joined: Thu Apr 11, 2019 9:26 am

Re: MCP2517 CANFD an CM3

Wed Apr 17, 2019 7:25 am

Hello,

i tried version mcp25xxfd-V6.11

Code: Select all

[email protected]:~ $ uname -a
Linux raspberrypi 4.14.98ms7-v7+ #75 SMP Sat Feb 16 22:22:33 UTC 2019 armv7l GNU/Linux

I have got two mcp2517fd with receivers on breadboard (not any kit or shield) connected to RBPi 3 b +
CANBUS is connected between tham so i can receive canfd messages on one from other. Also i have 120ohm resistor parallel to canbus

Code: Select all

[email protected]:~ $ dmesg | grep spi                                           
[    4.241270] mcp25xxfd spi0.1: MCP2517 successfully initialized.
[    4.302446] mcp25xxfd spi0.0: MCP2517 successfully initialized.

/boot/config.txt

Code: Select all

[email protected]:~ $ cat /boot/config.txt | tail -n16
kernel=ms7/zImage
device_tree=ms7/bcm2710-rpi-3-b-plus.dtb
overlay_prefix=ms7/overlays/

dtoverlay=mcp2517fd-can0
dtparam=interrupt=25
dtparam=oscillator=20000000
dtparam=spimaxfrequency=20000000

dtoverlay=mcp2517fd-can1
dtparam=interrupt=24
dtparam=oscillator=20000000

I am setting both can interfaces from example shown here https://www.kernel.org/doc/Documentatio ... ng/can.txt

Code: Select all

sudo ip link set can0 up type can bitrate 500000 sample-point 0.75 dbitrate 4000000 dsample-point 0.8 fd on

But with this version of kernel, RBPI freezes after 15-60min when i am generating canfd messages on both cans using cangen

Code: Select all

cangen -f can- -v can0 -g 20

If RBPi is doing nothing everthing seems fine... Unfortunately i could not find eny error in system logs

Originally i used but RBPi did not freezed
https://github.com/GBert/misc/tree/master/RPi-MCP2517

vojjta
Posts: 3
Joined: Thu Apr 11, 2019 9:26 am

Re: MCP2517 CANFD an CM3

Wed Jun 05, 2019 11:14 am

Hi,

Any news about it?

Vojjta

bertr2d2
Posts: 97
Joined: Wed Aug 08, 2012 10:12 pm

Re: MCP2517 CANFD an CM3

Wed Jun 05, 2019 4:27 pm

Hi,

please use the actual driver and report errors back to Martin Sperl. Here is the source and precompiled modules for the actual Raspbian Kernel:
https://github.com/msperl/linux-rpi/rel ... 5xxfd-V8.2

Regards

Gerd
Easy to build CAN-Bus interface:
http://lnxpps.de/rpie

Return to “Interfacing (DSI, CSI, I2C, etc.)”