39 Responses

  1. CAN Bus Support in Raspberry Pi - Tiqni

    […] Update : Latest Raspbian supports CAN Controller MCP251X, you don’t need to add modules like described above. Please read the new post on how to use CAN Bus with Raspberry Pi. […]

  2. Mike Jagoe
    Mike Jagoe at | | Reply

    Hi,
    your site really helped me – i have my Pi + Pican board working and ‘candump’ delivers a great file.
    i am now trying to get the canplayer working, but (so far) with no joy. from the command line i am executing the following:
    (Bring up the virtual interface )
    $ modprobe vcan
    $ ip link add vcan0 type vcan
    $ ip link set vcan0 up
    (Run canplayer)
    $ canplayer vcan0=can0 < candump-2014-09-21_204243.log
    any idea why i get no response?
    Thanks

  3. Mike Jagoe
    Mike Jagoe at | | Reply

    i have got further thru the day. i have now run into a buffer error after the file starts to be read. my command lines are:
    $ ip link set can0 type can bitrate 250000 listen-only off
    $ canplayer -g 27 -I candump-2015-09-17_164844.log

    the can signals are received and my display starts to present them, then i get an error with buffer overflow.

    any ideas?

  4. Emi
    Emi at | | Reply

    The command
    sudo ip link set can0 up type can bitrate 250000
    is telling me
    Cannot find device “can0”

    What am I doing wrong? Or what have I missed?

  5. Holger
    Holger at | | Reply

    Hi!
    I’ve followed your instruction but unfortunately I get a “cannot find device can0” message using the ip command.
    I’m using a Seeed can shield which is originally for Arduino. I’ve connected it to my Raspi 2 using a breadboard.

    Interestingly, I do not get any mcp251x messages in dmesg.

    Any ideas?

  6. Rob
    Rob at | | Reply

    Hi Tiqni
    which can bus shield are you using?

    Rob

  7. akshay
    akshay at | | Reply

    Have you tested it on pi 2 b?

  8. Mike
    Mike at | | Reply

    Tiqni,

    Can you share how the components are wired on your breadboard?

    Thanks!

    -Mike

  9. Mike
    Mike at | | Reply

    Tiqni,

    When do you think you’ll have the hardware post up? Just want to understand your timing before I bother you on FB. Thanks again!

    -Mike

  10. Alex
    Alex at | | Reply

    Hi Tiqni,
    I have recently purchased Pican2 duo board for my work project. I have 4.1.19-v7+ kernel and I connected the board to my Raspberry PI 2 but I did not wire CAN controllers themselves (no jumper wires go to the controllers). I followed your instructions but I can’t set can0 up. It says can0 not found. Does it mean that I have a a bad board or I have to connect the controller(s) to something? Sorry, I am a SW guy. I am not much in HW.
    Your help will be greatly appreciated.
    Thanks
    Alex.

  11. akshay lalla
    akshay lalla at | | Reply

    hi there , im using a CAN-SPI click board form MikroElektronica coupled with a pi-2 click shield. im having a problem finding “can0”

  12. Mark
    Mark at | | Reply

    For those getting can’t find can0. Try changing:
    dtoverlay=mcp2515-can0-overlay,oscillator=16000000,interrupt=25
    to
    dtoverlay=mcp2515-can0,oscillator=16000000,interrupt=25
    It worked for me.

    1. Rafael
      Rafael at | | Reply

      Hi Mark,
      This worked for me too, thank you very much for posting this advice!!!!

  13. NJ
    NJ at | | Reply

    Hi!
    Thank you for your tutorial. Its of great help indeed. However I need to get the same working on a Raspberry Pi3 (attached with CAN shield) with Windows 10 IoT Core instead of Linux. Do you have any idea about this?

    Thankyou!
    NJ

  14. Daniel Berntsson
    Daniel Berntsson at | | Reply

    can u do one more guide, using the new Kernel version:4.4 and
    RASPBIAN:)

  15. Marc Schattorie
    Marc Schattorie at | | Reply

    I’ve seen this question in this comment section, but the solutions given don’t seem to work for me.
    When I try

    ip link set can0 up type can bitrate 500000
    It results in
    Cannot find device “can0”

    When I try:
    ip link add dev vcan0 type vcan
    ip link set vcan0 up

    It appears to work, it doesn’t result in any errors, and the vcan0 shows up in ifconfig…

    Any help?

    1. Marc Schattorie
      Marc Schattorie at | | Reply

      Sorry, correction, I missed the comment from Mark… I tried that, now the interface seems to be setup correct, but I’m not getting any data (I tried several bitrates)…

  16. pandu
    pandu at | | Reply

    Hello hi Tiqni,
    Will this procedure works with (Raspberry pi 3 B) and Raspberry Pi 2.Are it does not works with both…if it works can you tell me which kernel version i should use..??

  17. John Abbott
    John Abbott at | | Reply

    Folks,
    The command
    sudo ip link set can0 up type can bitrate 250000
    is telling me
    Cannot find device “can0”
    I have the Arduino Shields Connection Bridge and the CAN Bus Module from Cooking-Hacks connected to a Raspberry Pi 3.
    God bless and thank you

  18. Adam
    Adam at | | Reply

    Thanks for the help,

    I am using a
    Pi3 running latest raspbian (stretch)
    Pi 2 click shield (MIKROE-1879)
    CAN SPI click 3.3V (MIKROE-986)
    the board I’m communicating with uses ISO1050 CAN transceiver chip, running at 5V.
    the CAN baud rate is 500k

    The software appears to be up and running, but when I connect to my CAN network, I don’t see any traffic to or from the Pi.
    A couple of questions:
    – the click board has a 10MHz oscillator, should I change my config file to:
    dtoverlay=mcp2515-can0,oscillator=10000000,interrupt=25
    – ifconfig shows can0 as being available and ready, but indicates 0 RX packets
    – my hardware is using 5V CAN output (ISO1050), could that be the source of my issues? should I try it with a voltage divider?

    Thanks,
    Adam

  19. Adam
    Adam at | | Reply

    After double checking my hardware, I seem to have gotten things working using:

    dtoverlay=mcp2515-can0,oscillator=10000000,interrupt=6

    Adam

  20. rnelson
    rnelson at | | Reply

    Note sure if this thread is alive but … I’m using a Raspberry Pi 2B with the latest OS and a MCP2515/TJA1050. The OS is the latest
    RASPBIAN STRETCH 4.14 which already has the CAN utils. Using the above I can setup my can0 to receive perfectly. BUT I cannot transit. When I use the command “cansend can0 110#1234” I would expect to see data on the can bus like I see when the PI/can0 is receiving. Ifconfig can0 looks good.. Any ideas of what to check? Thanks…RNelson

Please comment with your real name using good manners.

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.