[SOLVED] MCP2515 CAN BUS Ubuntu 18.04 intel CPU

BenSpexBenSpex New Member Posts: 8
edited July 22 in 40-PIN GP-bus


I have purchased the wave share can hat https://www.waveshare.com/w/upload/2/29/RS485-CAN-HAT-user-manuakl-en.pdf
It works well on my Raspberry PI, but I really need to get it working on the Up Squared und Ubuntu as well.

Steps I have taken:
Enable SPI this worked and I can control an E-Paper display through SPI
I took the kernel code from @nukular thanks for this.
You can find the kernel here https://forum.up-community.org/discussion/96/canbus-hat-support
And tried it to get it working.
I tried busnum 0, 1 and 2. Only with bus number 2 the kernel loads. Otherwise I get no such device.
Interrupt is on PIN 22 or 402 (Linux) I even tried every available pin, same result as below
Tried different settings on the SPI max Hz and went really low, to ensure that this was not the problem either.

The kernel module loads but gives the following output no matter what I try (except for changing the bus number, then it does not load at all):
running dmesg | grep mcp give me
> mcp2515_init: init mcp2515_init: irq for pin 402 is 130 mcp251x spi2.0: Cannot initialize MCP2515. Wrong wiring? mcp251x spi2.0: Probe failed, err=19 mcp2515_init: device created!

Does any one has any idea on where to look?



  • BenSpexBenSpex New Member Posts: 8

    So if anyone else hast the problem I have found the solution:
    From @WereCatf :smile:

    That's because you have used the spi-enable.zip from the Wiki -- it reserves those chip-select pins and that's why they can't be used by device-drivers. You have to delete the file /lib/firmware/acpi-upgrades/spidev1.0.aml if you want to use cs0, or /lib/firmware/acpi-upgrades/spidev1.1.aml if you want to use cs1, and run:
    sudo update-initramfs -u -k all
    This updates the initramfs, removing the claim on the SPI-bus, so you have to reboot afterwards.

  • ccaldeccalde Administrator, Moderator, Emutex Posts: 331 admin

    Hi @BenSpex ,

    Thank you very much for your contribution!
    The solution there looks fine!

Sign In or Register to comment.