WelcomeWelcome | FAQFAQ | DownloadsDownloads | WikiWiki

Author Topic: Problem: Unable to Bring Up Two MCP2515 CAN Interfaces Simultaneously on piCore  (Read 246 times)

Offline milad

  • Newbie
  • *
  • Posts: 4
Two MCP2515-based CAN modules connected via SPI
Issue Description:
I have two MCP2515 CAN controllers connected to my Raspberry Pi via SPI (spi0.0 for can1 and spi0.1 for can0). The modules initialize successfully, but I can only bring one interface up at a time.

When I try to enable both CAN interfaces:
sudo ip link set can0 up type can bitrate 500000
sudo ip link set can1 up type can bitrate 500000
can0 successfully comes up, but when I attempt to bring can1 up, the Raspberry Pi freezes or fails to enable it.
If I start with can1, it works, but then trying can0 results in
Device or resource busy

Checking dmesg | grep can shows both modules initialized:
mcp251x spi0.1 can0: MCP2515 successfully initialized.
mcp251x spi0.0 can1: MCP2515 successfully initialized.

Offline gadget42

  • Hero Member
  • *****
  • Posts: 857
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline milad

  • Newbie
  • *
  • Posts: 4
Thank you for your response!
I appreciate the information on how CAN works. However, I already understand how CAN operates and have successfully used it on DietPi. The issue I’m facing here isn’t related to the CAN protocol itself—the problem is that SPI doesn’t seem to work simultaneously for both CAN interfaces.

On DietPi, I was able to use both interfaces (can0 and can1) simultaneously without issue. It seems like there’s something specific to piCore or the SPI setup that’s causing the problem.

If anyone has experience with using multiple SPI devices concurrently on piCore, I’d love to hear suggestions!

Offline patrikg

  • Wiki Author
  • Hero Member
  • *****
  • Posts: 732
Same spi addresses ?

Offline milad

  • Newbie
  • *
  • Posts: 4
yes , I'm using dtoverlay=mcp2515-can0 and can1 on the same bus
« Last Edit: February 28, 2025, 04:25:04 PM by milad »

Offline gadget42

  • Hero Member
  • *****
  • Posts: 857
The fluctuation theorem has long been known for a sudden switch of the Hamiltonian of a classical system Z54 . For a quantum system with a Hamiltonian changing from... https://forum.tinycorelinux.net/index.php/topic,25972.msg166580.html#msg166580

Offline milad

  • Newbie
  • *
  • Posts: 4
Thanks again!
However, my problem is not related to the MCP2515 driver or wiring. The issue is that SPI on piCore cannot handle two CAN interfaces simultaneously (I THINK).

On other OSes like DietPi, both can0 and can1 come up together and work fine. But on piCore, I can only bring up one at a time—attempting to bring up the second interface causes issues.

The problem seems to be with SPI handling on piCore, not the CAN setup itself. Any ideas or suggestions on how to resolve this would be greatly appreciated!

Offline Rich

  • Administrator
  • Hero Member
  • *****
  • Posts: 11912
Hi milad
Maybe you could post the output from the following commands:
Code: [Select]
version
uname -r
This way people will know what version of piCore you are running
and on which architecture.

yes , I'm using dtoverlay=mcp2515-can0 and can1 on the same bus
Oh good, you shared some information about your config.txt file.

This guy has 5 MCP2515 controllers running, but based on what little
information you provided, I think his config.txt might be doing the
overlays a bit differently:
https://forums.raspberrypi.com/viewtopic.php?t=353869