Talk:RPi CANBus

From eLinux.org
Jump to: navigation, search

Contents

Thread titleRepliesLast modified
RPI Kernel Compilation Easier Method && CAN bus010:53, 19 September 2014
RPI Kernel Compilation Easier Method && CAN bus010:53, 19 September 2014

RPI Kernel Compilation Easier Method && CAN bus

I wanted to share my experience with building can bus support for the Raspberry Pi using the most recent version of Ubuntu (14.04 LTS).

In order to get everything up and running, I used a package called rpi-build (see rpi-build). On a fresh install of ubuntu 14.04, one needs to install 32-bit libraries, but not from ia32-libs. This package is deprecated in 14.04. The packages needed to install can be done with the following:

sudo apt-get install lib32stdc++6 zlib1g lib32z1

From here, you can build the code using (assuming cross-compilation from linux)

rpi-build use[stdlib] rpi_linux menuconfig
rpi-build use[stdlib] rpi_linux make
rpi-build use[stdlib] rpi_linux SSHIP=<ip address of Raspberry Pi>

In menu config, make sure to enable, CAN bus, timing calculation, and the usb driver (I used a PEAK USB adapter personally). I also recommend enabling the virtual CAN interface for testing code.

The Pi makes use of the SocketCAN library to perform the CAN bus integration. It can be called similarly to a TCP/IP socket, with some differences. If you use Python version 3.3+ you can create CAN sockets from Python.

Hope that this helps some others as I personally struggled with this.

10:53, 19 September 2014

RPI Kernel Compilation Easier Method && CAN bus

I wanted to share my experience with building can bus support for the Raspberry Pi using the most recent version of Ubuntu (14.04 LTS).

In order to get everything up and running, I used a package called rpi-build (see rpi-build). On a fresh install of ubuntu 14.04, one needs to install 32-bit libraries, but not from ia32-libs. This package is deprecated in 14.04. The packages needed to install can be done with the following:

sudo apt-get install lib32stdc++6 zlib1g lib32z1

From here, you can build the code using (assuming cross-compilation from linux)

rpi-build use[stdlib] rpi_linux menuconfig
rpi-build use[stdlib] rpi_linux make
rpi-build use[stdlib] rpi_linux SSHIP=<ip address of Raspberry Pi>

In menu config, make sure to enable, CAN bus, timing calculation, and the usb driver (I used a PEAK USB adapter personally). I also recommend enabling the virtual CAN interface for testing code.

The Pi makes use of the SocketCAN library to perform the CAN bus integration. It can be called similarly to a TCP/IP socket, with some differences. If you use Python version 3.3+ you can create CAN sockets from Python.

Hope that this helps some others as I personally struggled with this.

10:53, 19 September 2014