banana pi BPI-R1 A20 dual core open source smart r
  • Initial page
  • LANGS
  • About Banana pi BPI-R1
    • BPI-R1 hardware spec
    • First Chapter
    • Summary
    • BPI-R1 DC Power interface
    • Armbian Linux
    • Compulsive modification of HDMI output resolution
    • BPI-R1 Audio
    • BPI-R1 quick start
    • BPI-R1 CAN Bus
    • BPI-R1 Linux software
    • David Bentham / openwrt-bpi-r1-prebuilt
    • BPI-R1 schematic diagram
    • BPI-R1 HDMI interfact
    • BPI-R1 android software
    • How to build OpenWRT image from github
    • Linux mainline kernel
    • BPI-R1 3.7V lithium battery interface
    • BPI-R1 RGB DSI interface
    • BPI-R1 wifi antenna slot
    • BPI-R1 CE,FCC RoHS Certification
    • BPI-R1 Audio
    • BPI-R1 IR interface
    • BPI-R1 Software
    • bananianlinux
    • WiringPi python
    • NetBSD/evbarm on Allwinner Technology SoCs
    • BPI-R1 OpenWRT
    • BPI-R1 MIC
    • BPI-R1 WiringPi
    • BPI-R1 5 GbE Ethernet ports
    • linux-sunxi wiki
    • BPI-R1 WIFI interface
    • Lamobo Openwrt image
    • BPI-R1 Camera interface
    • BPI-R1 SD card slot
    • BPI-R1 hardware interface
    • Manual for HW setup and basic router functionalities
    • Reference documents
    • Allwinner chip documents
    • linuxkernel34bspimage
    • BPI-R1 WiringPi
    • BPI-R1 SATA interface
    • BPI-R1 Camera interface
    • Linux mainlining effort
    • Pi4J Project
    • BPI-R1 OTG interface
    • BPI-R1 GPIO Pin define
    • Asterisk on BPI-R1
    • Officeal OpenWRT
    • BPI-R1 USB interface
  • About Banana pi BPI-R1
    • Pi4J Project
    • Linux mainlining effort
    • Asterisk on BPI-R1
    • BPI-R1 android software
    • How to build OpenWRT image from github
    • Officeal OpenWRT
    • BPI-R1 3.7V lithium battery interface
    • Summary
    • Armbian Linux
    • BPI-R1 Audio
    • BPI-R1 CE,FCC RoHS Certification
    • BPI-R1 Software
    • WiringPi python
    • BPI-R1 3D & DXF file
    • BPI-R1 OpenWRT
    • BPI-R1 schematic diagram
    • BPI-R1 HDMI interfact
    • linuxmainlinekernel
    • freebsdnetbsd
    • All banana pi product
    • BPI-R1 Camera interface
    • Lamobo Openwrt image
    • BPI-R1 SD card slot
    • bpi-r1-bpi-r2-board-comparison
    • BPI-R1 RGB DSI interface
    • bpi40customizedserver
    • BPI-R1 wifi antenna slot
    • bananianlinux
    • BPI-R1 IR interface
    • BPI-R1 Audio
    • bpi-r1-openbsd
    • Reference documents
    • NetBSD/evbarm on Allwinner Technology SoCs
    • Allwinner chip documents
    • BPI-R1 WiringPi
    • BPI-R1 MIC
    • BPI-R1 5 GbE Ethernet ports
    • BPI-R1 WiringPi
    • BPI-R1 OTG interface
    • linux-sunxi wiki
    • BPI-R1 GPIO Pin define
    • BPI-R1 WIFI interface
    • BPI-R1 USB interface
    • BPI-R1 hardware interface
    • BPI-R1 DC Power interface
    • BPI-R1 hardware spec
    • First Chapter
    • Manual for HW setup and basic router functionalities
    • Compulsive modification of HDMI output resolution
    • linuxkernel34bspimage
    • BPI-R1 quick start
    • BPI-R1 Camera interface
    • BPI-R1 SATA interface
    • BPI-R1 Linux software
    • BPI-R1 CAN Bus
    • David Bentham / openwrt-bpi-r1-prebuilt
  • Getting Started with R1 - Banana Pi Wiki
Powered by GitBook
On this page

Was this helpful?

  1. About Banana pi BPI-R1

BPI-R1 CAN Bus

PreviousBPI-R1 quick startNextBPI-R1 Linux software

Last updated 5 years ago

Was this helpful?

In order to port to the BananaPi, the CAN module description is needed from the A20 hardware manual. can4linux is a character-driver-based Linux driver used already on desktop PCs and embedded platforms like Freescale FlexCAN (the i.MX series of micro controllers) or Xiliny Zynq.

There is a more detailed document about CAN on the A20 at

This is a tutorial for using CAN BUS on bananapi with bananian 15-01

Thank selqcir share this example:

  • Download and install "bananian-1501.img" into 8 GB SDCard.

  • Expand the root file system using "bananian-config"

  • Install missing package:

    apt-get install git
    apt-get update
    apt-get upgrade
    reboot
  • Get last bananian available, and continu to install missing package:

    git clone https://github.com/Bananian/linux-bananapi
    apt-get install build-essential u-boot-tools uboot-mkimage 
    apt-get install libusb-1.0-0 libusb-1.0-0-dev git wget fakeroot kernel-package zlib1g-dev libncurses5-dev
    apt-get install subversion
  • Build kernel:

    cd linux-bananapi
    make menuconfig
  • Exit without saving when menu appears

    zcat /proc/config.gz > /root/linux-bananapi/.config
    make uImage modules
    make INSTALL_MOD_PATH=output modules_install
  • At this step, kernel should be compiled and "Module.symvers" should be available

  • Then rename modules and firmware provide by Bananian, and replace by the new one.

    mv /lib/modules /lib/modules.old
    mv /lib/firmware /lib/firmware.old
    mv /root/linux-bananapi/output/lib/modules /lib/modules
    mv /root/linux-bananapi/output/lib/firmware /lib/firmware
  • Same for uImage:

    mount /dev/mmcblk0p1 /mnt 
    cd /mnt
    mv uImage uImage.old
    mv /root/linux-bananapi/arch/arm/boot/uImage /mnt
    reboot
  • Create link for further build:

    cd /lib/modules/3.4.104/
    ln -s /root/linux-bananapi build
    cd ~
  • Get Can4Linux and build it:

    svn checkout https://svn.code.sf.net/p/can4linux/code/trunk can4linux-code
    cd /root/can4linux-code/can4linux/
    make TARGET=BANANAPI
  • Install module for each startup of the board:

    insmod can4linux.ko
    cp can4linux.ko /lib/modules/3.4.104/kernel/net/can/
    depmod -A -v
    modprobe -v can4linux
    echo "" >> /etc/modules ; echo "can4linux" >> /etc/modules
    reboot
  • Build CAN example

    apt-get install swig
    apt-get install python-dev
    cd can4linux-code/can4linux-examples/
  • Update CAN speed and device in file "pyCan-example.py"

    ex:

    # setting the device number
    device = 0
    defaultBaudrate = '250'
  • Connect CAN transceiver and CAN bus, and check with for example:

   python pyCan-example.py

That's all

With this method, kernel version is "Linux bananapi 3.4.104" instead of "Linux bananapi 3.4.104+", because i was unable to find same sources than Bananian 15-01 , but CAN bus work !

Feel free to comment or update.

can4linux
https://dl.linux-sunxi.org/A20/CAN Bus1.pdf