CAN/ISOBUS Enabled Android
Latest commit 8fc31b5 Jun 3, 2016 @wang701 wang701 Change the readme title
Failed to load latest commit information.

Turn a Nexus 9 into CANdroid

CAN/ISOBUS Enabled Android


This project is still evolving. Hence, there might be major changes to different parts of the project coming soon. This README will be updated frequently to reflect these changes.

What You Need to Make a CANdroid


  1. 1 x rooted Nexus 9
  2. 1 x OTG Y-cable like this
  3. 1 x USB hub
  4. 2 x USB2CAN adapters from 8devices

NOTE: Depends on the specific project, extra materials should be needed. For ISOBUS purposes, ISOBUS plugs are needed.


  1. Android NDK from Google
  2. adb and fastboot
  3. abootimg
  4. Nexus 9 kernel source code repo tegra from Google

How to make a CANdroid (tested in Ubuntu)


  1. Root and unlock your Nexus 9
  2. Install adb and fastboot
  3. Install Android NDK Download Android NDK and decompress it. What we want is in this directory:

It has prebuilt compiler for compiling the Android kernel. Make your sure you add these files to your system path. To verfiy, run:

$ aarch64-linux-android-gcc --version

You should get something similar like this:

aarch64-linux-android-gcc (GCC) 4.9 20140827 (prerelease)
Copyright (C) 2014 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
  1. Install abootimg
  2. You may also want to add udev rules for Android devices to your system

Compiling kernel source code

Copy candroid.patch from this repo into tegra repo. Check out android-tegra -flounder-3.10-lollipop-mr1 branch and apply the patch:

git am candroid.patch

NOTE: This patch contains changes for both enabling OTG charging and ISOBUS as a builtin module.

Then, do:

$ export ARCH=arm64
$ export SUBARCH=arm64
$ export CROSS_COMPILE=aarch64-linux-android-
$ make flounder_defconfig

Rename your config to .config, copy .config into tegra repo and do:

$ make all -j4

This generates a kernel image Image.gz-dtb in arch/arm64/boot.

Making a boot image

Using the boot.img.test provided in this repo, run:

$ abootimg -u boot.img.test -k tegra/arch/arm64/boot/Image.gz-dtb

If the command gives an error complaining about bootsize, run the above command with -c bootsize=VALUE. VALUE is the larger value given in the error message.

NOTE: Details on how boot.img.test is generated can be found here

Boot with new kernel image

Connect your Nexus 9 into your computer, run:

$ adb devices

You should be able to see your device with a serial number if it's properly connected.

Then, reboot into bootloader:

$ adb reboot bootloader

Given that the device is unlocked, in the same directory where boot.img.test is, run:

$ fastboot boot boot.img.test

Nexus 9 should boot into the kernel you just compiled. To verify, on Nexus 9, go to Settings, About tablet, and in Kernel version you should see "candroid" being appended.

If you think the new kernel image is tested, you can flash the image by rebooting into the bootloader and then run:

$ fastboot flash boot boot.img.test

Now, you should have an Android device that has OTG charging capabilities and CAN/ISOBUS interfaces.

Work with CANdroid

Sample connection

Sample Connection

NOTE: You don't have to have a power source unless you want to use OTG charging. NOTE': Currently, although charging is taking place in OTG mode, the battery gauge in system UI will not be updated accordingly.

Install ADB Wifi

This utility allows user to excute adb commands over Wifi. You can typically find this utility in Google Play Store.

Tools and scripts

can_log_raw.c can be found in tools/ and candroid-up/ can be found in scripts/.

can_log_raw.c listens to all available CAN interfaces and print out CAN frames to stdout.

candroid-up/ set and brings up can0 and can1.

To cross-compile can_log_raw.c, you need to have ndk-build in your system, and then in the tools directory do:


After a succcessful build, the binary should be in libs/.

Then, move the scripts and the binary to Nexus 9. For example, after connecting to the device, do:

$ adb push can_log_raw /data/local/tmp

NOTE: You need to make the binary executable and have the right permission in order to execute it.

Start logging CAN data

Wire the connections as in the Sample Connection.

The driver 8devices's USB2CAN adapter is already built into the kernel. So, when the adapters are plugged in, interfaces like can0, can1 will be automatically set up (but not the bitrate).

In Android's shell, cd into where scripts are stored, do:

# ./

This will birng up can0, can1 with 250kbps as bitrate.

Then, run the logger:

# ./can_log_raw > can-data.txt

Data should be redirected into the file you specified.

To stop the logger, in another Android's shell session, do:

# ./