2 2
BertHav

tutorial MCP2515 CAN bus user overlay

Recommended Posts

Hereby a tutorial to connect an MCP2515 based CAN bus interface to an OrangePi 3 running successfull with Buster minimal nightly with 5.3 kernel. It uses the attached user overlay only and doesn’t need any other overlay.

 

Connections
CAN module

OPi3

26 pin header

Raspberry

CAN interface

40 pin header
Vcc 3.3 CON12-P01 1
Gnd CON12-P06 6
MOSI CON12-P19 19
MISO CON12-P21 21
CLK CON12-P23 23
CS CON12-P24 24
INT CON12-P26 22

Optional 5V for

Transceiver

on cheap

Chinese modules

CON12-P02

Not used

when

equiped

with a

3.3V transceiver

 

Add the attached overlay with the command:

sudo armbian-add-overlay spi-h6-mcp2515.dts

The file /boot/armbianEnv.txt now contains a line:

user_overlays=spi-h6-mcp2515

Reboot the OrangePi 3

Check if the MCP2515 is recognized:

pi@orangepi3:~$ dmesg | grep mcp

If properly connected it should return a line containing:

mcp251x spi1.0 can0: MCP2515 successfully initialized.

As stated a can0 interface should be generated check it with:

pi@orangepi3:~$ sudo ifconfig -a

 

 

Bring up the network:

sudo ip link set can0 up type can bitrate 250000

Check if the interrupt is hooked:

cat /proc/interrupts

should return a line like this

46:          1          0          0          0  sunxi_pio_edge   8 Edge      mcp251x

 

Check for traffic on the CAN bus with candump from can-utils  (sudo apt-get install can-utils)

candump can0

 

spi-h6-mcp2515.dts

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
2 2