I need a CAN bus and the Raspberry Pi doesn't have this.

So, I would like to know if it is possible to transform some GPIO pins into a CAN bus.

Which libraries would permit this? I would like to program in Java, but I can program in C or C++ also.

Voltage will probably cause problems, but at this moment I just would like to know if it is possible to have the CAN protocol through the GPIO pins.



You cannot directly use GPIO to bit bang CAN signal due to timing issue, but you can use an interface chip like MCP2515 (SPI-to-CAN interface) to interface it from another bus. I did not found I2C-CAN interface, only SPI-CAN interface.


There are CAN adaptors for the Pi on the market. For example this one from SK Pang. According to the website it does require a custom kernel on the Pi.

I should point out that I have no connection with that company and haven't yet tried the adaptor.

If you are trying to connect the Pi to a car over Canbus, you may find it easier to use one of the many OBD adaptors. Although the programmability is of course more restricted.


This is unfortunately not possible in C, C++ or Java. The timing of the signals that make up the CAN protocol call for a dedicated CAN-controller or FPGA.

  • Hi Thanks for your answer. If I understand well, i will not have good perfomances if I do this. But for example i found this on the internet : skpang.co.uk/catalog/… If I use a program using this board can I have good performance or not ? In fact i really need an embedded computer with good performances (>= Raspberry Pi) with CAN output that i can program in Java or C++ or C (order of preferences). Do you know any board that permit this (there are not a lot of arm board that have bus can inside....) ? Thanks a lot. – StarBucK Jan 30 '14 at 22:42
  • 1
    What about riscOS? I am sure it could work via SPI and a breakout board or something. No details though. – Piotr Kula Mar 31 '14 at 22:00

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.