0

I added this to the /boot/config.txt and now I have two CAN interfaces #CAN bus controllers dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25 dtoverlay=mcp2515-can1,oscillator=16000000,interrupt=24

dtoverlay=spi-bcm2835

and when below command is given sudo ip link set up can0 type can bitrate 500000

the terminal hangs/stuck. even can't open ifconfig. Need to reboot every time and unable to link up the CAN. Could you please help

1

I assume here your CAN driver's name is mcp2515. You can confirm that by looking at the device tree file or by checking the lsmod output.

First, see if the device driver actually loads using lsmod | grep mcp2515. I think it will load the SPI driver as a dependency, check if that is the case.

Second, look at the kernel log for error messages from your driver, e.g. with sudo dmesg | grep mcp2515. See if these messages make sense (they often do) and try to fix any reported errors.

Third, if the driver is reported as loaded by lsmod, use modinfo mcp2515 or browse /sys/module/mcp2515/parameters/ to see what parameters it has and what are the values.

Edit: according to the link you have found, this is a kernel issue with two possible fixes:

  • downgrade to kernel 5.4

  • patch the mcp251x.c driver, replacing ret = mcp251x_hw_wake (spi); by ret = mcp251x_hw_reset (spi);. Alternatively, it is suggested to remove the disable_irq(spi->irq); from the mcp251x_hw_wake() funciton.

6
  • Unable to link/configure the CAN bus. I'm using OS 5.10.79-v7+. Upon boot up, "failed to load overlay dtoverlay=spi-bcm2835" is displayed on the edge of the screen Nov 23 '21 at 1:23
  • 1
    same problem is observed here forum.armbian.com/topic/14909-orange-pi-mcp2515-ip-up-freezes Dec 10 '21 at 4:02
  • @TheerthaBV Interesting. Did the fixes help? Dec 10 '21 at 12:05
  • i'm not from LINUX background. So, i'm on my way into LINUX and its structure. As it progresses i'll understand the things and will try to do the changes. Right now, CAN link is not established in the Raspberry PI 3B+ Dec 13 '21 at 3:20
  • I believe It's not possible to downgrade the kernel to 5.4 (let me know if you have the info or link about this) Dec 13 '21 at 3:26

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.